Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] MRTG (was: Re: bandwidth statistic generaing program?)



Jonathan Byrne wrote:

> MRTG will talk to anything that speaks SNMP.  Most routers and similar
> devices do, but it's not limited to that.  Anything can speak SNMP, and

It even works without, you can use a script to provide the data:

/etc/mrtg.cfg:
|######################################################################
|# Multi Router Traffic Grapher -- Sample Configuration File
|######################################################################
|# This file is for use with mrtg-2.5.4c
|
|# Global configuration
|WorkDir: /var/www/router/mrtg
|WriteExpires: Yes
|
|Title[^]: Traffic Analysis for
|
|Title[ppp0]: router ADSL connection
|PageTop[ppp0]: <H1>Traffic analysis for ppp0</H1>
|Target[ppp0]: `/usr/local/bin/routerstats`
|MaxBytes1[ppp0]: 96000
|MaxBytes2[ppp0]: 16000
|WithPeak[ppp0]: wmy

/usr/local/bin/routerstats:
|#!/bin/sh
|IN=`cat /proc/net/dev | awk 'index($1,"ppp0") != 0 { print substr($0,8) }' | awk '{ print $1}'`
|OUT=`cat /proc/net/dev | awk 'index($1,"ppp0") != 0 { print substr($0,8) }' | awk '{ print $9}'`
|if [ "$IN" = "" ]; then IN="0"; fi
|if [ "$OUT" = "" ]; then OUT="0"; fi
|echo "$IN"
|echo "$OUT"
|uptime
|hostname

And I know my usage of awk is awkward here (^__-)
(It has been quite some time since I wrote that script...)

-- 
Tobias								PGP: 0x9AC7E0BC
This mail is made of 100% recycled bits
Now playing: Anri - Voice to Voice


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links