I need to execute the following command as an icinga2 service:
# /usr/lib/nagios/plugins/check_nrpe -H 10.0.0.100 -c check_tasksched -a "filter=enabled eq 1 AND title eq 'PKI-Health'" 'crit=exit_code ne 0' show-all 'detail-syntax= Der Job %(title) hat den Exitode %(exit_code)'
Der Job PKI-Health hat den Exitode 0|'PKI-Health_exit_code'=0;0;0
As in the service definition here
apply Service "check_checktask_PKI-Health" {
import "generic-service"
display_name = "checktask PKI-Health"
check_command = "nrpe"
vars.nrpe_command = "check_tasksched"
vars.nrpe_arguments = "\"filter=enabled eq 1 AND title eq 'PKI-Health'\" 'crit=exit_code ne 0' show-all 'detail-syntax= Der Job %(title) hat den Exitode %(exit_code)'"
assign where regex("pki", host.name)
}
The service fails with Invalid command line: unrecognised option '"filter=enabled eq 1 AND title eq 'PKI-Health'" 'crit=exit_code ne 0' show-all 'detail-syntax= Der Job %(title) hat den Exitode %(exit_code)''
But its exactly what it has to be. Copy/paste the “unrecognised option” to the shell command passes OK.
How do I have to quote the arguments above in the “vars.nrpe_arguments” variable?
Thank you and best regards
Ralf
icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.10.3-1)
Copyright (c) 2012-2019 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
System information:
Platform: Ubuntu
Platform version: 18.04.2 LTS (Bionic Beaver)
Kernel: Linux
Kernel version: 4.15.0-46-generic
Architecture: x86_64
Build information:
Compiler: GNU 7.3.0
Build host: 5746b2511d14
Application information:
General paths:
Config directory: /etc/icinga2
Data directory: /var/lib/icinga2
Log directory: /var/log/icinga2
Cache directory: /var/cache/icinga2
Spool directory: /var/spool/icinga2
Run directory: /run/icinga2
Old paths (deprecated):
Installation root: /usr
Sysconf directory: /etc
Run directory (base): /run
Local state directory: /var
Internal paths:
Package data directory: /usr/share/icinga2
State path: /var/lib/icinga2/icinga2.state
Modified attributes path: /var/lib/icinga2/modified-attributes.conf
Objects path: /var/cache/icinga2/icinga2.debug
Vars path: /var/cache/icinga2/icinga2.vars
PID path: /run/icinga2/icinga2.pid
i actually used formatting but a “preview post” function would help me to improve the post.
Regarding your link that is not my recent problem. The arguments itself are passed.
That behaviour happens when I need to escape quotes on some agruments on the commandline as the check itself needs this syntax on the target.
Kind regards