File: mrtg-example.sh

package info (click to toggle)
pmacct 0.11.4-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,468 kB
  • ctags: 4,794
  • sloc: ansic: 31,910; sh: 3,171; makefile: 170
file content (23 lines) | stat: -rwxr-xr-x 708 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

# This file aims to be a trivial example on how to interface pmacctd/nfacctd memory
# plugin to MRTG (people.ee.ethz.ch/~oetiker/webtools/mrtg/) to make graphs from
# data gathered from the network.
#
# This script has to be invoked timely from crontab:
# */5 * * * * /usr/local/bin/mrtg-example.sh 
#
# The following command collects incoming and outcoming traffic (in bytes) between
# two hosts; the '-r' switch makes counters 'absolute': they are zeroed after each
# query.

unset IN
unset OUT

IN=`/usr/local/bin/pmacct -c src_host,dst_host -N 192.168.0.100,192.168.0.133 -r`
OUT=`/usr/local/bin/pmacct -c src_host,dst_host -N 192.168.0.133,192.168.0.100 -r`

echo $IN
echo $OUT
echo 0
echo 0