nagios报错notify-by-email解决
报错:
- Error: Service notification command ‘notify-by-email’ specified for contact ‘zhuzhu’ is not defined anywhere!
- Error: Host notification command ‘host-notify-by-email’ specified for contact ‘zhuzhu’ is not defined anywhere!
这两条报错证明在commands.cfg里没有定义这两条
在commands.cfg里添加以下内容:
- # ‘notify-host-by-email’ command definition
- define command{
- command_name host-notify-by-email
- command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
- $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” | /bin/mail -s “** $NOTIFICATIONTYPE$ Host A
- lert: $HOSTNAME$ is $HOSTSTATE$ **” $CONTACTEMAIL$
- }
- # ’service_notification_commands’ command definition
- define command{
- command_name notify-by-email
- command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\
- nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT
- $” | /bin/mail -s “** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
- }
Nagios报错notify-by-email就解决了,不会报错啦!
【编辑推荐】