How to add $HOSTNAME$ to hostgroup service eventhandler
Posted: Wed Jan 15, 2020 8:40 am
Hi
Im trying to create an event handler to affect a hostgroup service.
I want the eventhandler to affect only the host that has a service affected and I am not sure I am doing this correctly.
What I have configured:
define service {
use generic-service,service-pnp
hostgroup_name ourgroup
service_description CHECK ASERVICE SERVICE
check_command check_nrpe!check_aservice_server
max_check_attempts 3
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts theadmin
event_handler_enabled 1
#event_handler restart-aservice
}
define command {
command_name restart-aservice
command_line $USER1$/eventhandlers/restart-aservice $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $HOSTNAME$
}
Please is this correct?
Im trying to create an event handler to affect a hostgroup service.
I want the eventhandler to affect only the host that has a service affected and I am not sure I am doing this correctly.
What I have configured:
define service {
use generic-service,service-pnp
hostgroup_name ourgroup
service_description CHECK ASERVICE SERVICE
check_command check_nrpe!check_aservice_server
max_check_attempts 3
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts theadmin
event_handler_enabled 1
#event_handler restart-aservice
}
define command {
command_name restart-aservice
command_line $USER1$/eventhandlers/restart-aservice $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $HOSTNAME$
}
Please is this correct?