Hi,
Setup is just one master and two clients to try some stuff out.
Cluster check is okay and endpoints are connected using icinga2 agent and several (default) checks do their work.
I created a check_test.sh script with a exit to see if I could execute a script on the clients.
This works just fine.
But…then I wanted to try check_mem.pl
cd /usr/lib/nagios/plugins/
wget https://raw.githubusercontent.com/ckujau/nagios-plugins/master/check_mem.pl
chmod +x check_mem.pl
Executing locally works fine:
root@vm6:~# sudo -u nagios /usr/lib/nagios/plugins/check_mem.pl -u -w 70 -c 90 -C
OK - 10.3% (415012 kB) used.|TOTAL=4041612KB;;;; USED=415012KB;2829128;3637450;; FREE=3626600KB;;;; CACHES=347288KB;;;;
Services.conf created:
apply Service “check_mem” {
import “slowcheck-service”
display_name = “Check memory”
check_command = “check_mem”
vars.warning = 70
vars.critical = 90
assign where host.vars.client_endpoint
}
In global-templates zone defined the command as following:
object CheckCommand "check_mem"{
import "plugin-check-command"
command = [PluginDir + "/check_mem.pl"]
arguments += {
"-u" = {}
"-w" = {
required = true
value = "$warning$"
}
"-c" = {
required = true
value = "$critical$"
}
"-C" = {}
}
}
icinga2 daemon -C gives no errors. Restarting service after changes. The changes are also visible on the clients (/var/lib/icinga2/api/zones/global-templates/_etc)
Above settings give me UNKNOWN “execvpe(/usr/lib/nagios/plugins/check_mem.pl) failed: No such file or directory” .
What is it that I’m doing wrong? Any tips/suggestions?
This works:
cat /usr/lib/nagios/plugins/plugin_test
#!/usr/bin/bash echo 2 exit 2;
Service:
apply Service "check_test_ok" { import "generic-service" check_command = "check_test" command_endpoint = host.vars.client_endpoint assign where host.vars.client_endpoint
}
command:
object CheckCommand “check_test” {
import “plugin-check-command”
command = [PluginDir + “/plugin_test”]
}