Yeah, I had to switch to using /proc/net/dev too. I don't know why macsat used ifconfig, it seems a terribly inefficient way to gather data. I always use /proc files whenever possible.
Rrdcollect is stand alone app, dont need cron for run. And as said developer much faster as rrdtool update. So i just want try it.
I try to remove space after colon, nothing change.
But the strange things happen and with rrdtool update. I a little bit correct "macsat rrdtool tutorial" script for statistic of tun0 (OPENVPN inteface).
First i try collect data from ifconfig, but in/out byte are always zero . (I dont know why). I decide use /proc/net/dev for get a stat. I create base like in tutorial, but when i add data the value is NAN.
Right now i dont had my config file, i will post tonight.
Yeah, I had to switch to using /proc/net/dev too. I don't know why macsat used ifconfig, it seems a terribly inefficient way to gather data. I always use /proc files whenever possible.
My setting that works:
Code:# Net: statistics file:///proc/net/dev " vlan1:%d %*d %*d %*d %*d %*d %*d %*d %d" /opt/var/lib/rrd/test/vlan1.rrd:in,out " vlan0:%d %*d %*d %*d %*d %*d %*d %*d %d" /opt/var/lib/rrd/test/vlan0.rrd:in,out " eth1:%d %*d %*d %*d %*d %*d %*d %*d %d" /opt/var/lib/rrd/test/eth1.rrd:in,out [maros@wl-500gp root]$ cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo:113530488 1341376 0 0 0 0 0 0 113530488 1341376 0 0 0 0 0 0 sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 eth0:2578898335 55172183 1039 0 1005 1005 0 0 2380392205 53092190 0 0 0 0 0 0 eth1: 0 0 0 0 0 1405 0 0 919965 15314 16 0 0 0 0 0 vlan0:3303049714 4772022 0 0 0 0 0 222 1328633450 5193225 0 0 0 0 0 0 vlan1:2577692385 50400031 0 0 0 0 0 1299451 1051758607 47898963 0 0 0 0 0 0 br0:3283961626 4772022 0 0 0 0 0 0 1274601982 4638916 0 0 0 0 0 0
It`s work. My mistake, forgot uncommet file:///proc/net/dev.
2 maros what are you using for create images. rrdcgi or cron with rrdtool?
I'm using rrdtool, because of archiving stuff. I've made updated version of rrdtool.sh script, sources are here: rrdmonitor (right click and "Save as").
You can check it and let me know if you have any comments.
I would like to create some official page for it and maybe create and include package to nslu2 package tree, but I need to find some time first.
Sorry, I didn't understand your last sentence.
I have some mess on user rights on my router, so it is possible that permissions are not set correctly in the script.
May be I should finally solve it:
- I'm using a renamed "admin" user account that owning most of files.
- My thttpd web server runs as nobody user.
- Disk is mounted via nfs and I want to be able check and change files as my desktop user.
Add the following config:
[admin@oleo root]$ cat /opt/etc/thttpd.conf
dir=/opt/share/www
port=80
user=admin
nochroot
nosymlink
charset=iso-8859-2
cgipat=cgi-bin/*
novhost
logfile=/opt/var/log/thttpd.log
pidfile=/opt/var/run/thttpd.pid
Does this mod script work with latest 7f?
I tried to put rrdtool to work with 7f before reading this topic... damm!
Floating poingt bug in kernel is corrected only in http://wl500g.dyndns.org/7g/
@maros : Any progress on rrdmonitor?
Last edited by oleo; 06-03-2007 at 12:42. Reason: maros
Hi!
My problem is that the log file is empty and the directories "RRD" under: "/opt/share/www" and "/opt/var/lib/" aren't created. I therefore cannot monitor
I've installed RRDTool via ipkg and that works. I have followed macsats cronguide and tested with the 5 minutes test script in the same guide.
That test script works as well (i have it placed in /opt/etc/cron.5mins/).
I was unable to use the default dir "/opt/usr/bin" since it didn't exist. I've tried although by creating that dir and placing the script there but that didn't help.
I've also tried changing the default dir to "/opt/bin" in the script and also placing the script in there. No luck there I'm afraid.
I have the "rrdrun.sh" script inside /opt/etc/cron.5mins/ and I it's executable.
I'm using lighttpd and perhaps that affects everything?
Since I'm unable to copy text from Putty I have included a printscreen of my currently running processes.
I hope someone might know what this is. Would love to get this working please!
I can paste into putty but not the other way around (copy from putty). Tried via ctrl+insert but taht didn't help I'm afraid. Thanks for your reply though
UPDATE: just found out there's some issues with the linux version. Also found out i could use Konsole instead..... now that was a lot easier than puTTY
Last edited by tzd99; 05-07-2008 at 00:57.
Has installed on wl-700 rrdtool.
The Server lighttpd and php and cron are installed and work.
I try to start this script
Code:#!/bin/sh # # macsat RRDTool script for ASUS WL-500g (Deluxe) v1.1 (18-07-2005) # # (c) 2005 by macsat@macsat.com # Feel free to distribute and improve :-) # # # Configuration Start # Directory for storing RRD Databases RRDDATA=/opt/var/lib/rrd/ # Directory for storing webpages / images RRDIMG=/opt/share/www/rrd/ # Configuration End #Output date for log... date if [ ! -d "${RRDDATA}" ] then echo "RRD Database dir: $RRDDATA does not exist...Creating Now...." mkdir -p "${RRDDATA}" fi if [ ! -d "${RRDIMG}" ] then echo "RRD Image / web dir: $RRDIMG does not exist....Creating Now...." mkdir -p "${RRDIMG}" fi # $1 = html file $2 = Period CreateHTML () { echo "<HTML><HEAD><TITLE>macsat.com demo RRDTool Traffic Graph Page </TITLE></HEAD><BODY> <h3>Traffic Graphs - ${2} </h3>" > "${1}" echo "<center><a href='index.html'>Daily Graphs</a> | <a href='week.html'> Weekly Graphs </a> | <a href='month.html'> Monthly Graphs </a> | <a href='year.html'> Yearly Graph </a>" >> "${1}" echo "<br><br><img src='wan${2}.png'><br><img src='lan${2}.png'><br><img src='wlan${2}.png'><br></CENTER></BODY></HTML>" >> "${1}" echo "Create started..." } if [ ! -f "${RRDIMG}/index.html" ] then echo " index.html does not exist.....Creating Now...." CreateHTML "${RRDIMG}/index.html" day fi if [ ! -f "${RRDIMG}/week.html" ] then echo " week.html does not exist.....Creating Now...." CreateHTML "${RRDIMG}/week.html" week fi if [ ! -f "${RRDIMG}/month.html" ] then echo " month.html does not exist.....Creating Now...." CreateHTML "${RRDIMG}/month.html" month fi if [ ! -f "${RRDIMG}/year.html" ] then echo " year.html does not exist.....Creating Now...." CreateHTML "${RRDIMG}/year.html" year fi WANIF=`nvram get wan_ifname` LANIF=`nvram get lan_ifnames | awk '{print $1}'` WLANIF=`nvram get wl0_ifname` #debug lines echo "WAN Interface: ${WANIF}" echo "LAN Interface: ${LANIF}" echo "WLAN Interface: ${WLANIF}" WANRRD="${RRDDATA}/${WANIF}.rrd" LANRRD="${RRDDATA}/${LANIF}.rrd" WLANRRD="${RRDDATA}/${WLANIF}.rrd" CreateRRD () { rrdtool create "${1}" \ DS:in:DERIVE:600:0:12500000 \ DS:out:DERIVE:600:0:12500000 \ RRA:AVERAGE:0.5:1:576 \ RRA:AVERAGE:0.5:6:672 \ RRA:AVERAGE:0.5:24:732 \ RRA:AVERAGE:0.5:144:1460 } if [ ! -f "${WANRRD}" ] then echo "RRD file : ${WANRRD} does not exist...Creating Now..." CreateRRD "${WANRRD}" fi if [ ! -f "${LANRRD}" ] then echo "RRD file : ${LANRRD} does not exist...Creating Now..." CreateRRD "${LANRRD}" fi if [ ! -f "${WLANRRD}" ] then echo "RRD file : ${WLANRRD} does not exist...Creating Now..." CreateRRD "${WLANRRD}" fi WANIN=`ifconfig "${WANIF}" |grep bytes|awk -F ":" '{print $2}'|awk '{print $1}'` WANOUT=`ifconfig "${WANIF}" |grep bytes|awk -F ":" '{print $3}'|awk '{print $1}'` LANIN=`ifconfig "${LANIF}" |grep bytes|awk -F ":" '{print $2}'|awk '{print $1}'` LANOUT=`ifconfig "${LANIF}" |grep bytes|awk -F ":" '{print $3}'|awk '{print $1}'` WLANIN=`ifconfig "${WLANIF}" |grep bytes|awk -F ":" '{print $2}'|awk '{print $1}'` WLANOUT=`ifconfig "${WLANIF}" |grep bytes|awk -F ":" '{print $3}'|awk '{print $1}'` # Debug echo "WAN -> in: ${WANIN} out: ${WANOUT} " echo "LAN -> in: ${LANIN} out: ${LANOUT}" echo "WLAN -> in: ${WLANIN} out: ${WLANOUT}" # Update the Databases `rrdupdate "${WANRRD}" -t in:out N:"${WANIN}":"${WANOUT}"` `rrdupdate "${LANRRD}" -t in:out N:"${LANIN}":"${LANOUT}"` `rrdupdate "${WLANRRD}" -t in:out N:"${WLANIN}":"${WLANOUT}"` # $1 = ImageFile , $2 = Time in secs to go back , $3 = RRDfil , $4 = GraphText CreateGraph () { rrdtool graph "${1}.new" -a PNG -s -"${2}" -w 550 -h 240 -v "bytes/s" \ 'DEF:ds1='${3}':in:AVERAGE' \ 'DEF:ds2='${3}':out:AVERAGE' \ 'LINE1:ds1#00FF00:Incoming Traffic' \ GPRINT:ds1:MAX:"Max %6.2lf %s" \ GPRINT:ds1:MIN:"Min %6.2lf %s" \ GPRINT:ds1:AVERAGE:"Avg %6.2lf %s" \ GPRINT:ds1:LAST:"Curr %6.2lf %s\n" \ 'LINE1:ds2#0000FF:Outgoing Traffic' \ GPRINT:ds2:MAX:"Max %6.2lf %s" \ GPRINT:ds2:MIN:"Min %6.2lf %s" \ GPRINT:ds2:AVERAGE:"Avg %6.2lf %s" \ GPRINT:ds2:LAST:"Curr %6.2lf %s" \ -t "${4}" mv -f "${1}.new" "${1}" } # Set time-variables MTIME=`date "+%M"` HTIME=`date "+%H"` # Update Daily graphs every 10 mins if [ "${MTIME}" = 00 ] || [ "${MTIME}" = 10 ] || [ "${MTIME}" = 20 ] || [ "${MTIME}" = 30 ] || [ "${MTIME}" = 40 ] || [ "${MTIME}" = 50 ]; then # 1 Day Graph echo "Daily Graphs created....." CreateGraph "${RRDIMG}/wanday.png" 86400 "${WANRRD}" WAN CreateGraph "${RRDIMG}/landay.png" 86400 "${LANRRD}" LAN CreateGraph "${RRDIMG}/wlanday.png" 86400 "${WLANRRD}" WLAN fi # Update Weekly graph once an hour if [ "${MTIME}" = 00 ]; then # 1 Week Graph echo "Weekly Graphs created....." CreateGraph "${RRDIMG}/wanweek.png" 604800 "${WANRRD}" WAN CreateGraph "${RRDIMG}/lanweek.png" 604800 "${LANRRD}" LAN CreateGraph "${RRDIMG}/wlanweek.png" 604800 "${WLANRRD}" WLAN fi # Update Monthly and Yearly graphs once a day (maby twice a day on 12h settings) if [ "${HTIME}" = 04 ] && [ "${MTIME}" = 15 ]; then # 1 Month Graph echo "Monthly Graphs Created...." CreateGraph "${RRDIMG}/wanmonth.png" 2678400 "${WANRRD}" WAN CreateGraph "${RRDIMG}/lanmonth.png" 2678400 "${LANRRD}" LAN CreateGraph "${RRDIMG}/wlanmonth.png" 2678400 "${WLANRRD}" WLAN # 1 Year Graph echo "Yearly Graphs Created...." CreateGraph "${RRDIMG}/wanyear.png" 31536000 "${WANRRD}" WAN CreateGraph "${RRDIMG}/lanyear.png" 31536000 "${LANRRD}" LAN CreateGraph "${RRDIMG}/wlanyear.png" 31536000 "${WLANRRD}" WLAN fi echo " <------------------------------------------------------------->" echo " "
The Directory for storage pics with schedules and for.rrd files this script has created.
And all... In a broad gull a file rrdtool only such messages
Sat Sep 6 10:07:53 UTC 2008
RRD Database dir:/opt/var/lib/rrd/does not exist... Creating Now....
RRD Image / web dir:/opt/share/www/rrd/does not exist.... Creating Now....
syntax error
Sat Sep 6 10:07:56 UTC 2008
syntax error
Sat Sep 6 10:07:58 UTC 2008
syntax error
Sat Sep 6 10:10:39 UTC 2008
syntax error
That was not pleasant to this script ?
Help pls...
Last edited by FastCat; 07-09-2008 at 21:15.