Hello, I needed to make my own CheckCommand definition and also a custom bash script in my PluginDir to check for openvpn availability. I'm using a bash script that calls nmap and does some logic then prints some output and exits with code 0 on success and 2 on error. But it's not working as i'd like it to.
my CheckCommand looks like this
>
> object CheckCommand "check-openvpn" {
> import "plugin-check-command"
> import "ipv4-or-ipv6"
>
> vars.ip_protocol = {{
> var tcp = macro("$openvpn_tcp_port$")
> var udp = macro("$openvpn_udp_port$")
>
> if (tcp) {
> vars.ip_protocol = "-sS -nn -p T:" + tcp
> return
> } else {
> vars.ip_protocol = "-sU -nn -p U:" + udp
> return
> }
> }}
> command = [ PluginDir + "/check_openvpn" ]
> arguments = {
> "-h" = "$check_address$"
> "-p" = "$ip_protocol$"
> }
>
> }
my host looks like this :
> object Host "my-host-addr" {
> import "blank-host" # this is a custom template made by me also
> address = "ip.address.of.host"
> vars.ssh_port = "ssh.port.of.host"
> vars.openvpn_udp_port = "openvpn.port.of.host" # custom var to be
> checked in the CheckCommand
> vars.server_type = "vpnservers" # custom var for hostgroup grouping
> }
the problem is the -p parameter seems to be null - the $ip_protocol$ :
here is the debug info
> [2015-06-27 21:53:18 +0300] warning/PluginCheckTask: Check command for object
> 'my-host-addr!openvpn' (PID: 15256, arguments:
> '/usr/lib/nagios/plugins/check_openvpn' '-h' 'ip.address.of.host') terminated
> with exit code 4, output: -h ip.address.of.host
> Usage: /usr/lib/nagios/plugins/check_openvpn -h <host> -p <parameters>
So i'd like to manually run that checkcommand somehow, to figure out
where i went wrong, to see what values the vars have, etc, as i'd do
with bash for instance bash -x script.sh
I'm really in the dark with this one, any help appreciated. Thank you :)
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ icinga-users mailing list [email protected] https://lists.icinga.org/mailman/listinfo/icinga-users
