<html>
<body>
<div style='font: 12pt sans-serif;'>
After a good while "newbie me" is back to rrd scripts for system monitoring.
<br />My test rig is 1,3 celeron with BSD 7.1 on it, i have next to zero programing skills sadly.
<br />I do not trust cacti because it drags whole load of stuff to system (i try to keep it clean of unneeded stuff),
<br />so i decided to try shell scripting and standard system tools to get the data (and apache to show the img).
<br />
<br />So far i managed to come up with this (CAUTION horrific images):
<br />http://94.27.12.50/rrdtool/
<br />
<br />I need your help with this set of sh
<br />
<br />* NOTE Ipfw counts, cron launches update script every minute and graph script every 5 minutes
<br />
<br /># # # this is my rrdbase creation sh # # #
<br />rrdtool create /usr/local/rrdtool/db/ipfw_test.rrd -s 60\
<br /> DS:interface_in:COUNTER:600:U:U \
<br /> DS:outerface_in:COUNTER:600:U:U \
<br /> DS:interface_out:COUNTER:600:U:U \
<br /> DS:outerface_out:COUNTER:600:U:U \
<br /> DS:html_shtml:COUNTER:600:U:U \
<br /> RRA:AVERAGE:0.5:1:600 \
<br /> RRA:AVERAGE:0.5:6:700 \
<br /> RRA:AVERAGE:0.5:24:775 \
<br /> RRA:AVERAGE:0.5:288:797 \
<br /> RRA:MAX:0.5:1:600 \
<br /> RRA:MAX:0.5:6:700 \
<br /> RRA:MAX:0.5:24:775 \
<br /> RRA:MAX:0.5:288:797
<br />
<br /># # #This is my update sh # # #
<br />#!/bin/sh
<br />
<br />html_shtml=`/sbin/ipfw show 0005 | awk '{print $3}'`
<br />interface_in=`/sbin/ipfw show 0006 | awk '{print $3}'`
<br />outerface_in=`/sbin/ipfw show 0007 | awk '{print $3}'`
<br />interface_out=`/sbin/ipfw show 0008 | awk '{print $3}'`
<br />outerface_out=`/sbin/ipfw show 0009 | awk '{print $3}'`
<br />NOW=`date +%s`
<br />RRDTOOL=/usr/local/bin/rrdtool
<br />RRDBASE=/usr/local/rrdtool/db/ipfw_test.rrd
<br />
<br />$RRDTOOL update $RRDBASE $NOW:$html_shtml:$interface_in:$outerface_in:$interface_out:$outerface_out
<br />
<br />#echo $NOW:$html_shtml:$interface_in:$outerface_in:$interface_out:$outerface_out
<br />^^ check works allso and gives numbers with ":" between them
<br />
<br />Below is cause of my brain panic, help please, show me my misstake
<br />
<br /># # # my Graph sh # # #
<br />#!/bin/sh
<br />
<br />WWWPREFIX=/usr/local/www/data/rrdtool
<br />RRDPREFIX=/usr/local/rrdtool/db
<br />
<br />/usr/local/bin/rrdtool graph $WWWPREFIX/ipfw_test.png \
<br /> --width 500 --height 500 --imgformat PNG \
<br /> --start -43200 \
<br /> --title "Q!" --rigid --color BACK#FAFAFA \
<br /> --vertical-label Kbit/sec \
<br /> DEF:html_shtml=$RRDPREFIX/ipfw_test.rrd:html_shtml:AVERAGE \
<br /> DEF:interface_in=$RRDPREFIX/ipfw_test.rrd:interface_in:AVERAGE \
<br /> DEF:outerface_in=$RRDPREFIX/ipfw_test.rrd:outerface_in:AVERAGE \
<br /> DEF:interface_out=$RRDPREFIX/ipfw_test.rrd:interface_out:AVERAGE \
<br /> DEF:outerface_out=$RRDPREFIX/ipfw_test.rrd:outerface_out:AVERAGE \
<br /> CDEF:web=html_shtml,128,/ \
<br /> CDEF:localin=interface_in,128,/ \
<br /> CDEF:inetin=outerface_in,128,/ \
<br /> CDEF:localout=interface_out,128,/ \
<br /> CDEF:inetout=outerface_out,128,/ \
<br /> VDEF:html_sum=html_shtml,TOTAL \
<br /> VDEF:int_in_sum=interface_in,TOTAL \
<br /> VDEF:out_in_sum=outerface_in,TOTAL \
<br /> VDEF:int_out_sum=interface_out,TOTAL \
<br /> VDEF:out_out_sum=outerface_out,TOTAL \
<br /> VDEF:maxhtm=web,MAXIMUM \
<br /> VDEF:maxintin=localin,MAXIMUM \
<br /> VDEF:maxoutin=inetin,MAXIMUM \
<br /> VDEF:maxinout=localout,MAXIMUM \
<br /> VDEF:maxoutout=inetout,MAXIMUM \
<br /> VDEF:avghtm=html_shtml,AVERAGE \
<br /> VDEF:avginin=localin,AVERAGE \
<br /> VDEF:avgoutin=inetin,AVERAGE \
<br /> VDEF:avginout=localout,AVERAGE \
<br /> VDEF:avgoutout=inetout,AVERAGE \
<br />
<br /> LINE1:web#CCCCCC:"HTML-SHTML" \
<br /> GPRINT:maxhtm:"Max=%lf%s" \
<br /> GPRINT:avghtm:"Avg=%lf%s" \
<br /> GPRINT:html_sum:"Sum=%lf %sbytes\l" \
<br />
<br /> LINE1:localin#FF6600:"Local IN" \
<br /> GPRINT:maxintin:"Max=%lf%s" \
<br /> GPRINT:avginin:"Avg=%lf%s" \
<br /> GPRINT:sumint_in_sum:"Sum=%lf %sbytes\l" \
<br />
<br /> LINE1:inetin#0000FF:"Inet IN" \
<br /> GPRINT:maxoutin:"Max=%lf%s" \
<br /> GPRINT:avgoutin:"Avg=%lf%s" \
<br /> GPRINT:out_in_sum:"Sum=%lf %sbytes\l" \
<br />
<br /> LINE1:localout#FF1100:"Local OUT" \
<br /> GPRINT:maxinout:"Max=%lf%s" \
<br /> GPRINT:avginout:"Avg=%lf%s" \
<br /> GPRINT:int_out_sum:"Sum=%lf %sbytes\l" \
<br />
<br /> LINE1:inetout#FF0011:"Inet OUT" \
<br /> GPRINT:maxoutout:"Max=%lf%s" \
<br /> GPRINT:avgoutout:"Avg=%lf%s" \
<br /> GPRINT:out_out_sum:"Sum=%lf %sbytes\l" \
<br />
<br />Cant figure out why i get
<br />
<br />LINE1:web#CCCCCC:HTML-SHTML: not found
<br />LINE1:localin#FF6600:Local IN: not found
<br />LINE1:inetin#0000FF:Inet IN: not found
<br />LINE1:localout#FF1100:Local OUT: not found
<br />LINE1:inetout#FF0011:Inet OUT: not found
<br />
<br />I used this manual (Ru)
<br />http://bozza.ru/print_art237.html
<br />
<br />Allso, can any one direct me to life examples of GPRINT:?
<br />My graphs still need a lot of work.
<br />Sorry for my missprints and misstakes, english is not my native.
<br />:)
<br />
<br />
<br />
<br />
</div></body>
</html>