I am struggling to use nagios notification for my customized service, so when the status of service turned into critical, I can receive email.
So I have the following definition for my service and comand
Code: Select all
define service {
host_name ult-tdc-test1
service_description synapse_bandwidth:5672
servicegroups synapse_bandwidth_servicegroup
check_command check_dummy!2!"no updates for the last 360 second(s)"!!!!!!
is_volatile 0
initial_state u
max_check_attempts 1
check_interval 1
retry_interval 1
active_checks_enabled 0
passive_checks_enabled 1
check_period 24x7
obsess_over_service 1
check_freshness 1
freshness_threshold 60
event_handler_enabled 1
flap_detection_enabled 0
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 1
first_notification_delay 1
notification_period 24x7
notification_options w,c,u,r,f,s,
notifications_enabled 1
contacts scott.han
contact_groups synapse
stalking_options o,w,c,u,
notes_url http://192.168.56.101/nagios/cgi-bin/extinfo.cgi?type=2&host=$HOSTNAME$&service=$SERVICEDESC$
register 1
}
define contact {
contact_name scott.han
alias scott han
host_notifications_enabled 0
service_notifications_enabled 1
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,s,n,
service_notification_options w,u,c,r,f,s,n,
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
can_submit_commands 1
retain_status_information 3
retain_nonstatus_information null
email [email protected]
}
define contactgroup {
contactgroup_name synapse
alias synapse contactors
members scott.han
}
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: $SERVICEOUTPUT$\n\nURL: $SERVICENOTESURL$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
define timeperiod {
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
} however if I go to nagios web gui, click the service, in the advanced tab use Send custom notification, then it works.
I am not sure what is missing here, or what i have done wrong.
Any help would be really appreciated.
Many thanks,
Scott
Thanks, after I delete the service and recreate, the notification is working now.