Hi all
i have installed and configure nagios 2.0 in my RHEL 5 box.i am now able to monitor my server and network devices.But i am not recieving mails when the server or network is down.i have configured sendmail in my nagios server and added my exchange server in sendmail.mc…i am receving mails when i send a mail from nagios box.
[root@nagios-cgi ~]# mail -s “hai” [email protected]
Cc: Null message body; hope that’s ok
[root@nagios-cgi ~]# mailq
/var/spool/mqueue is empty
Total requests: 0
[root@nagios-cgi ~]#
after this i have recieved a mail from root@localhost
even i tried this method also
/usr/bin/printf “%b” "***** Nagios *****\n\nNotification Type: NOTIFICATI
ONTYPE\nHost: HOSTNAME\nState: HOSTSTATE\nAddress: HOSTADDRESS\nInfo: HOSTOUTPUT
\n\nDate/Time: LONGDATETIME\n" | /bin/mail -s “** NOTIFICATIONTYPE Host Alert: H
OSTNAME is HOSTSTATE **” [email protected]
i got a mail notification from root@localhost in my mail box
my contacts.cfg
define contact{
contact_name sudheshpn
alias Sudhesh Nair
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r,u
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email [email protected]
}
my contactgroup.cfg
define contactgroup{
contactgroup_name Domain-Admins
alias Nagios Administrator
members sudheshpn,nagiosadmin
}
my commands.cfg
‘host-notify-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 “Host $HOSTSTATE$ alert for $HOSTNAME$!” $CONTACTEMAIL$
}
‘notify-by-email’ 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$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}
Please help me to solve my problem.Thnks in advance