Open Napsty opened 1 month ago
Interesting, I'll have a look at it
Had a quick look.
First, yeah we should do something about that ugly error. I'll try to have a cleaner solution.
Second,
-q service1.status,True service2.status,True
and -q "service1.status,True service2.status,True"
are not the same semantically. -q service1.status,True service2.status,True
means two values for the -q
flag, -q "service1.status,True service2.status,True"
means one value for the -q
flag.
Similar with other CLI tools:
touch foo bar
touch "foo bar foo"
ls -l
total 0
bar
foo
'foo bar foo'
I'm sure you can tell your monitoring tool to pass multiple string values to flag, like so:
-q "service1.status,True" "service2.status,True" "service3.status,True"
I'm sure you can tell your monitoring tool to pass multiple string values to flag, like so
will have to look into this, but I don't think the current CheckCommand definition covers this.
Not an CheckCommand expert myself, but maybe like this? [ "exclude=sppsvc", "exclude=ShellHWDetection" ]
Copied from here: https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#command-arguments
I'm aware of the array handling of arguments in Icinga2, but, AFAIK, this requires the repeat_key
parameter set to true, which is not the case in the current CheckCommand (that's what I meant with my previous comment).
Asked around... someone suggested:
arguments += {
"(no key)" = {
order = 21
skip_key = true
value = "$sth_2$"
}
"(no key.2)" = {
order = 22
skip_key = true
value = "$sth_3$"
}
"-q" = {
order = 20
value = "$sth_1$"
}
}
The plugin works when multiple keys and their equals lookup values are passed as stdin:
The plugin seems to parse each input argument. Which is fine.
But if the keys are defined in a string and given to the plugin, it will fail:
Why is this important? Because it breaks the plugin under Icinga2 (and maybe on different monitoring core software, too), as the input/variable
vars.http_json_key_equals
is handed over to the plugin as string (see https://github.com/drewkerrigan/nagios-http-json/blob/master/contrib/icinga2_check_command_definition.conf#L81).