我采用nagios+cliofetion 开启通知,出现警告时只能收到email而收不到短信。
详情如下:定义contact define contact{
contact_name nagiosadmin
use generic-contact
alias Nagios Admin
host_notifications_enabled 1
service_notifications_enabled 1
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email,notify-service-by-sms host_notification_commands notify-host-by-email,notify-host-by-sms
email chj001001@163.com
pager 15915840232
address1 Huangpudadaoxi163,Guangzhou }
定义 飞信报警命令
define command{
command_name notify-host-by-sms
command_line $USER1$/sendsms.sh $CONTACTPAGER$ "Host $HOSTSTATE$ alert for $HOSTNAME$ on $DATETIME$" >/dev/null 2>&1}
define command{
command_name notify-service-by-sms
command_line $USER1$/sendsms.sh $CONTACTPAGER$ "$HOSTADDRESS$ $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" >/dev/null 2>&1}
定义sendsms.sh
vim /usr/local/nagios/libexec/sendsms.sh
#! /bin/sh
/usr/bin/cliofetion -f 15915840232 -p passwd -t "$1" -d "$2"
chown nagios.nagios /usr/local/nagios/libexec/sendsms.sh
chmod 755 /usr/local/nagios/libexec/send
详情如下:定义contact define contact{
contact_name nagiosadmin
use generic-contact
alias Nagios Admin
host_notifications_enabled 1
service_notifications_enabled 1
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email,notify-service-by-sms host_notification_commands notify-host-by-email,notify-host-by-sms
email chj001001@163.com
pager 15915840232
address1 Huangpudadaoxi163,Guangzhou }
定义 飞信报警命令
define command{
command_name notify-host-by-sms
command_line $USER1$/sendsms.sh $CONTACTPAGER$ "Host $HOSTSTATE$ alert for $HOSTNAME$ on $DATETIME$" >/dev/null 2>&1}
define command{
command_name notify-service-by-sms
command_line $USER1$/sendsms.sh $CONTACTPAGER$ "$HOSTADDRESS$ $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" >/dev/null 2>&1}
定义sendsms.sh
vim /usr/local/nagios/libexec/sendsms.sh
#! /bin/sh
/usr/bin/cliofetion -f 15915840232 -p passwd -t "$1" -d "$2"
chown nagios.nagios /usr/local/nagios/libexec/sendsms.sh
chmod 755 /usr/local/nagios/libexec/send