MRTG: Difference between revisions

From Edgar BV Wiki
Jump to navigation Jump to search
(New page: MRTG Configuration in /etc/mrtg First build a conf file which includes all the conf files you want mrtg to run. Each directive in this file will be used in all the sub-conf files. Each su...)
 
No edit summary
Line 1: Line 1:
MRTG Configuration
<nowiki>MRTG Configuration


in /etc/mrtg
in /etc/mrtg
Line 98: Line 98:
The only edit here is to change the spam-stats.pl on the spamassassin machine to reflect the spamd logfile (which is /var/log/mail/spamd.log on debian, instead of syslog)
The only edit here is to change the spam-stats.pl on the spamassassin machine to reflect the spamd logfile (which is /var/log/mail/spamd.log on debian, instead of syslog)


Also make sure that mrtguser has permissions to run the .pl file :)
Also make sure that mrtguser has permissions to run the .pl file :)</nowiki>

Revision as of 12:54, 2 March 2007

MRTG Configuration in /etc/mrtg First build a conf file which includes all the conf files you want mrtg to run. Each directive in this file will be used in all the sub-conf files. Each sub conf file will spawn a seperate mrtg process (if run as daemon) /etc/mrtg.conf ------------------------------------------------------------------------- ###################################################################### # Multi Router Traffic Grapher -- Sample Configuration File ###################################################################### # This file is for use with mrtg-2.5.4c # Global configuration # Put these into the templates #Htmldir: /space/sites/mrtg #Imagedir: /space/sites/mrtg/images #IconDir: /space/sites/mrtg/icons #Logdir: /var/log/mrtg #Forks: 4 #RunAsDaemon: Yes #Interval: 5 #WriteExpires: Yes #Options[_]: growright # Also add lines for each of the daemons to /etc/init.d/mrtg ###################################################################### # Included configuration files ###################################################################### Include: tripany.internal.cfg Include: euhost.cfg Include: USN.cfg ------------------------------------------------------------------------- Doing this allows you to place the resultant HTML files in different subdirectories, ie. allow different sets of statistics to be seen by different people. Then we set up the local files /etc/mrtg/euhost.cfg ------------------------------------------------------------------------- Htmldir: /space/sites/mrtg/euhost Imagedir: /space/sites/mrtg/euhost/images IconDir: /space/sites/mrtg/icons LogDir: /var/log/mrtg Forks: 4 RunAsDaemon: Yes Interval: 5 WriteExpires: Yes Options[_]: growright #------------------ EUHost Interfaces ------------------------ # Link to internet Target[euhost.tripany.com.eth0]: \eth0:euhostrw@euhost.tripany.com: #-#Total[euhost.tripany.com.eth0]: Total traffic for internet link on EUHost SetEnv[euhost.tripany.com.eth0]: MRTG_INT_IP="212.61.33.42" MRTG_INT_DESCR="eth0" MaxBytes[euhost.tripany.com.eth0]: 12500000 Title[euhost.tripany.com.eth0]: Traffic Analysis for internet link on EUHost PageTop[euhost.tripany.com.eth0]: <H1>Traffic Analysis for internet link on EUHost</H1> WithPeak[euhost.tripany.com.eth0]: wmy PageFoot[euhost.tripany.com.eth0]: <H1><a href="euhost.tripany.com.eth0.total.2006.html">Total Traffic Stats for 2006</a></H1> ---------------------------------------------------------------------------- The traffic data is polled using SNMP, so in the Target is the ethernet card you are polling and the community name. The PageFoot and #-#Total lines are links to an external totaliser which I'll explain later. Then we set up the index page which shows the current traffic information for all the interfaces in the local configuration files. This is done by running the indexmaker utility, so this has to be run every time a change is made (eg. by adding new interfaces). The command to create the index file for all the configurations onto one page is: ----------------------------------------------------------------------------------- indexmaker --output=/space/sites/mrtg/index.html --addhead="Tripany Bandwidth Monitoring" --title="Tripany MRTG" /etc/mrtg/euhost.cfg /etc/mrtg/tripany.internal.cfg /etc/mrtg/USN.cfg --autoprefix ----------------------------------------------------------------------------------- To do this for just one of the specific configurations is ----------------------------------------------------------------------------------- indexmaker --output=/space/sites/mrtg/euhost/index.html --addhead="Tripany Bandwidth Monitoring for EUHost" --title="EUHost MRTG" /etc/mrtg/euhost.cfg ----------------------------------------------------------------------------------- To create the totaliser pages, you need mrtg_total.pl from http://www.geocities.com/josef_wendel/mrtg_total.html Then add a crontab entry for each conf file you have #-#Total tags in 5 1 * * * root /usr/local/bin/mrtg_total.pl /etc/mrtg/euhost.cfg This will generate the pages linked to in the page footer. ---------------------------------------------------------------- To monitor Spam statistics: http://users.2z.net/rpuhek/scripts_public/spamd/ The only edit here is to change the spam-stats.pl on the spamassassin machine to reflect the spamd logfile (which is /var/log/mail/spamd.log on debian, instead of syslog) Also make sure that mrtguser has permissions to run the .pl file :)