Notifications using isp smtp server with authentication

1

Click here to load reader

description

Notifications using isp smtp server with authentication in nagios

Transcript of Notifications using isp smtp server with authentication

Page 1: Notifications using isp smtp server with authentication

Notifications using ISP SMTP server with Authentication

Download from http://caspian.dotconf.net/menu/Software/SendEmail. Extract the file and copy the sendEmail into /usr/local/bin.

cp /root/sendEmail-v1.56/sendEmail /usr/local/bin/ chmod +x /usr/local/bin/sendEmail.

Now the setup and customization of Nagios.

#vim /usr/local/nagios/etc/resource.cfg [email protected]$USER7$=mail@1234

#vim /usr/local/nagios/etc/objects/commands.cfg

define command{

command_name notify-host-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" | /usr/local/bin/sendEmail -s $USER7$ -xu $USER9$ -xp $USER10$ -t $CONTACTEMAIL$ -f $USER5$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" }

}

define command{

command_name notify-service-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$" | /usr/local/bin/sendEmail -s $USER7$ -xu $USER9$ -xp $USER10$ -t $CONTACTEMAIL$ -f $USER5$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" }

}

#touch /var/log/sendEmail #chown nagios:nagios /var/log/sendEmail #chmod 666 /var/log/sendEmail# tail -f /var/log/sendEmailFeb 25 16:13:56 monitoring sendEmail[17711]: Email was sent successfully! From: <[email protected]> To: <[email protected]> <[email protected]> <[email protected]> Subject: [** RECOVERY Service Alert: CentOS 6/HTTP is OK **] Server: [192.168.0.1:25]P@W@n Kumar