File: mrtg-example.sh

package info (click to toggle)
pmacct 1.7.8-4
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 11,904 kB
  • sloc: ansic: 110,430; sh: 4,794; cpp: 4,375; python: 3,632; makefile: 525
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