Hello,
I have defined a simple EventCommand object:
object EventCommand "cmd_service_restart" {
import "plugin-event-command"
command = "/etc/init.d/crond restart"
}
Defined a service:
apply Service "crond" {
import "generic-service"
check_command = "procs"
if (host.vars.remote_client) {
command_endpoint = host.vars.remote_client
}
vars.procs_command = "crond"
vars.procs_critical = "1:"
event_command = "cmd_service_restart"
assign where host.vars.os == "Linux"
}
I can see that the event is executed:
[2015-07-29 19:29:54 +0000] notice/Checkable: State Change: Checkable dc1udtlhtst02.stack.qadev.corp!crond soft state change from OK to CRITICAL detected.
[2015-07-29 19:29:54 +0000] notice/Checkable: Executing event handler 'cmd_service_restart' for service 'dc1udtlhtst02.stack.qadev.corp!crond'
[2015-07-29 19:29:54 +0000] notice/ApiListener: Sending message to 'dc1udtlhtst02.stack.qadev.corp'
[2015-07-29 19:29:54 +0000] notice/ApiListener: Relaying 'event::CheckResult' message
But apparently no command is executed elsewhere. Does anyone have any expertise in defining your own commands? I just need to restart services that went down without "by_ssh" plugin.
Thanks in advance.
I have defined a simple EventCommand object:
object EventCommand "cmd_service_restart" {
import "plugin-event-command"
command = "/etc/init.d/crond restart"
}
Defined a service:
apply Service "crond" {
import "generic-service"
check_command = "procs"
if (host.vars.remote_client) {
command_endpoint = host.vars.remote_client
}
vars.procs_command = "crond"
vars.procs_critical = "1:"
event_command = "cmd_service_restart"
assign where host.vars.os == "Linux"
}
I can see that the event is executed:
[2015-07-29 19:29:54 +0000] notice/Checkable: State Change: Checkable dc1udtlhtst02.stack.qadev.corp!crond soft state change from OK to CRITICAL detected.
[2015-07-29 19:29:54 +0000] notice/Checkable: Executing event handler 'cmd_service_restart' for service 'dc1udtlhtst02.stack.qadev.corp!crond'
[2015-07-29 19:29:54 +0000] notice/ApiListener: Sending message to 'dc1udtlhtst02.stack.qadev.corp'
[2015-07-29 19:29:54 +0000] notice/ApiListener: Relaying 'event::CheckResult' message
But apparently no command is executed elsewhere. Does anyone have any expertise in defining your own commands? I just need to restart services that went down without "by_ssh" plugin.
Thanks in advance.