That's exactly what i've done. -- > terminated with exit code 4, output: *** -h ip.address.of.host *** that's the actual $@ in the script.
in regard to the debug feature spiting out everything that happens, it doesn't: this is what it does (i changed the command and the script a little so output differs from previous) > [2015-06-28 16:17:20 +0300] notice/Process: Running command > '/usr/lib/nagios/plugins/check_openvpn' '-h' 'IPADDR': PID 16968 > [2015-06-28 16:17:20 +0300] debug/CheckerComponent: Check finished for object > 'HOST!openvpn' > [2015-06-28 16:17:20 +0300] notice/Process: PID 16968 > ('/usr/lib/nagios/plugins/check_openvpn' '-h' 'IPADDR') terminated with exit > code 4 > [2015-06-28 16:17:20 +0300] warning/PluginCheckTask: Check command for object > 'HOST!openvpn' (PID: 16968, arguments: > '/usr/lib/nagios/plugins/check_openvpn' '-h' 'IPADDR') terminated with exit > code 4, output: -h HOST - ALL PARAMS > Usage: /usr/lib/nagios/plugins/check_openvpn -h <host> -p <protocol> -z > <port> -x <ports> ^^^^ That is the actual -debug.log- not the icinga2.log Echoing $@ in my script doesnt help as i presume nothing except the host gets passed so the other arguments get somehow lost somewhere. here's my modified CheckCommand > object CheckCommand "check-openvpn" { > import "plugin-check-command" > import "ipv4-or-ipv6" > > vars.ip_port = "" > vars.ip_ports = "" > vars.ip_protocol = {{ > var tcp = macro("$openvpn_tcp_port$") > var udp = macro("$openvpn_udp_port$") > > if (tcp) { > vars.ip_protocol = "-sP" > vars.ip_port = "-p" > vars.ip_ports = [ "T:" + tcp ] > return > } else { > vars.ip_protocol = "-sU" > vars.ip_port = "-p" > vars.ip_ports = [ "U:" + udp ] > return > } > }} > command = [ PluginDir + "/check_openvpn" ] # would really love to echo $ip_protocol $ip_port etc right about here or even higher - *somehow* > arguments = { > "-h" = "$check_address$" > "-p" = "$vars.ip_protocol$" > "-z" = "$vars.ip.port$" > "-x" = "$vars.ip.ports$" > } > > } I'm starting to presume there's no way of properly checking this step by step. a command (within the CheckCommand) similar to echo in bash would help greatly(as illustrated). Ie i could echo the vars.ip_protocol etc right before building my arguments or right after i assign them values to see where/how it goes wrong. A valid command (allthough i admit it's ugly but i don't know how to make it otherwise) executed manually runs and returns valid results. ie: > ./check_openvpn -h google.com -p '-sS' -z '-p' -x 'T:80' # actually checking > for google.com on tcp port 80 but whatever > -h google.com -p -sS -z -p -x T:80 - ALL PARAMS # my "echo $@ - ALL COMMANDS" > line right at the beginning of my script > OPENVPN OK # the return value of my script. hardcoded to say OPENVPN OK but > you get the idea. also does an exit 0 and a closed port: > ./check_openvpn -h google.com -p '-sS' -z '-p' -x 'T:24' > > -h google.com -p -sS -z -p -x T:24 - ALL PARAMS > OPENVPN CRITICAL # also does exit 2
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ icinga-users mailing list icinga-users@lists.icinga.org https://lists.icinga.org/mailman/listinfo/icinga-users