How to configure MRTG to pull interval to 1 minute

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

How to configure MRTG to pull interval to 1 minute

Post 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?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: How to configure MRTG to pull interval to 1 minute

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure MRTG to pull interval to 1 minute

Post by Jessuzz94 »

It worked with someone?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: How to configure MRTG to pull interval to 1 minute

Post 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.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure MRTG to pull interval to 1 minute

Post 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
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure MRTG to pull interval to 1 minute

Post 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?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: How to configure MRTG to pull interval to 1 minute

Post by ssax »

It should be in your /etc/mrtg/conf.d directory.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure MRTG to pull interval to 1 minute

Post by Jessuzz94 »

I dont have conf.d directory in /etc/mrtg, :C
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: How to configure MRTG to pull interval to 1 minute

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure MRTG to pull interval to 1 minute

Post by Jessuzz94 »

And after that, start again with the beginning of the post?
Locked