Code: Select all
# 'notify-service-by-http' command definition
define command{
command_name notify-service-by-http
command_line /usr/bin/curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"notification":{"host":$HOSTADDRESS$, "service":$SERVICEDISPLAYNAME$, "state":$SERVICESTATE$, "host-state-type":$SERVICESTATETYPE$, "notification-type":$NOTIFICATIONTYPE$, "attempts":$SERVICEATTEMPT$, "max-attempts":$MAXSERVICEATTEMPTS$, "time":$TIME$}}' http://192.168.56.113:9090/things > /tmp/notification.log
}
Code: Select all
http admin CRITICAL 03-19-2016 00:50:17 0d 0h 9m 0s 3/3 CHECK_NRPE: Socket timeout after 10 seconds.
Code: Select all
define contact{
contact_name saas-app ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias scaling as a service ; Full name of user
service_notification_options w,c,r
# host_notification_options w,c,r
# host_notification_commands notify-host-by-http
service_notification_commands notify-service-by-http
# register 0
}
define contactgroup{
contactgroup_name saas
alias scaling as a service notifying group
members saas-app
}
Code: Select all
define host{
host_name ubuntu-VirtualBox
address 192.168.56.113
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 0 ; Host event handler is enabled
flap_detection_enabled 0 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
check_command check-host-alive
max_check_attempts 3 ; recheck the service before notifying the contact
retry_check_interval 60 ; recheck intervals
notification_interval 0
# notification_options w,c,r
contact_groups saas
register 1 ; DONT REGISTER THIS DEFINITION – ITS NOT A REAL HOST, JUST A TEMPLATE!
}
define service {
host_name ubuntu-VirtualBox
service_description keystone http admin
check_command check_nrpe!check_keystone_http_admin
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}