# Here is where your web server will pick up the graphs
from:-
WorkDir:/var/www/html/mrtg
# "sar" appears to run every 10 minutes, so that's the interval we
pick.
Interval: 10
######################################################################
#
#
# this is the eth0 traffic graphing section from
/proc/net/dev #
# change "grep eth0" to
something else to measure a different device
#
#
#
######################################################################
Target[eth0]:
`perl -e
'@a=split(/[:\s]+/,qx(grep eth0
/proc/net/dev));$f="%.0f";$fmt="$f\n$f\n1\neth0 traffic\n";$s=sprintf
$fmt,$a[2],$a[10];print $s; print STDERR $s;'`;
Options[eth0]: noinfo,
growright, transparent, dorelpercent
MaxBytes[eth0]: 12500000
#
MaxBytes2[eth0]: 12500000
# AbsMax[eth0]: 12500000
kilo[eth0]:
1024
YLegend[eth0]: Bytes per second
ShortLegend[eth0]:
B/s
Legend1[eth0]: Incoming Traffic in Bytes per second
Legend2[eth0]:
Outgoing Traffic in Bytes per second
Legend3[eth0]: Maximal 10 Minute
Incoming Traffic
Legend4[eth0]: Maximal 10 Minute Outgoing
Traffic
LegendI[eth0]: In:
LegendO[eth0]:
Out:
Timezone[eth0]: GMT
Title[eth0]: Server eth0
traffic
PageFoot[eth0]: Contact us <a
href="/contact.asp">here</a> for more info<p>
PageTop[eth0]:
<H2>Server eth0
traffic</H2>
######################################################################
######################################################################
#
#
# this is the memory/swap space graphing section from /proc/meminfo
#
# I scaled mine by 1000 because the numbers were so
small
#
#
#
######################################################################
Target[mem]:
`perl -e '$f="%.0f";$fmt="$f\n$f\n1\nSystem Memory and
Swap\n";($mtot,$mu,$stot,$su)=(qx(cat
/proc/meminfo)=~/^Mem:\s*(\d+)\s+(\d+).*?^Swap:\s*(\d+)\s+(\d+)/sm);$o=sprintf
$fmt,100000*($su/$stot),100000*($mu/$mtot);print $o; print STDERR
$o'`;
Options[mem]: gauge, noinfo, growright, transparent
MaxBytes[mem]:
100000
YLegend[mem]: % Free memory and swap space
ShortLegend[mem]: % x
1000
Legend1[mem]: % swap space used
Legend2[mem]: % memory
used
Legend3[mem]: Maximal 10 Min
Legend4[mem]: Maximal 10
Min
LegendI[mem]: Swp:
LegendO[mem]:
Mem:
Timezone[mem]: GMT
Title[mem]: Server Memory and Swap
space
PageFoot[mem]: Contact us <a href="/contact.asp">here</a>
for more info<p>
PageTop[mem]: <H2>Server Memory and Swap
space</H2>
######################################################################
######################################################################
#
#
# this is the system temperature (1 of 2) from
/proc/cpqtmp #
# if you
don't have a compaq server, you probably can't use this
#
#
#
######################################################################
Target[temp1]:
`perl -e '$f="%.0f";$fmt="$f\n$f\n1\nSystem Temperatures (1 of 2)\n";$o=sprintf
$fmt,(qx(cat
/proc/cpqtmp)=~/^1\tDefault\t\d+\t\d+\t\d+\t(\d+).*?^2\tDefault\t\d+\t\d+\t\d+\t(\d+)/sm);print
$o; print STDERR $o'`;
Options[temp1]: gauge, noinfo, growright,
transparent
MaxBytes1[temp1]: 69
MaxBytes2[temp1]: 75
YLegend[temp1]:
System temperature sensors
ShortLegend[temp1]: °
Legend1[temp1]:
Sensor 1
Legend2[temp1]: Sensor 2
Legend3[temp1]: Maximal 10
Min
Legend4[temp1]: Maximal 10 Min
LegendI[temp1]:
temp1:
LegendO[temp1]: temp2:
Timezone[temp1]:
GMT
Title[temp1]: Server System Temperatures (1 of 2)
PageFoot[temp1]:
Contact us <a href="/contact.asp">here</a> for more
info<p>
PageTop[temp1]: <H2>Server System Temperatures (1 of
2)</H2>
######################################################################
######################################################################
#
#
# this is the system temperature (2 of 2) from
/proc/cpqtmp #
# if you
don't have a compaq server, you probably can't use this
#
#
#
######################################################################
Target[temp2]:
`perl -e '$f="%.0f";$fmt="$f\n$f\n1\nSystem Temperatures (2 of 2)\n";$o=sprintf
$fmt,(qx(cat
/proc/cpqtmp)=~/^3\tDefault\t\d+\t\d+\t\d+\t(\d+).*?^4\tDefault\t\d+\t\d+\t\d+\t(\d+)/sm);print
$o; print STDERR $o'`;
Options[temp2]: gauge, noinfo, growright,
transparent
MaxBytes[temp2]: 73
YLegend[temp2]: System temperature
sensors
ShortLegend[temp2]: °
Legend1[temp2]: Sensor
3
Legend2[temp2]: Sensor 4
Legend3[temp2]: Maximal 10
Min
Legend4[temp2]: Maximal 10 Min
LegendI[temp2]:
temp3:
LegendO[temp2]: temp4:
Timezone[temp2]:
GMT
Title[temp2]: Server System Temperatures (2 of 2)
PageFoot[temp2]:
Contact us <a href="/contact.asp">here</a> for more
info<p>
PageTop[temp2]: <H2>Server System Temperatures (2 of
2)</H2>
######################################################################
######################################################################
#
#
# this is the CPU Utilisation % from sar -U ALL
-h
#
# this is unlikley to work if you only have 1 CPU. Forget fixing it
#
# to work for 1 CPU if you're not a perl regexp
guru.
#
#
#
######################################################################
#Idle
time %= Target[cpu]: `perl -e '$f="%.0f";$fmt="$f\n$f\n1\nCPU
Idletime\n";$o=sprintf $fmt,(qx(sar -U ALL -h | tail
-8)=~/cpu0\s+%idle\s+([\d\.]+).*?cpu1\s+%idle\s+([\d\.]+)/sm);print $o; print
STDERR $o'`
Target[cpu]: `perl -e '$f="%.0f";$fmt="$f\n$f\n1\nCPU
Idletime\n";($c1,$c2)=(qx(sar -U ALL -h | tail
-8)=~/cpu0\s+%idle\s+([\d\.]+).*?cpu1\s+%idle\s+([\d\.]+)/sm);$c1=1000*(100-$c1);$c2=1000*(100-$c2);$o=sprintf
$fmt,$c1,$c2;print $o; print STDERR $o'`
Options[cpu]: gauge, noinfo,
growright, transparent, dorelpercent, nopercent
MaxBytes[cpu]:
100000
YLegend[cpu]: CPU Utilisation
ShortLegend[cpu]: % x
1000
Legend1[cpu]: CPU 0
Legend2[cpu]: CPU 1
Legend3[cpu]: Maximal 10
Min
Legend4[cpu]: Maximal 10 Min
LegendI[cpu]:
cpu0:
LegendO[cpu]: cpu1:
Timezone[cpu]:
GMT
Title[cpu]: Server CPU Utilisation (% times 1000)
PageFoot[cpu]:
Contact us <a href="/contact.asp">here</a> for more
info<p>
PageTop[cpu]: <H2>Server CPU Utilisation (% times
1000)</H2>
######################################################################
######################################################################
#
#
# this is the Disk I/O from sar -b
-h
#
# I scaled mine by 1000 because the numbers were so
small
#
#
#
######################################################################
Target[diskio]:
`perl -e '$f="%.0f";$fmt="$f\n$f\n1\nDisk I/O\n";($v1,$v2)=(qx(sar -b -h | tail
-5)=~/bread\/s\s+([\d\.]+).*?bwrtn\/s\s+([\d\.]+)/sm);$v1=1000*$v1;$v2=1000*$v2;$o=sprintf
$fmt,$v1,$v2;print $o; print STDERR $o'`
Options[diskio]: gauge, noinfo,
growright, transparent, dorelpercent, nopercent
MaxBytes[diskio]:
100000000
YLegend[diskio]: Disk I/O blocks/sec * 1000
ShortLegend[diskio]:
blk/s x 1000
Legend1[diskio]: read
Legend2[diskio]:
write
Legend3[diskio]: Maximal 10 Min
Legend4[diskio]: Maximal 10
Min
LegendI[diskio]: read:
LegendO[diskio]:
write:
Timezone[diskio]: GMT
Title[diskio]: Server Disk I/O
(blocks per second times 1000)
PageFoot[diskio]: Contact us <a
href="/contact.asp">here</a> for more info<p>
PageTop[diskio]:
<H2>Server Disk I/O (blocks per second times
1000)</H2>
######################################################################
######################################################################
#
#
# this is the Swap and Paging I/O from sar -B -W
-h
#
# I scaled mine by 1000 because the numbers were so
small
#
#
#
######################################################################
Target[swap]:
`perl -e '$f="%.0f";$fmt="$f\n$f\n1\nSwap and Paging\n";($v1,$v2)=(qx(sar -W -h
| tail
-2)=~/pswpin\/s\s+([\d\.]+).*?pgpgout\/s\s+([\d\.]+)/sm);$v1=1000*$v1;$v2=1000*$v2;$p1=$v1+$v2;($v1,$v2)=(qx(sar
-B -h | tail
-2)=~/pgpgin\/s\s+([\d\.]+).*?pgpgout\/s\s+([\d\.]+)/sm);$v1=1000*$v1;$v2=1000*$v2;$p2=$v1+$v2;$o=sprintf
$fmt,$p1,$p2;print $o; print STDERR $o'`
Options[swap]: gauge, noinfo,
growright, transparent, dorelpercent, nopercent
MaxBytes[swap]:
100000000
YLegend[swap]: In+Out blocks per second *
1000
ShortLegend[swap]: io blk/s x 1000
Legend1[swap]:
read
Legend2[swap]: write
Legend3[swap]: Maximal 10 Min
Legend4[swap]:
Maximal 10 Min
LegendI[swap]: swap:
LegendO[swap]:
page:
Timezone[swap]: GMT
Title[swap]: Server Swap and Paging
I/O (in+out blocks per second times 1000)
PageFoot[swap]: Contact us <a
href="/contact.asp">here</a> for more info<p>
PageTop[swap]:
<H2>Server Swap and Paging I/O (in+out blocks per second times
1000)</H2>
######################################################################
######################################################################
#
#
# this is the disk space % on / and /var from
"df"
#
#
#
######################################################################
Target[diskspace1]:
`perl -e '$f="%.0f";$fmt="$f\n$f\n1\nDisk
Space\n";($v1,$v2)=(qx(df)=~/(\d+)%\s+\/\n.*?(\d+)%\s+\/var/sm);$o=sprintf
$fmt,$v1,$v2;print $o; print STDERR $o'`
Options[diskspace1]: gauge, noinfo,
growright, transparent, nopercent
MaxBytes[diskspace1]:
100
YLegend[diskspace1]: % used
ShortLegend[diskspace1]: % Disk space
used
Legend1[diskspace1]: /
Legend2[diskspace1]:
/var
Legend3[diskspace1]: Maximal 10 Min
Legend4[diskspace1]: Maximal 10
Min
LegendI[diskspace1]: /:
LegendO[diskspace1]:
/var:
Timezone[diskspace1]: GMT
Title[diskspace1]: Server % Disk
space used on / and /var
PageFoot[diskspace1]: Contact us <a
href="/contact.asp">here</a> for more
info<p>
PageTop[diskspace1]: <H2>Server % Disk space used on /
and
/var</H2>
######################################################################
######################################################################
#
#
# this is the disk space % on /boot and /u02 from
"df"
#
#
#
######################################################################
Target[diskspace2]:
`perl -e '$f="%.0f";$fmt="$f\n$f\n1\nDisk
Space\n";($v1,$v2)=(qx(df)=~/(\d+)%\s+\/boot.*?(\d+)%\s+\/u02/sm);$o=sprintf
$fmt,$v1,$v2;print $o; print STDERR $o'`
Options[diskspace2]: gauge, noinfo,
growright, transparent, nopercent
MaxBytes[diskspace2]:
100
YLegend[diskspace2]: % used
ShortLegend[diskspace2]: % Disk space
used
Legend1[diskspace2]: /boot
Legend2[diskspace2]:
/u02
Legend3[diskspace2]: Maximal 10 Min
Legend4[diskspace2]: Maximal 10
Min
LegendI[diskspace2]: /boot:
LegendO[diskspace2]:
/u02:
Timezone[diskspace2]: GMT
Title[diskspace2]: Server % Disk
space used on /boot and /u02
PageFoot[diskspace2]: Contact us <a
href="/contact.asp">here</a> for more
info<p>
PageTop[diskspace2]: <H2>Server % Disk space used on
/boot and
/u02</H2>
######################################################################
######################################################################
#
#
# this is an alternative eth0 traffic graphing
section
#
# using "sar" instead of
/proc/*
#
#
#
######################################################################
Target[eth0sar]:
`perl -e '$s1=1;$s2=$s1;$f="%.0f";$fmt="$f\n$f\n1\neth0sar traffic\n";$o=sprintf
$fmt,(qx(/usr/bin/sar -n DEV | grep eth0 | tail
-2)=~/eth0\s+[^\s]+\s+[^\s]+\s+([^\s]+)\s+([^\s]+)/); print $o; print STDERR
$o;'`;
Options[eth0sar]: gauge, noinfo, growright, transparent,
dorelpercent
MaxBytes[eth0sar]: 12500000
# MaxBytes2[eth0sar]:
12500000
# AbsMax[eth0sar]: 12500000
kilo[eth0sar]:
1024
YLegend[eth0sar]: Bytes per second
ShortLegend[eth0sar]:
B/s
Legend1[eth0sar]: Incoming Traffic in Bytes per
second
Legend2[eth0sar]: Outgoing Traffic in Bytes per
second
Legend3[eth0sar]: Maximal 10 Minute Incoming
Traffic
Legend4[eth0sar]: Maximal 10 Minute Outgoing
Traffic
LegendI[eth0sar]: In:
LegendO[eth0sar]:
Out:
Timezone[eth0sar]: GMT
Title[eth0sar]: Server eth0sar
traffic
PageFoot[eth0sar]: Contact us <a
href="/contact.asp">here</a> for more
info<p>
PageTop[eth0sar]: <H2>Server eth0sar
traffic</H2>
######################################################################