I have a problem with automatically mail notification in Nagios Core 4 installed on ubuntu 12 .04 lts server...
i have tried to send mail with nagios user and root user with the command:
echo "test" | mail -s "test mail"
[email protected]
and i received mail correctly...
but i don't receive any automatically mail notification...
i don't know how can i do to resolve this issue! :(
these are my configuration files (commands.cfg, contacts.cfg, nagios.log, mail.log):
commands.cfg (the path /usr/bin/mail is the right path):
# 'notify-host-by-email' command definition
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/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
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$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
}
contacts.cfg:
define contact{
contact_name supporto
alias Supporto Clienti DEA
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email
[email protected]
}
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members supporto
}
nagios.log:
[1401871412] SERVICE ALERT: fileserver;Current Users;OK;SOFT;2;USERS OK - 1 users currently logged in
[1401871953] SERVICE ALERT: backups;Nagios Status;WARNING;SOFT;1;NAGIOS WARNING: 36 processes, status log updated 541 seconds ago
[1401872133] SERVICE ALERT: backups;Nagios Status;OK;SOFT;2;NAGIOS OK: 36 processes, status log updated 180 seconds ago
[1401872321] SERVICE ALERT: posta;Swap Usage;CRITICAL;SOFT;1;CRITICAL - Plugin timed out after 10 seconds
[1401872322] SERVICE ALERT: fileserver;Current Users;CRITICAL;SOFT;1;CRITICAL - Plugin timed out after 10 seconds
[1401872420] SERVICE ALERT: archivio;Disk Space;CRITICAL;SOFT;1;CRITICAL - Plugin timed out after 10 seconds
[1401872492] SERVICE ALERT: fileserver;Current Users;OK;SOFT;2;USERS OK - 1 users currently logged in
[1401872492] SERVICE ALERT: posta;Swap Usage;OK;SOFT;2;SWAP OK: 100% free (1984 MB out of 1984 MB)
[1401872590] SERVICE ALERT: archivio;Disk Space;OK;SOFT;2;DISK OK
[1401872931] Auto-save of retention data completed successfully.
[1401873333] SERVICE ALERT: backups;Nagios Status;WARNING;SOFT;1;NAGIOS WARNING: 36 processes, status log updated 402 seconds ago
[1401873513] SERVICE ALERT: backups;Nagios Status;OK;SOFT;2;NAGIOS OK: 36 processes, status log updated 180 seconds ago
mail.log (i think that the problem is here but i don't know how to resolve it):
Jun 4 10:00:01 backups sm-msp-queue[6109]: My unqualified host name (backups) unknown;
sleeping for retry
Jun 4 10:01:01 backups sm-msp-queue[6109]: unable to qualify my own domain name (backups) -- using short name
Jun 4 10:20:01 backups sm-msp-queue[7247]: My unqualified host name (backups) unknown;
sleeping for retry
Jun 4 10:21:01 backups sm-msp-queue[7247]: unable to qualify my own domain name (backups) -- using short name
Jun 4 10:40:01 backups sm-msp-queue[8327]: My unqualified host name (backups) unknown;
sleeping for retry
Jun 4 10:41:01 backups sm-msp-queue[8327]: unable to qualify my own domain name (backups) -- using short name
Jun 4 11:00:01 backups sm-msp-queue[9549]: My unqualified host name (backups) unknown;
sleeping for retry
Jun 4 11:01:01 backups sm-msp-queue[9549]: unable to qualify my own domain name (backups) -- using short name
Jun 4 11:20:01 backups sm-msp-queue[10678]: My unqualified host name (backups) unknown;
sleeping for retry
Jun 4 11:21:01 backups sm-msp-queue[10678]: unable to qualify my own domain name (backups) -- using short name
i'm at the last step and i want to finish this Nagios Core! :)
Any help be appreciate!:)
host definition (this host have the disk almost full and it is in hard state but non notification) :
define host{
use generic-host ; Name of host template to use
host_name posta
alias Server Posta ESA
address 10.10.2.102
parents xen1, xen2
icon_image redhat.png
statusmap_image redhat.gd2
}
service definition:
define service{
use generic-service
host_name xen1, maestro, xen2, posta, nas002, serv2, esasrvmi02, esaubuntumi
service_description Disk Space
check_command ssh_all_disks!10%!5%
}
Notification is allowed for the contact definition you gave, but is it
also allowed at the the service level ?
sorry but i don't understand this thing! :(