Page 1 of 2
Monitoring Network ports via a Mod-Gearman worker
Posted: Wed Mar 16, 2016 10:27 pm
by Fred Kroeger
I have a Mod-Gearman worker sitting behind a firewall to monitor devices located behind that firewall.
All works OK except when I configure Port monitoring for Network Devices. This does work in that perfdata is returned via the worker to the Nagios server.
However, the bandwidth info is stored instead on the worker because that is what the check_xi_service_mrtgtraf command does. This of course means that the Nagios Bandwidth Usage report doesn't work as it can't find the data in /var/lib/mrtg on the Nagios server. Apart from regularly exporting the contents of /var/lib/mrtg from the worker to the server is there anything I can do?
I don't think exporting is the answer either as it is entirely possible that I could get a clash of IP's - the IP's accessed by the worker could also be used locally by the Nagios server or another worker at a different site.
regards.... Fred
Re: Monitoring Network ports via a Mod-Gearman worker
Posted: Thu Mar 17, 2016 7:56 am
by eloyd
I can offer no help here, but I can say that I am interested in this topic, so I'm replying so I'll be notified of updates.

Re: Monitoring Network ports via a Mod-Gearman worker
Posted: Thu Mar 17, 2016 11:20 am
by tmcdonald
That's a tricky one, and a problem fairly unique to mod_gearman setups. I came to the same conclusion, you'll need to find some way to sync these files between your remote workers and the XI machine. rsync on a cron is a pretty low-hassle method for starters, unfortunately we don't have an official recommendation.
Re: Monitoring Network ports via a Mod-Gearman worker
Posted: Thu Mar 17, 2016 11:36 am
by eloyd
I KNEW that's what you were going to say. We're rsyncing now, but don't have to worry about IP space collision. Was hoping for better news.
Re: Monitoring Network ports via a Mod-Gearman worker
Posted: Thu Mar 17, 2016 4:21 pm
by tmcdonald
eloyd wrote:I KNEW that's what you were going to say.
I guess you could say our thoughts were... synced :)
I can definitely leave this open for discussion, but this is one of the drawbacks of using mod_gearman and unless they add in the ability to ship this sort of info back, I can't think of an easy solution.
Re: Monitoring Network ports via a Mod-Gearman worker
Posted: Thu Mar 17, 2016 5:52 pm
by Fred Kroeger
Thanks. IP Address duplication is going to be my problem. The only solution for me is to create a directory under /var/lib/mrtg for each client and rsync the files there. But then Nagios will need to know to look in these sub directories to produce the bandwidth Utilisation reports
Re: Monitoring Network ports via a Mod-Gearman worker
Posted: Thu Mar 17, 2016 6:14 pm
by Box293
Fred Kroeger wrote:Apart from regularly exporting the contents of /var/lib/mrtg from the worker to the server is there anything I can do?
I don't think exporting is the answer either as it is entirely possible that I could get a clash of IP's - the IP's accessed by the worker could also be used locally by the Nagios server or another worker at a different site.
So the files in
/var/lib/mrtg are named based on each
Target[name_interger] in
/etc/mrtg/conf.d/xxx.cfg.
/etc/mrtg/conf.d/firewall1.box293.local.cfg
Code: Select all
### Interface 1 >> Descr: 'em0' | Name: 'em0' | Ip: 'xxx.xxx.x.xxx' | Eth: '00-11-22-33-44-55' ###
Target[firewall1.box293.local_1]: 1:[email protected]:::::2
Code: Select all
ls -al /var/lib/mrtg/firewall1.box293.local_1.rrd
-rw-r--r-- 1 root root 105312 Mar 18 10:05 /var/lib/mrtg/firewall1.box293.local_1.rrd
/usr/local/nagios/etc/services/firewall1.cfg
Code: Select all
define service {
host_name firewall1
service_description em0 - WAN Bandwidth
use xiwizard_switch_port_bandwidth_service
check_command check_xi_service_mrtgtraf!firewall1.box293.local_1.rrd!500,500!800,800!M
So you can avoid a clash of IP's by using the FQDN of the objects being monitoring when running the switch / router wizard.
With all of this in mind, /var/lib/mrtg/ can be an NFS share that is mounted on XI and all the workers, or done via rsync like you are now.
Re: Monitoring Network ports via a Mod-Gearman worker
Posted: Fri Mar 18, 2016 7:29 am
by eloyd
For the customer of ours where this applies, they are putting mod_gearman boxes in different customer sites, all separate and unique with no way to ensure lack of overlap on IPs and very few FQDNs in use (mainly for switching fabric devices). So we'll be rsyncing until it breaks, I guess, or do something else.
I'm thinking we might just put Nagios Core boxes in each site instead of mod_gearman, and then report back to a centralized Nagios XI server for reporting, but install Fusion for them to be able to query all the Core boxes as well. Plus, we get to sell them some more licenses that way.

Re: Monitoring Network ports via a Mod-Gearman worker
Posted: Fri Mar 18, 2016 1:48 pm
by rkennedy
@Fred - let us know if you have any further questions.
Re: Monitoring Network ports via a Mod-Gearman worker
Posted: Fri Mar 18, 2016 1:55 pm
by eloyd
Okay, for what it's worth, I'm done with this topic. If OP wants to close it, don't let me stop you.