monitor bandwith through mod gearman

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
elinagios
Posts: 146
Joined: Thu Feb 16, 2017 3:45 am

monitor bandwith through mod gearman

Post by elinagios »

Hello

we have Nagiosxi server with mod gearman server and a mod gearman proxy for monitoring certain subnets (hosts are added to hostgroup that is defined in mod gearman proxy conf).
The problem is that all the network rules (and there are a loads of them) are made for the proxy, proxy can monitor the servers/switches and so on in these subnets, the master Nagios XI can not. Now this means Nagios configuration wizard for SNMP checks is out of the question because it will try to connect directly to the host and get time-out because of no network access. I need to monitor bandwidth on the servers, but i cannot use network switch/router wizard for it. Please give me idea how to check bandwidth on servers monitored through mod gearman proxy.

Thank you!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: monitor bandwith through mod gearman

Post by tgriep »

What you could do it to use a standalone plugin that doesn't require MRTG and RRD files.
Install that plugin on the Gearman Workers, create a command in XI and you will be able to monitor bandwidth on the remote devices through the Gearman workers.

Take a look at this standalone plugin and see if it will work for your needs. If not, search the Exchange site for another one.
https://exchange.nagios.org/directory/P ... 64/details
Be sure to check out our Knowledgebase for helpful articles and solutions!
elinagios
Posts: 146
Joined: Thu Feb 16, 2017 3:45 am

Re: monitor bandwith through mod gearman

Post by elinagios »

Tried this plugin from command line, seems to work, but with mod-gearman it doesnt. Im not sure why this is but after implementing mod gearman, we had to recode some of our checks to work and seems this is one of them that doesnt work. From command line, gives all info, if i look from Nagios XI webinterface OK (No output returned from plugin).
Do you know what is the reason that some checks from command line work, worked without mod-gearman but going through mod-gearman the status information gets lost.
Will try few other bandwidth checks too.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: monitor bandwith through mod gearman

Post by tgriep »

A couple of things to try to get this plugin to work remotely.
1. Disable embedded perl in the Gearman worker settings as well as the plugin itself.
2. Check the permissions of the plugin. That plugin may store temporary files to calculate the bandwidth and if the permissions are not right, it cannot save them and then the plugin will fail.

You can check the Gearman Worker's log file for and errors as well.
Be sure to check out our Knowledgebase for helpful articles and solutions!
elinagios
Posts: 146
Joined: Thu Feb 16, 2017 3:45 am

Re: monitor bandwith through mod gearman

Post by elinagios »

Hello

1) Can disable the perl in worker settings but not sure how to do that on the plugin?
2) Tried changning the owner and rights to the plugin, nothing changed.
kyang

Re: monitor bandwith through mod gearman

Post by kyang »

Were there any errors in the Gearman worker logs?
What permissions did you give the plugin?

To disable the embedded perl in the plugin add # nagios: -epn

Code: Select all

 To tell Nagios to NOT use the embedded Perl interpreter for a particular script, add this line to the Perl script:

# nagios: -epn

Line must be located within the first 10 lines of a script for Nagios to detect it. 
Here's the article on it as well.
https://assets.nagios.com/downloads/nag ... dperl.html

After that, try running the plugin remotely and check the worker logs.

Let us know.
elinagios
Posts: 146
Joined: Thu Feb 16, 2017 3:45 am

Re: monitor bandwith through mod gearman

Post by elinagios »

Disabled embedded perl in both mod gearman worker config and in the plugin, result is the same.
From command line, i get output, all is ok, but looking from Nagios XI side, i get correct status OK, but the status information gives: (No output returned from plugin). There is nothing in the mod gearman worker log.

The plugin is able to write the information data. Be default the plugin has root:root 751, changed to nagios:nagios 751, result is still the same.
Can you try this on your test environment and see if you get same result.
kyang

Re: monitor bandwith through mod gearman

Post by kyang »

Does running the output from the UI give back any output? How about locally?

Did you set a debugging option in the worker log?

Try that and show us the worker log.
elinagios
Posts: 146
Joined: Thu Feb 16, 2017 3:45 am

Re: monitor bandwith through mod gearman

Post by elinagios »

Cannot run from the Nagios XI core config manager because Nagios XI server doesnt have the network rules to access the server, the proxy has that, so running check from there is no use.
Configuration files are the default the come with the installation, nothing changed there. Changed debugging level to 3 but mod_gearman_worker.log is empty. I dont think the plugin generates error, because from command line it works, it gets the correct status, OK, but the status information gets lost when going through mod gearman, i have seen that with some other self coded checks also.
kyang

Re: monitor bandwith through mod gearman

Post by kyang »

Did you edit the plugin?

On the Nagios Exchange, someone did mention the plugin creates a directory where it will store the data files. (if the plugin doesn't find one, it will create one in /usr/local/nagios/libexec)
I tested this plugin and it did not work correctly out of the box on the command line because it did output nothing at all (but web ui said "OK"). Looking into the code the problem was on line 140 where it says
my $TRAFFIC_FILE = "/usr/local/nagios/libexec/traffic/";

This directory did not exist on my system; this caused the plugin to output nothing. After adding this directory, it worked. Maybe add a test if directory exists and throw an error if not?
I confirmed this, and changed line 140 of the plugin to where I store my perfdata.

Code: Select all

<From this>
my $TRAFFIC_FILE = "/usr/local/nagios/libexec/traffic/";

TO THIS:

# Path to  tmp files
my $TRAFFIC_FILE = "/usr/local/nagios/share/perfdata";
Once I did this and forced the check locally from my UI. Output came through.
Capture.PNG
Try the fix, and let me know if you receive anything from the worker.

Also, on your worker --> was there a directory being created called traffic? in /usr/local/nagios/libexec?
You do not have the required permissions to view the files attached to this post.
Locked