分类: LINUX
2008-03-03 10:28:30
Through its threshold checking functionality mrtg is able to detect threshold problems for the various targets and can call external scripts to handle those problems (e.g. send email or a page to an administrator).
# 注释 :MRTG 还有一个功能就是针对 threshold 的监测。
# 当 MRTG 监测到超过 threshold 时,就调用外部脚本来处理(例如发送 mail 或者 page )
Threshold checking is configured through the following parameters:
# 注释 :MRTG 的 threshold checking 是通过以下参数来实现的 :
By defining ThreshDir to point to a writable
directory, MRTG will only alert you when a threshold boundery has been
crossed.
Example:
# 注释 :ThreshDir (全局)定义一个 mrtg 可写的目录,MRTG 会在该目录下记录超过 threshold 的告警记录
ThreshDir:
/var/mrtg/thresh
This is the minimum acceptable value for the Input (first) parameter. If the parameter falls below this value, the program specified in ThreshProgI will be run. If the value ends in '%' then the threshold is defined relative to MaxBytes.
# 注释 :ThresMinI 设置某个 Target 的最小输入 threshold 。
# 假如低于某个值,则调用 ThresPorgI 选项指定的脚本
# 如果 ThresMinI 的值是以 "%" 结尾,则认为是 MaxBytes 的百分之几
This is the maximum acceptable value for the Input (first) parameter. If the parameter falls above this value, the program specified in ThreshProgI will be run. If the value ends in '%' then the threshold is defined relative to MaxBytes.
# 注释 :ThresMaxI 表示输入数据的最大 threshold。如果超过该值,同样调用 ThreshProgI 。
# 同样也可以定义为 "
Its value will be assigned to the environment variable THRESH_DESC before any of the programs mentioned below are called. The programms can use the value of this variable to produce more user-friendly output.
# 注释 :ThreshDesc 是为某个 Target 的 Threshold 定义的描述信息。
# 在调用 ThreshProgI 前,会把该选项定义的内容赋予变量 "$THRESH_DESC"
# 这样 ThreshProgI 可以输出比较详细、友好的告警信息
This defines a program to be run if ThreshMinI or ThreshMaxI is broken. MRTG passes 3 arguments: the $router variable, the threshold value broken, and the current parameter value.
# 注释 :ThreshProgI 定义一个脚本,当达到或者超过 ThreshMinI 或者 ThreshMaxI 时,就调用该脚本
# MRTG 会传递3个变量给这个脚本 :$router 也就是 Target 的名称、ThreshMinI 或者 ThreshMaxI 的值、当期 Target 的值
This defines a program to be run if the parameter is currently OK (based on ThreshMinI and ThreshMaxI), but wasn't OK on the previous running -- based on the files found in ThreshDir. MRTG passes 3 arguments: the $router variable the unbroken threshold value, and the current parameter value.
# 注释 :ThresProgOKI 用于定义一个脚本,该脚本在监测的 Target 恢复正常时被调用。
# MRTG 会传递3个值给该脚本, $router 、ThreshMinI
或者 ThreshMaxI、Target 的当前值
These work the same as their *I counterparts, except on the Output (second) parameter.
# 注释
:ThreshMinO、ThreshMaxO、ThreshProgO、ThreshProgOKO
和上面的输入方面的选项的作用类似
Note that you
can use the SetEnv parameter explained above to pass additional information to
the threshold programs.
When calling threshold scripts from within your cfg file you might want to pass some data on to the script. This can be done with the SetEnv configuration option which takes a series of environment variable assignments. Note that the quotes are mandatory. This does not work for external scripts. It is not possible to set environment variables per target.
# 注释 :当 MRTG 调用上面提到的脚本时,可以通过 SetEnv 再传递一些变量给脚本。
# 注释 :用 SetEnv 定义变量时,用
Example:
SetEnv[myrouter]:
EMAIL="contact_email@someplace.net"
HOST=