Linux Home Server HOWTO
Previous
Home Next

Chapter 22 - Multi Router Traffic Grapher

!!! WARNING - THIS CHAPTER IS IN DRAFT - WARNING !!!

Versions: - mrtg 2.13.2
- webalizer 2.01_10-29

Initial Concepts
Basic Configuration

M


Initial Concepts


[bash]# cp /etc/mrtg/mrtg.cfg /etc/mrtg/mrtg.cfg.original

Note !!

Basic Configuration



[bash]# vi /etc/mrtg/mrtg.cfg
######################################################################
# Multi Router Traffic Grapher
#
# Host: galaxy.example.com
# Descr: Linux Home Server
# Dated: 10 June 2006
# Contact: Miles Brennan ([email protected])
# Location: brisbane.qld.au
######################################################################

HtmlDir: /var/www/mrtg
ImageDir: /var/www/mrtg
LogDir: /var/lib/mrtg
ThreshDir: /var/lib/mrtg

Options[_]: growright, bits
WithPeak[_]: ymw
XSize[_]: 500
YSize[_]: 135

Refresh: 300
#Interval: 5

######################################################################

Target[ppp0]: 4:myHomeServer@localhost
SetEnv[ppp0]: MRTG_INT_IP="???.???.???.???" MRTG_INT_DESCR="ppp0"
MaxBytes[ppp0]: 3072000
PNGTitle[ppp0]: Traffic Analysis - ppp0 (External ADSL - EXETEL)
LegendI[ppp0]: &nbsp;&nbsp;<B>IN:</B>&nbsp;
LegendO[ppp0]: &nbsp;&nbsp;<B>OUT:</B>&nbsp;
BodyTag[ppp0]: <BODY vlink=blue alink=blue><CENTER>
PageFoot[ppp0]: </CENTER>
Title[ppp0]: Traffic Analysis - ppp0 (External ADSL - EXETEL)
PageTop[ppp0]: <A href="/mrtg"><H2>Traffic Analysis - ppp0 (External ADSL2+ Connection)</H2></A>
<TABLE WIDTH="450" ALIGN="CENTER">
<TR><TD WIDTH="200">System:</TD> <TD>RedHat - Fedora Core 5 (Linux)</TD></TR>
<TR><TD>Maintainer:</TD> <TD>Miles Brennan</TD></TR>
<TR><TD>Description:</TD> <TD>Externel ADSL2+ Connection</TD></TR>
<TR><TD>Interface Name:</TD> <TD>ppp0</TD></TR>
<TR><TD>Max Speed:</TD> <TD>24576 kBytes/s</TD></TR>
<TR><TD>IP Address:</TD> <TD>???.???.???.???</TD></TR>
</TABLE>

Target[eth1]: 3:myHomeServer@localhost
SetEnv[eth1]: MRTG_INT_IP="192.168.1.1" MRTG_INT_DESCR="eth1"
MaxBytes[eth1]: 1250000
PNGTitle[eth1]: Traffic Analysis - eth1 (Internal LAN - Wired)
LegendI[eth1]: &nbsp;&nbsp;<B>IN:</B>&nbsp;
LegendO[eth1]: &nbsp;&nbsp;<B>OUT:</B>&nbsp;
BodyTag[eth1]: <BODY vlink=blue alink=blue><CENTER>
PageFoot[eth1]: </CENTER>
Title[eth1]: Traffic Analysis - eth1 (Internal LAN - Wired)
PageTop[eth1]: <A href="/mrtg"><H2>Traffic Analysis - eth1 (Internal LAN)</H2></A>
<TABLE WIDTH="450" ALIGN="CENTER">
<TR><TD WIDTH="200">System:</TD> <TD>RedHat - Fedora Core 5 (Linux)</TD></TR>
<TR><TD>Maintainer:</TD> <TD>Miles Brennan</TD></TR>
<TR><TD>Description:</TD> <TD>Internal Network Device 1</TD></TR>
<TR><TD>Interface Name:</TD> <TD>eth1</TD></TR>
<TR><TD>Max Speed:</TD> <TD>10/100 MBs (auto)</TD></TR>
<TR><TD>IP Subnet:</TD> <TD>192.168.1.1/24</TD></TR>
</TABLE>


[bash]# vi /var/www/mrtg/index.html
<HTML>
<HEAD>
<TITLE>Network Traffic Analysis - www.example.com</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="300">
</HEAD>
<BODY vlink=blue alink=blue>
<CENTER>

<H2>MRTG - Network Traffic Analysis<BR>
(Host: <A href="http://galaxy.example.com/">galaxy.example.com</A>)</H2>

<H4>System Type: <A href="http://fedora.redhat.com/">RedHat Fedora Core 5</A></H4>

<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=20>
<tr>
<td align=center>
<B>Traffic Analysis - ppp0<BR>(External ADSL2+ Connection)</B><P>
<A HREF="ppp0.html"><IMG SRC="ppp0-day.png" ALT="Click for PPP0 Statistics..." BORDER=0></A><BR>
</td>
</tr>
<tr>
<td align=center>
<B>Traffic Analysis - eth1<BR>(Internal LAN)</B><P>
<A HREF="eth1.html"><IMG SRC="eth1-day.png" ALT="Click for ETH1 Statistics..." BORDER=0></A><BR>
</td>
</tr>
</TABLE>

</CENTER>
</BODY>
</HTML>


[bash]# cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.original
[bash]# vi /etc/snmp/snmpd.conf
#  Configure basic Read-Only community string.
rocommunity  myHomeServer

#  Mapping from Community to Security.
com2sec      myLoopNet   localhost                         myHomeServer
com2sec      myExtNet    ???.???.???.???/255.255.255.255   myHomeServer          <-- Place external IP Address in here.
com2sec      myIntNet    192.168.1.0/255.255.255.0         myHomeServer

#  Mapping from Security Group to Security Name.
group        myROGroup   v1 myLoopNet
group        myROGroup   v1 myExtNet
group        myROGroup   v1 myIntNet

#  Define the view.
view         all-mibs    included .1 80

#  Grant Access From the Security Model to MIB View.
access       myROGroup   v1 noauth 0 all-mibs none none




[bash]# chkconfig --level 2345 snmpd on
[bash]# chkconfig --list snmpd


[bash]# /etc/init.d/snmpd restart
[bash]# grep snmp /var/log/messages


[bash]# snmpwalk -v 1 -c myHomeServer localhost interface | grep Descr
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifDescr.3 = STRING: eth1
IF-MIB::ifDescr.4 = STRING: ppp0


[bash]# vi /etc/mrtg/mrtg.cfg
Target[ppp0]: 4:myHomeServer@localhost
Target[eth1]: 3:myHomeServer@localhost


[bash]# rm -f /var/lib/mrtg/*






Previous
Home Next