Page 1 of 2
monitor bandwith through mod gearman
Posted: Fri Nov 17, 2017 3:21 am
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!
Re: monitor bandwith through mod gearman
Posted: Fri Nov 17, 2017 11:20 am
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
Re: monitor bandwith through mod gearman
Posted: Mon Nov 20, 2017 3:57 am
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.
Re: monitor bandwith through mod gearman
Posted: Mon Nov 20, 2017 1:39 pm
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.
Re: monitor bandwith through mod gearman
Posted: Tue Nov 28, 2017 2:07 am
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.
Re: monitor bandwith through mod gearman
Posted: Tue Nov 28, 2017 11:55 am
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.
Re: monitor bandwith through mod gearman
Posted: Thu Nov 30, 2017 7:49 am
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.
Re: monitor bandwith through mod gearman
Posted: Thu Nov 30, 2017 1:01 pm
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.
Re: monitor bandwith through mod gearman
Posted: Fri Dec 01, 2017 8:41 am
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.
Re: monitor bandwith through mod gearman
Posted: Fri Dec 01, 2017 12:11 pm
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?