Page 1 of 2
How to configure MRTG to pull interval to 1 minute
Posted: Fri Jun 12, 2015 2:27 pm
by Jessuzz94
I have Nagios and MRTG, the mrtg index looks fine but i want to monitor my interfaces of one switch in one interval to 1 minute, not 5, how can i do it?
Re: How to configure MRTG to pull interval to 1 minute
Posted: Mon Jun 15, 2015 12:02 am
by Box293
MRTG is run as a CRON job (in /etc/cron.d/mrtg) and looks something like this:
Code: Select all
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
You would need to:
Create a new folder /etc/mrtg/conf.special
Move the specific switch.cfg Config file into that folder (currently located in /etc/mrtg/conf.d/)
Create a copy of the existing /etc/mrtg/mrtg.cfg file (/etc/mrtg/mrtg_special.cfg)
Edit /etc/mrtg/mrtg_special.cfg to point to the /etc/mrtg/conf.special folder
Add an additional cron jon that runs this special file every minute
Code: Select all
*/1 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg_special.cfg --lock-file /var/lock/mrtg/mrtg_special_l --confcache-file /var/lib/mrtg/mrtg_special.ok
Fingers crossed that should all work.
Re: How to configure MRTG to pull interval to 1 minute
Posted: Mon Jun 15, 2015 11:59 am
by Jessuzz94
It worked with someone?
Re: How to configure MRTG to pull interval to 1 minute
Posted: Mon Jun 15, 2015 12:43 pm
by ssax
Yes, worked for me:
Code: Select all
mkdir /etc/mrtg/conf.special
chown apache.nagios /etc/mrtg/conf.special
mv /etc/mrtg/conf.d/YOURSWITCH.cfg /etc/mrtg/conf.special/
cp /etc/mrtg/mrtg.cfg /etc/mrtg/mrtg_special.cfg
chown apache.nagios mrtg_special.cfg
Edit /etc/mrtg/mrtg_special.cfg and at the bottom change conf.d/*.cfg to conf.special/*.cfg
Added the additional cron job (from Box293's post) that runs this special file every minute.
Re: How to configure MRTG to pull interval to 1 minute
Posted: Mon Jun 15, 2015 12:54 pm
by Jessuzz94
I have a etc/mrtg/mrtg.cfg , mrtg.cfg is the conf file of my switch right?, because i have monitoring just one
Re: How to configure MRTG to pull interval to 1 minute
Posted: Mon Jun 15, 2015 1:11 pm
by Jessuzz94
When i created the cfgmaker i put this command
Code: Select all
cfgmaker --global 'WorkDir:/var/www/mrtg' --global 'Options[_]: bits,growright' --output /etc/mrtg/mrtg.cfg public@<yourrouterip>
so, wheres the cfg file of my switch?
Re: How to configure MRTG to pull interval to 1 minute
Posted: Mon Jun 15, 2015 2:48 pm
by ssax
It should be in your /etc/mrtg/conf.d directory.
Re: How to configure MRTG to pull interval to 1 minute
Posted: Mon Jun 15, 2015 2:49 pm
by Jessuzz94
I dont have conf.d directory in /etc/mrtg, :C
Re: How to configure MRTG to pull interval to 1 minute
Posted: Mon Jun 15, 2015 2:59 pm
by abrist
Create the directory and then add the include to mrtg.conf:
Code: Select all
mkdir /etc/mrtg/conf.d/
chown apache:nagios /etc/mrtg/conf.d
echo "Include: conf.d/*.cfg" >> /etc/mrtg/mrtg.cfg
The next time mrtg runs, it will parse the files in conf.d.
Re: How to configure MRTG to pull interval to 1 minute
Posted: Mon Jun 15, 2015 3:19 pm
by Jessuzz94
And after that, start again with the beginning of the post?