On 30.05.2014 14:03, Jorge Ferrando wrote:
Hello
I'm using icinga 2 and I have some command checks with arguments, for
instance:
object CheckCommand "check_nrpe"{
import "plugin-check-command"
command = PluginDir + "/check_nrpe -H $host.address$ $args$"
vars.args =""
}
object Service "arecibo - Chequeo Disco 2 (NRPE)" {
import "generic-service"
host_name = "arecibo"
check_command = "check_nrpe"
vars.args = "-c check_disk2"
}
Problem is icinga2 is adding quotes around variable substitution and it
makes command to fail:
# /usr/lib/nagios/plugins/check_nrpe -H '158.42.250.101' '-c check_disk2'
NRPE: Command ' check_disk2' not defined
# /usr/lib/nagios/plugins/check_nrpe -H '158.42.250.101' -c check_disk2
DISK OK - free space: /var/log/nagios3 7469 MB (19% inode=99%);|
/var/log/nagios3=30799MB;40237;40227;0;40317
Is there any way to solve this or to remove those quotes from checks??
That's right. Arguments are automatically shell escaped. You should
rather fix your Check Command to only pass argument values, but not
entire strings just as lazy "args". That's common and wrong 1.x / Nagios
thinking.
Icinga 2 already ships the "nrpe" command.
http://docs.icinga.org/icinga2/snapshot/chapter-6.html#nrpe
Use that to define your service check
object Service "arecibo - Chequeo Disco 2 (NRPE)" {
import "generic-service"
host_name = "arecibo"
check_command = "nrpe"
vars.nrpe_command = "check_disk2"
}
If you want, add the "vars.nrpe_address = $address$" line, but that's
already the default in the check command definition shipped with Icinga 2.
I've created a ticket to update the documentation to make it more
reasonable what to do.
https://dev.icinga.org/issues/6364
best regards,
Michael
--
DI (FH) Michael Friedrich
[email protected] || icinga open source monitoring
https://twitter.com/dnsmichi || lead core developer
[email protected] || https://www.icinga.org/team
irc.freenode.net/icinga || dnsmichi
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users