Service checks hardcode "-H" parameter - Still an issue

This problem still exists with custom Nagios Plugins.

Currently using the following project which works just fine on CLI but fails via LibreNMS check.

Example error output:

$ /opt/librenms/check-services.php
Starting service polling run:

usage: check_ceph_health [-h] [-e EXE] [--cluster CLUSTER] [-c CONF]
                         [-m MONADDRESS] [-i ID] [-n NAME] [-k KEYRING]
                         [-w WHITELIST] [-d] [-V]
check_ceph_health: error: unrecognized arguments: -H localhost
usage: check_ceph_mon [-h] [-e EXE] [-c CONF] [-m MONADDRESS] [-i ID]
                      [-k KEYRING] [-V] [-I MONID]
check_ceph_mon: error: unrecognized arguments: -H localhost

It would be awesome if one could just check to ignore the hostname parameter or if it could be removed entirely.

Also I couldn’t find any documentation on how to add service checks via CLI, which would allow automated setup of checks via some automation toolset. Any hints?

Thanks in advance!

It looks like the PR attached to that issue was to create a fix for check_procs specifically, not change the host field behavior for all services.


You could try creating a similar file check_ceph_health and submit another PR for it.

I would look into the API for adding services with automation tools.

What I’ve done for these is to use a wrapper script, which drops the first argument and then calls the real check without it.

This may work but is not a solution.

Why would one hardcode any paramater if its not implemented with every check?
I mean its not like this behaviour is unexpected. There are many checks out there which don’t have thia parameter.

It’s open-source. If it bothers you that much, I’m sure your contribution would be welcome.

1 Like

Most of the actual remote checks will have a -H option. Most of the checks that don’t have a -H option only run locally like the mailq check from the other thread. So this ceph check looks like a bit of an outlier when you’re willing to add your LibreNMS server as a client to the cluster. I personally would probably just use check_by_ssh or something.

Being that it’s an outlier, I don’t think it’s unreasonable to add a service override for it like florianbeer did the PR I linked above.

1 Like