This problem still exists with custom Nagios Plugins.
opened 03:45PM - 21 Dec 16 UTC
closed 02:44AM - 22 Dec 16 UTC
- [x] Is your install up to date? [Updating your install](http://docs.librenms.oā¦ rg/General/Updating/)
Please do not submit an issue if your install is not up to date within the last 24 hours or on a stable monthly release.
- [x] Please include all of the information between the `====================================` section of `./validate.php`.
- [x] Please provide as much detail as possible.
Component | Version
--------- | -------
LibreNMS | 4e436f8a8bc16dc3f452737ba95f9bf015c87272
DB Schema | 153
PHP | 5.6.29-1~dotdeb+7.1
MySQL | 5.5.53-0+deb7u1
RRDTool | 1.4.7
SNMP | NET-SNMP 5.4.3
When creating a new service check (via nagios plugins) there is a field labeled "IP Address". Even when left blank, this field always corresponds to an "-H" parameter being added to the assembled check command (with the current devices hostname/IP as default). This works for almost all plugins, but some e.g. "check_procs" don't take an "-H" param.
```
# cd /opt/librenms/
# ./check-services.php -d
---snip---
Nagios Service - 21
Request: /usr/local/nagios/libexec/check_procs -H librenms.tld -m PROCS -C myprocess -a myparam -c "1:"
/usr/local/nagios/libexec/check_procs: invalid option -- 'H'
Perf Data - None.
Response: Usage:
check_procs -w <range> -c <range> [-m metric] [-s state] [-p ppid]
[-u user] [-r rss] [-z vsz] [-P %cpu] [-a argument-array]
[-C command] [-k] [-t timeout] [-v]
---snip---
```
If I run the command directly on the CLI and leave out the "-H" param, everything works fine.
A solution to somehow leave out the addition of this parameter to the assembled check command (maybe when it is empty, or by selecting a checkbox to exclude it) would be very welcomed. Otherwise only service checks that understand this hardcoded parameter can be used with LibreNMS.
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.
See:
librenms:master
ā florianbeer:patch-2
opened 05:27PM - 21 Dec 16 UTC
Fixes #5211
----
- [x] signed the [Contributors agreement](http://docs.libreā¦ nms.org/General/Contributing/)
- [x] followed the [code guidelines](http://docs.librenms.org/Developing/Code-Guidelines/)
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