nagios报警短信开启与关停

nagios报警短信开启与关停
CHENXIN 20140403

1.大陆
http://114.112.69.229:8080/nagios/
检查主配置文件的主机那项调用的是哪个主机配置文件,然后按照这个主机的配置文件去找模本文件.
vim /usr/local/nagios/etc/nagios.cfg
...
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_dir=/usr/local/nagios/etc/objects/templates #以及该目录下的所有配置文件
...
cfg_file=/usr/local/nagios/etc/objects/bj/g10/hosts-bj-g10-162 #主机配置路径
...
cat /usr/local/nagios/etc/objects/bj/g10/hosts-bj-g10-162
define host {
use web-server-test #根据此名称去找模本,调用web-server-test模本(进入web-server-test模板后,会发现
host_name bj-g10-162 #又调用了一个web-host-test模本,而web-host-test模板中就是定义主机的报警短信开关
alias beijing-g10-162
address 117.79.150.162
icon_image web.gif
statusmap_image web.gd2
# parents bj-f11-114
contact_groups webadmins
check_command check_host
#max_check_attempts 3
}

vim /usr/local/nagios/etc/objects/templates/web-templates-test.cfg #如果有相同的模本配置,则最终加载到的应该是最后覆盖后的那个模板
cat /usr/local/nagios/etc/objects/templates/web-templates-test.cfg
cat web-templates-test.cfg
define host{
name web-host-test #web-host-test模板
notifications_enabled 1 #0 disable,1 enable
check_freshness 1
freshness_threshold 300
event_handler_enabled 1
flap_detection_enabled 1
low_flap_threshold 14
high_flap_threshold 80

    failure_prediction_enabled      1
    process_perf_data               1
    retain_status_information       1
    retain_nonstatus_information    1
    notification_period             24x7
    register                        0
    }

define host{
name web-server-test #web-server-test模本
use web-host-test #web-server-test模板调用了web-host-test模本(上面那个模板)
active_checks_enabled 0
#passive_checks_enabled 0
check_period 24x7
check_interval 3
retry_interval 1
max_check_attempts 3
check_command service-is-stale
notification_period 24x7
flap_detection_enabled 1
low_flap_threshold 14
high_flap_threshold 70
notification_interval 120
notification_options d,r
contact_groups webadmins
register 0
}

修改完此配置文件后,reload下服务就可以了.

2.海外
http://54.255.139.59:8088/nagios/
vim /usr/local/nagios/etc/objects/templates/web-templates-test.cfg

posted @ 2020-04-21 15:02  ChanixChen  阅读(187)  评论(0编辑  收藏  举报