I've got a new Nagios install 4.4.5 and checks work 100% the problem I'm having is getting email notifications. I tried fiddling with the numbers but I just can't get it to be consistent. I got 2 or three emails and now nothing.
What I'm looking to do is check services every 3mins and if there is a problem to instantly alert me and then check again in 2 min and if there is still a problem to alert me again. and to keep doing that for 2hrs. It seems like a lot of emails but certain core services I need to be sure are operational.
Here's what I have.
Code: Select all
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$
}
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$
}
define hostgroup{
hostgroup_name databases ; The name of the hostgroup
alias DB Servers ; Long name of the group
members 192.168.1.55
}
define host{
use linux-server ;
host_name 192.168.1.55 ;
alias 192.168.1.55 ;
address 192.168.1.55 ;
}
define service{
use generic-service
host_name 192.168.1.55
service_description Replication Running
check_command check_rep
}
define contact {
name generic-contact ;
service_notification_period 24x7 ;
host_notification_period 24x7 ;
service_notification_options w,u,c,r,f,s ;
host_notification_options d,u,r,f,s ;
service_notification_commands notify-service-by-email ;
host_notification_commands notify-host-by-email;
register 0 ;
}
define host {
name generic-host ;
notifications_enabled 1 ;
event_handler_enabled 1 ;
flap_detection_enabled 1 ;
process_perf_data 1 ;
retain_status_information 1 ;
retain_nonstatus_information 1 ;
notification_period 24x7 ;
register 0 ;
}
define host {
name linux-server ;
use generic-host ;
check_period 24x7 ;
check_interval 3 ;
retry_interval 2 ;
max_check_attempts 120 ;
check_command check-host-alive;
notification_period 24x7 ;
notification_interval 3 ;
notification_options d,u,r ;
contact_groups admins ;
register 0 ;
}
define service {
name generic-service ;
active_checks_enabled 1 ;
passive_checks_enabled 1 ;
parallelize_check 1 ;
obsess_over_service 1 ;
check_freshness 0 ;
notifications_enabled 1 ;
event_handler_enabled 1 ;
flap_detection_enabled 1 ;
process_perf_data 1 ;
retain_status_information 1 ;
retain_nonstatus_information 1 ;
is_volatile 0 ;
check_period 24x7 ;
max_check_attempts 120 ;
check_interval 3 ;
retry_interval 2 ;
contact_groups admins ;
notification_options w,u,c,r ;
notification_interval 3
notification_period 24x7 ;
register 0 ;
}
Any help would be very appr!
thanks