[mrtg] 1 minute polling interval

Matt Mummert mjmummert at gmail.com
Wed Sep 14 03:23:40 CEST 2011


Steve,

Thank you for your reply.  I followed your steps and am successfully running
1 minute intervals, with only 1 switch though.  I am having issues with
adding additional switches with the rrd configuration.  Can someone please
check my setup steps and let me know what I am missing or needs changed to
setup 2 switches to work with the rrd tool?  I believe something needs
changed with the 14all.cgi or mrtg-conf.cgi but not exactly sure.

1. Install MRTG and pre-requirements.
-----------------------------------------------------
apt-get install apache2
apt-get install snmpd snmp
apt-get install mrtg

When installing mrtg choose "No" to read only prompt.


2. Create the /etc/mrtg directory
---------------------------------
 mkdir /etc/mrtg

3. Create working directories
----------------------------------------
mkdir /var/www/mrtg
mkdir /var/www/mrtg/switches
mkdir /var/www/mrtg/switches/switch5

4. Create Config file and Index files
----------------------------------------
/usr/bin/cfgmaker --output=/etc/mrtg/switch5.mrtg --global 'workdir:
/var/www/mrtg/switches/switch5' --global 'options[_]: growright,bits'
switch at 192.168.1.1

/usr/bin/indexmaker --output=/var/www/mrtg/switches/switch5/index.html
/etc/mrtg/switch5.mrtg

LANG=C /usr/bin/mrtg /etc/mrtg/switch5.mrtg three times

5. Create script
--------------------------------------
echo 'LANG=C /usr/bin/mrtg /etc/mrtg/switch5.mrtg' >/etc/mrtg/switch5mrtg

chmod +x /etc/mrtg/switch5mrtg

6. Add script to Cron job
------------------------------------
crontab -e

0-59/5 * * * * /etc/mrtg/switch5mrtg

7. Install RRD Tools
--------------------------------------------
--------------------------------------------
apt-get install rrdtool librrdp-perl librrds-perl

8. Change switch5 configuration
--------------------------------------------
--------------------------------------------
nano /etc/mrtg/switch5.mrtg

Look for the following near the top of the file:

    #  for Debian
    (change to) WorkDir: /var/www/mrtg/switches/switch5

Add a line just below the "WorkDir" line that reads:

    LogFormat: rrdtool

Exit and save the file.


9. Force quick, initial creation of the rrd files in /var/www/mrtg:
--------------------------------------------
--------------------------------------------
    /etc/mrtg/switch5mrtg

10. Look at /var/www/mrtg and notice that there are now files named *.rrd:
--------------------------------------------
--------------------------------------------
   ls /etc/mrtg/switches/switch5


11. Install mrtg-rrd
-------------------

     apt-get install mrtg-rrd
     cd /usr/lib/cgi-bin
     ln -s mrtg-rrd.cgi 14all.cgi

12. Run indexmaker again
------------------------

/usr/bin/indexmaker --output=/var/www/mrtg/switches/switch5/index.html
/etc/mrtg/switch5.mrtg

13. Create /etc/mrtg-rrd.conf
----------------------------

    # echo '/etc/mrtg/switch5.mrtg' >/etc/mrtg-rrd.conf


14. Make /var/www/mrtg writeable for the Web server
---------------------------------------------------

 chown www-data /var/www/mrtg

and

chown www-data /var/www/mrtg/switches/switch5

15. Remove the old PNG files for the MRTG graphs
-----------------------------------------------

rm /var/www/mrtg/switches/switch5/192.*.png


16. Change contab -e for 1 minute polling
-----------------------------------------------

0-59/1 * * * * /etc/mrtg/switch5mrtg

17. Change switch5 config
-----------------------------------------------
nano /etc/mrtg/switch5.mrtg

add Interval:1

18. Remove old RRD files
-----------------------------------------------
cd /var/www/mrtg/switches/switch5

rm 192.*.rrd

19. Run script again to create RRD files:
-----------------------------------------------
/etc/mrtg/switch5mrtg

*TO ADD ADDITIONAL SWITCH:*
------------------------------------------------

1. Create working directory
------------------------------------------------

mkdir /var/www/mrtg/switches/switch6

2. Create Config file and Index files
----------------------------------------
/usr/bin/cfgmaker --output=/etc/mrtg/switch6.mrtg --global 'workdir:
/var/www/mrtg/switches/switch6' --global 'options[_]: growright,bits'
switch at 192.168.2.1

