Nagios (Mailq)

Hi All,

So recently we decided to move our Nagios to integrate with Librenms…

I’m busy setting up the Mailq but I’ve noticed that when I run

./check-services.php -h xx.xx.xx.xx -d -m services

I get the following

Request: ‘/usr/lib/nagios/plugins/check_mailq’ ‘-H’ ‘xx.xx.xx.xx’ ‘mailq’
Unknown option: H
Perf Data - None.
Response: Usage: check_mailq -w -c [-W ] [-C ] [-M ] [-t ] [-s] [-v]

I’m not sure how to go forward with this as its not pulling the Mailq

Thanks

This is related to: Service checks hardcode "-H" parameter - Still an issue

So what happens is that Libre hardcodes the -H parameter, which does not exist in all checks, and you will get errors.

What I’ve done to my checks is that I edited them and added -H as an option to the check that does nothing.

How Exactly did you do it?

It basically comes down to how the check is coded. Looking at check_mailq I see

sub process_arguments(){
    GetOptions
            ("V"   => \$opt_V, "version"    => \$opt_V,
             "v"   => \$opt_v, "verbose"    => \$opt_v,
             "h"   => \$opt_h, "help"               => \$opt_h,
             "M:s" => \$opt_M, "mailserver:s" => \$opt_M, # mailserver (default     sendmail)
             "w=i" => \$opt_w, "warning=i"  => \$opt_w,   # warning if above this number
             "c=i" => \$opt_c, "critical=i" => \$opt_c,       # critical if above this number
             "t=i" => \$opt_t, "timeout=i"  => \$opt_t,
             "s"   => \$opt_s, "sudo"       => \$opt_s
             );

so edit that and add code to accept “H” as an option

Well, saying that we should edit all checks is more work than just making the H parameter optional.
There are many custom checks out there which don’t use the H parameter and which don’t even need it.
So what do we have to do to get the optional H parameter implemented in Librenms. Surely this cannot be to hard.

I’m not really understanding the goal here. Can you all clarify a bit?

Generally speaking, if a Nagios check doesn’t have a -H option that means it was designed to be run locally on the server you’re checking and from there it’s meant to be called through some sort of remote execution protocol, like check_by_ssl, or check_mk or NRPE.

So when that’s the case all removing -H does is let you run your check locally on the LibreNMS server/poller. You still need another piece to be able to call that check on the remote server.

In the current implementation its a Ceph plugin that runs locally but could run on any server as long as the Ceph client configuration is present. The target server/mons are also configured in the Ceph configuration.

Librenms runs all checks from local host but against external servers if configured so.
I don’t know of any way to execute checks on remote servers with librenms via nagios itself.
Hints are welcome.

Thanks

@DerDanilo
So instead of complaining about it being more work editing checks, just submit a PR that makes -H mandatory. Problem solved.

I don’t know PHP and have no time to learn programming it. To many other things going on. :slight_smile:
It was mere a logical conclusion that one change instead of many continuous changes makes more sense especially when one solution is the only one out there doing it like this.