모든 설정이 끝났다면 메일 설정이다.
http://caspian.dotconf.net/menu/Software/SendEmail/#installation
sendEmail-v1.56.tar 다운받자
# tar -xvf sendEmail-v1.56.tar
# cd sendEmail-v1.56
# mv * /usr/bin/
# vi /etc/nagios3/commands.cfg
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b%b%b%b%b%b%b" \
"***** Nagios *****\n\n" \
"Notification Type: $NOTIFICATIONTYPE$\n" \
"Host: $HOSTNAME$\n" \
"State: $HOSTSTATE$\n" \
"Address: $HOSTADDRESS$\n" \
"Info: $HOSTOUTPUT$\n\n" \
"Date/Time: $LONGDATETIME$\n" \
| /usr/bin/sendEmail -s $USER7$ -xu $USER9$ -xp $USER10$ -u "$HOMSTNAME$ DOWN" \
-l /var/log/sendemail \
-f $USER5$ \
-t $USER5$ \
-u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **"
}
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b%b%b%b%b%b%b%b%b" \
"***** Nagios *****\n\n" \
"Notification Type: $NOTIFICATIONTYPE$\n\n" \
"Service: $SERVICEDESC$\n" \
"Host: $HOSTALIAS$\n" \
"Address: $HOSTADDRESS$\n" \
"State: $SERVICESTATE$\n\n" \
"Date/Time: $LONGDATETIME$\n\n" \
"Additional Info:\n\n" \
"$SERVICEOUTPUT$" \
| /usr/bin/sendEmail -s $USER7$ -xu $USER9$ -xp $USER10$ -u "$HOMSTNAME$ DOWN" \
-l /var/log/sendemail \
-f $USER5$ \
-t $USER5$ \
-u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **"
}
# vi /etc/nagios3/resource.cfg
# The "from address" for notifications
$USER5$=your@mail.com
# The SMTP server
$USER7$=mail.mail.com
# the SMTP authentication username and password
$USER9$=your@mail.com
$USER10$=yourpasswd
# service nagios3 restart
해주면 이벤트 발생시 해당 메일로 메일이 발송이 된다.
'monitoring' 카테고리의 다른 글
nagios3 admin 암호 변경 (0) | 2014.07.18 |
---|---|
nagios3 the requested url /nagios3/docs/ was not found on this server (0) | 2014.07.11 |
Sorry, but Nagios is currently not checking for external commands, so your command will not be committed! (0) | 2014.07.04 |
nagios3 설치방법 (1) | 2014.07.02 |
zabbix server is not running the information displayed may not be current (0) | 2014.06.25 |