/usr/bin/indexmaker --output=/var/www/mrtg/switches/switch6/index.html
/etc/mrtg/switch6.mrtg

LANG=C /usr/bin/mrtg /etc/mrtg/switch6.mrtg three times

3. Create script
--------------------------------------
echo 'LANG=C /usr/bin/mrtg /etc/mrtg/switch6.mrtg' >/etc/mrtg/switch6mrtg

chmod +x /etc/mrtg/switch6mrtg

4. Add script to Cron job
------------------------------------
crontab -e

0-59/1 * * * * /etc/mrtg/switch6mrtg


5. Change switch5 configuration
----------------------------------------------------------------------------------------
nano /etc/mrtg/switch6.mrtg

Look for the following near the top of the file:

    #  for Debian
    (change to) WorkDir: /var/www/mrtg/switches/switch6

Add a line just below the "WorkDir" line that reads:

    LogFormat: rrdtool

Exit and save the file.


6. Force quick, initial creation of the rrd files in /var/www/mrtg:
----------------------------------------------------------------------------------------
    /etc/mrtg/switch6mrtg

7. Look at /var/www/mrtg and notice that there are now files named *.rrd:
----------------------------------------------------------------------------------------
   ls /etc/mrtg/switches/switch6


8. Run indexmaker again
------------------------

/usr/bin/indexmaker --output=/var/www/mrtg/switches/switch6/index.html
/etc/mrtg/switch6.mrtg

9. Edit /etc/mrtg-rrd.conf
----------------------------

  nano /etc/mrtg-rrd.conf
  add /etc/mrtg/switch6.mrtg


10. Make /var/www/mrtg writeable for the Web server
---------------------------------------------------

chown www-data /var/www/mrtg/switches/switch6

11. Remove the old PNG files for the MRTG graphs
-----------------------------------------------

rm /var/www/mrtg/switches/switch6/192.*.png


12. Change contab -e for 1 minute polling
-----------------------------------------------

0-59/1 * * * * /etc/mrtg/switch6mrtg

13. Change switch5 config
-----------------------------------------------
nano /etc/mrtg/switch6.mrtg

add Interval:1

14. Remove old RRD files
-----------------------------------------------
cd /var/www/mrtg/switches/switch6

rm 192.*.rrd

15. Run script again to create RRD files:
-----------------------------------------------
/etc/mrtg/switch6mrtg


Is there something that I am missing to allow more than one switch with RRD
and MRTG?  What else do I need to configure, if I missed something?  What
needs changed with the 14all.cgi or mrtg-rrd.cgi scripts?

Thanks in advance.

On Sat, Sep 10, 2011 at 12:32 AM, Steve Shipway <s.shipway at auckland.ac.nz>wrote:

>  To use 1-min polling, you need to:
> 1. have the cron job every 1 min, or else use daemon mode
> 2. have Interval:1 in the cfg files
> 3. re-create your .rrd or .log files, if you are changing from a 5min
> configuration
>
> If it is not working, then can you be more precise about what is not
> working?  Give some example graph images and so on...
>
> Steve
>
>  *Steve Shipway*
> University of Auckland ITS
> *UNIX Systems Design Lead*
> s.shipway at auckland.ac.nz
> Ph: +64 9 373 7599 ext 86487
> **
>   ------------------------------
> *From:* mrtg-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch[mrtg-bounces+s.shipway=
> auckland.ac.nz at lists.oetiker.ch] on behalf of Matt Mummert [
> mjmummert at gmail.com]
> *Sent:* Saturday, 10 September 2011 1:57 p.m.
> *To:* mrtg at lists.oetiker.ch
> *Subject:* [mrtg] 1 minute polling interval
>
>  I have been trying to change the polling interval to one minute and not
> having any luck with the latest version of MRTG.  I changed the chron
> interval and also tried to follow the 1Min MRTG patch steps with absolutely
> no luck:  http://www.loplop.net/projects/1minMRTG/.  Is there any
> documentation that is easy to follow to setup 1 minute polling?  I was able
> to setup the RRDTool with my MRTG installation in Debian along with changing
> the chron interval, but have had absolutely no luck past this point.  Any
> help will be appreciated.
>
> Thanks!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20110913/8ea09fab/attachment-0001.htm 


More information about the mrtg mailing list