Hello,
I’m not able to run a simple script through event_command and I don’t find any way to figure out how to fix it.
When I write an event command to run a simple command:
object EventCommand "tomcat-restart" {
import "plugin-event-command"
command = [ "/usr/bin/wget", "http://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz" ,"-P", "/tmp/" ]
arguments = {}
}
I don’t have any problem to execute it, however if I try to use a script:
object EventCommand "tomcat-restart" {
import "plugin-event-command"
command = [ "/tmp/tomcat-restart.sh" ]
arguments = {}
}
where /tmp/tomcat-restart.sh is:
#!/bin/bash
/usr/bin/wget http://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz -P /tmp/
there’s no way:
I will be very thankful for any clue.
I share our services.conf applied:
apply Service "idle-cpu" {
import "servicio-base"
check_period = "24x7-CPU"
check_command = "nrpe"
vars.nrpe_command = "amz_idle_cpu"
# command_endpoint = host.vars.endpoint_name
event_command = "tomcat-restart"
assign where ( host.vars.os == "Linux" && host.vars.lugar == "amz" && host.vars.kind == "sxp")
}
I share the output I get when we run in debug mode:
[2019-12-09 17:20:35 +0100] notice/Checkable: Executing event handler 'tomcat-restart' for service 'sxp04!idle-cpu'
[2019-12-09 17:20:35 +0100] notice/Process: Running command '/tmp/tomcat-restart.sh': PID 30777
[2019-12-09 17:20:35 +0100] notice/Process: PID 30777 ('/tmp/tomcat-restart.sh') terminated with exit code 128
[2019-12-09 17:20:35 +0100] notice/PluginEventTask: Event command for object 'sxp04!idle-cpu' (PID: 30777, arguments: '/tmp/tomcat-restart.sh') terminated with exit code 128, output: execvpe(/tmp/tomcat-restart2.sh) failed: No such file or directory
Thanks and kind regards.