monitoring

nagios3 메일 설정

Naan 2014. 7. 10. 11:04
320x100

모든 설정이 끝났다면 메일 설정이다.


http://caspian.dotconf.net/menu/Software/SendEmail/#installation

sendEmail-v1.56.tar 다운받자


sendEmail-v1.56.tar.gz


# 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 

해주면 이벤트 발생시 해당 메일로 메일이 발송이 된다.



320x100