Page 1 of 1

how to use check_mrtg for mod-gearman(private environment)

Posted: Fri Mar 15, 2019 5:53 am
by progressive.nagiosXI
Hi ,

we are using below plugin to monitor public network devices bandwidth.

1. check_mrtg

we are not able to add devices in monitoring which are in private environment using Nagiosxi wizard .As check_mrtg require *.rrd binary file to get data ,Please let us know how to create rrd file manually for devices which are in private environment(monitoring through mod-gearman).

Note:-currently we are using Mod-gearman worker to monitor devices in different private environment .

Code: Select all

[nagios@monitoring ~]$ /usr/local/nagios/libexec/check_rrdtraf -f /var/lib/mrtg/[b]*.*.*.*.rrd[/b] -w 50.00,50.00 -c 80.00,80.00 -l M
OK - Current BW in: 4.64Mbps Out: 1.63Mbps|in=4.644943Mb/s;50.00;80.00 out=1.638407Mb/s;50.00;80.00
Thanks,

Re: how to use check_mrtg for mod-gearman(private environme

Posted: Fri Mar 15, 2019 11:35 am
by cdienger
The wizard uses mrtg and the cfgmaker command to create a mrtg config and generate rrd files that the plugin can then read. You'd need to install and run these on the machine that has access to the private environment. See https://oss.oetiker.ch/mrtg/doc/cfgmaker.en.html and https://oss.oetiker.ch/mrtg/download.en.html for downloads and details on cfgmaker.

Re: how to use check_mrtg for mod-gearman(private environme

Posted: Fri Mar 15, 2019 11:49 am
by tgriep
One option is to use another plugin that does not need to gather the Bandwidth using the MRTG rrd files.

If you want to continue to use the RRD files, you will have to install and configure MRTG on each of the workers and create the MRTG config files for the devices on that network so the plugin can access the RRD files.

A quick way to install MRTG is to use the installer from the XI source installer.

Run this in the Nagios server to download and extract the files

Code: Select all

cd /tmp
rm -rf nagiosxi xi*.tar.gz
wget https://assets.nagios.com/downloads/nagiosxi/5/xi-5.5.11.tar.gz
tar xzf xi-5.5.11.tar.gz
Copy the /tmp/nagiosxi/subcomponents/mrtg folder and it's contents to the remote worker.
Go to the mrtg folder and run the install script.

You would have to install some prerequisite packages on the server before hand.

Code: Select all

Net-SNMP
perl-Net-SNMP
rrdtool
librrds-perl
Create a cron file called
/etc/cron.d/mrtg and put the following line in to to run the MRTG processes every 5 minutes.

Code: Select all

*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lib/mrtg/mrtg.lock --confcache-file /var/lib/mrtg/mrtg.ok
Save the file and restart cron.

Then you would have to manually run the cfgmaker to create the MRTG config files and them put them in the /etc/mrtg/conf.d folder.
See this for how to run the command.
https://oss.oetiker.ch/mrtg/doc/cfgmaker.en.html

That should setup the rrd files for the checks but since the Wizard was not used to create the commands in XI, you will have to create them manually.