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