Hi there,
I’d like to propose, that “Remote Host” within services gets a check, so that the host argument (-H) is only passed if specified. I am proposing this, because some nagios checks do not support this feature. My example would be check_dhcp.
Here are notes about other checks, that fail if -H is passed.
My logic would be:
Check if Remote Host contains a value
if true: add -H remote.host
if false: do not add -H blank
Thank you for your consideration. I would happily help to implement this - I am just a little lost on where to look first.
Cheers, Lucas
Edit: Am I right, that the construction is done here - because that would make empty = don’t use -H
a little more involved than expected. Perhaps we could use false
instead?
Okay, from a short test the following could work:
Define a custom value, that represents disabled host value, for example no_host_flag
Replace
if ($check_cmd == '') {
$check_cmd = Config::get('nagios_plugins') . '/check_' . $service['service_type'] . ' -H ' . ($service['service_ip'] ?: $service['hostname']);
$check_cmd .= ' ' . $service['service_param'];
}
with
if ($check_cmd == '') {
$check_cmd = Config::get('nagios_plugins') . '/check_' . $service['service_type'];
if ($service['service_ip'] !== 'no_host_flag') {
$check_cmd .= ' -H ' . ($service['service_ip'] ?: $service['hostname']);
}
$check_cmd .= ' ' . $service['service_param'];
}
Ideas on this? Granted, I would not describe this as elegant… but no value at all is already used as condition to fall back to the configured hostname.
In my opinion, the problem here is that the services screen has the Device drop down. If you don’t require remote host and you select SERVER1 from the Device drop down and dhcp as Check Type, you’re giving the impression that check_dhcp is running on SERVER1. But that’s not the case, the check always runs on the LibreNMS poller, it’s just the graphs that appear on SERVER1’s device page.
Well there are some services that are running on servers, as would dhcp. Others would probably also make sense without being coupled to a specific device.
From my perspective this doesn’t change a whole lot about the underlying issue. Services should be runnable without the -H
as that’s quite regularly the case.