PDA

View Full Version : HDD free space in rrd graph ??


trider
13-12-2007, 23:46
Hi all

First of all, I must say, this is a very nice forum :D

Got 4 wl-500gP from work, an started to play with 'em... And the howto's are easy to follow, and i think, that it took me about 45-60 min to setup my final one (3 others are still working, but not 100%).

Now - The thing is, I would really like to have some sort of fealing with my diskspace on my philips 320GB USB drive.

Is there a tool allready for this or is it from scratch :confused:

raas
14-12-2007, 16:05
What do you mean with 'fealing'?

do you want to access the usb disk ?

al37919
14-12-2007, 16:34
another approach may be usage of a small lcd monitor to display the current memory/hdd consumption :)

trider
16-12-2007, 22:05
well, some read-out of some sort, could be nice...

Could be a graph or just displayed in numbers. The thing is, I don't know how to log the information. If I ssh to my router, I can type in 'df -h', and the data is displayed.

But how to get it on my http page of net, mem and CPU graphs, I do not know...

Chillout
24-07-2008, 13:36
check out the rrdgraphs for traffic somewhere on this board. it demonstrates how you can log data.

wirespot
24-07-2008, 22:23
Also see this (http://xlife.zuavra.net/index.php/73/). There's a script there which contains an example about how to graph disk space. But I hope you know your rrdtool (and bash) 'cause that script is not for the faint of heart.

poiu
28-07-2008, 19:05
I try your script copacup and i get : -sh: rrdstorm.sh: not found when i run it.
#-------------------------------------------------------------------
# configuration
#-------------------------------------------------------------------

RRDTOOL=/opt/bin/rrdtool
RRDUPDATE=/opt/bin/rrdupdate
RRDDATA=/opt/var/lib/rrd
RRDOUTPUT=/opt/share/www/rrd/
FORCEGRAPH=no

Script is of course executable, and i make the need dirs in the right paths and last, rrdtool is installed ^^.
Is of course lack of linux knowledge, but point please what i missing.
Firmware is .10 on a v1 500GP.

cupacup
29-07-2008, 00:45
Well you need to install bash first, then you should check grep functions(grep mnt, could also be grep part1, for hdd), also use latest version which have just been updated. Currently the hdd graph values must be updated every 30 s, but for the other(CPU;RAM..) values can be updated every minute using cron. Here is how my cron looks like:
*/1 * * * * admin bash /mnt/rrdstorm.sh update 0 1 3 4 5
*/12 * * * * admin bash /mnt/rrdstorm.sh graph_cron s 0 1 3 4 5
0 */1 * * * admin bash /mnt/rrdstorm.sh graph_cron h 0 1 3 4 5
3 */6 * * * admin bash /mnt/rrdstorm.sh graph 0 1 3 4 5

lordbone
29-07-2008, 14:01
Hi there.

Seems i encountered the same problem.


[xxx@xxx bin]$ ./rrdstorm.sh
-sh: ./rrdstorm.sh: not found
[xxx@xxx bin]$ bash
[xxx@xxx bin]$ ./rrdstorm.sh
bash: ./rrdstorm.sh: /bin/bash: bad interpreter: No such file or directory


Any idea what am I doing wrong ??

All I modified were the RRDDATA= and RRDOUTPUT= fields.

Thanks.

----------------------------

Later edit:

Ok, i was stupid, didn`t even read the error. Thing is that bash was installed under /opt/bin/bash and the rrdstorm script was looking for it under /bin/bash.

Replaced the header of file: #!/bin/bash with #!/opt/bin/bash and it seems to have executed successfully.

cupacup
29-07-2008, 14:27
hello, the line bash: ./rrdstorm.sh: /bin/bash: bad interpreter: No such file or directory says it all. Bash should not be installed in /bin. Are you sure you installed bash via ipkg? Because bash is an optional package and is not installed by default. Also if you want to properly display disk data you should install coreutils. Check this tutorial (http://wl500g.info/showthread.php?t=10307).
Short said:

Get rrdstorm.sh from http://wl500ginfo.pastebin.com/f789cf38a and edit ./rrdstorm.sh for proper grep functions in disk section
RRDuVAL[5]='
SP=$(/opt/bin/coreutils-df "-B1")
echo -n $(echo "$SP"|grep opt|awk "{print \$3\":\"\$2}"):
echo -n $(echo "$SP"|grep mnt|awk "{print \$3\":\"\$2}")
echo
'
mnt should be changed to whatever you use for mount.
In shell

ipkg install coreutils
ipkg install bash
ipkg install cron
bash rrdstorm.sh create 0 1 3 4 5 6

Then edit crontab
vi /opt/ect/crontab
with these values

*/1 * * * * admin bash /path to/rrdstorm.sh update 0 1 3 4 5 6
*/22 * * * * admin bash /path to/rrdstorm.sh graph_cron s 0 1 3 4 5 6
0 */1 * * * admin bash /path to/rrdstorm.sh graph_cron h 0 1 3 4 5 6
3 */6 * * * admin bash /path to/rrdstorm.sh graph 0 1 3 4 5 6
and chmod it chmod 0600 /opt/ect/crontab
and this is pretty much it. Good luck!

cupacup
29-07-2008, 14:31
Also get the latest version from here (http://wl500ginfo.pastebin.com/f77e330b5) and check the demo graphs.
http://shrani.si/t/8/1A/36qjyTft/load1.jpg (http://shrani.si/?8/1A/36qjyTft/load1.png)http://shrani.si/t/1Y/kA/3iK6sabF/mem1.jpg (http://shrani.si/?1Y/kA/3iK6sabF/mem1.png)http://shrani.si/t/d/Ub/19AvbrbL/cpu1.jpg (http://shrani.si/?d/Ub/19AvbrbL/cpu1.png)
http://shrani.si/t/1W/11c/2MzRcqWw/wan1.jpg (http://shrani.si/?1W/11c/2MzRcqWw/wan1.png)http://shrani.si/t/2b/i5/2btomT2P/hdd1.jpg (http://shrani.si/?2b/i5/2btomT2P/hdd1.png)http://shrani.si/t/2L/5J/1oDv2WAo/wlan1.jpg (http://shrani.si/?2L/5J/1oDv2WAo/wlan1.png)

lordbone
29-07-2008, 14:44
Yeah, i noticed the version change when you uploaded the new file. I got both the old and the new one. I also noticed that i was stupid with the bash thingie, and edited the post above. Gonna try now what u posted. Thanks.

lordbone
29-07-2008, 15:00
Ok, this is what i did:

Changed:



SP=$(/opt/bin/coreutils-df "-B1")
echo -n $(echo "$SP"|grep opt|awk "{print \$3\":\"\$2}"):
echo -n $(echo "$SP"|grep mnt|awk "{print \$3\":\"\$2}")
echo
'
RRDgUM[5]='space (bytes)'
RRDgLIST[5]="30 31 32 33 34 35"
RRDgDEF[5]=$(cat <<EOF
'DEF:optzasede=\$RRD:optzasede:AVERAGE'
'DEF:optprosto=\$RRD:optprosto:AVERAGE'
'DEF:mntzasede=\$RRD:mntzasede:AVERAGE'
'DEF:mntprosto=\$RRD:mntprosto:AVERAGE'
'CDEF:bo=mntzasede,UN,0,mntzasede,IF,0,GT,UNKN,INF ,IF'
'AREA:bo#DDDDDD:'
'AREA:mntzasede#CC0033:/mnt:'
'CDEF:root=mntzasede,mntprosto,+'
'VDEF:sumr=root,LAST'


with


SP=$(df)
echo -n $(echo "$SP"|grep opt|awk "{print \$3\":\"\$2}"):
echo -n $(echo "$SP"|grep tmp|awk "{print \$3\":\"\$2}")
echo
'
RRDgUM[5]='space (bytes)'
RRDgLIST[5]="30 31 32 33 34 35"
RRDgDEF[5]=$(cat <<EOF
'DEF:optzasede=\$RRD:optzasede:AVERAGE'
'DEF:optprosto=\$RRD:optprosto:AVERAGE'
'DEF:mntzasede=\$RRD:mntzasede:AVERAGE'
'DEF:mntprosto=\$RRD:mntprosto:AVERAGE'
'CDEF:bo=mntzasede,UN,0,mntzasede,IF,0,GT,UNKN,INF ,IF'
'AREA:bo#DDDDDD:'
'AREA:mntzasede#CC0033:/tmp/mnt/disc0_3:'
'CDEF:root=mntzasede,mntprosto,+'
'VDEF:sumr=root,LAST'


I don`t know if that is good. I have like, 1 partition mounted to /opt and the other to /tmp/mnt/disc0_3 since I head oleg`s firmware doesn`t mount it anywhere else.

Don`t know how correct that edit is.

And another thing, the script seems to run successfully, but it doesn`t generate any output. The RRDDATA and RRDOUTPUT folders are empty after script execution.

I think it crashes silently or something.

I am already running rrdtools for traffic if it makes a difference.

-- BTW, awesome demo.

cupacup
29-07-2008, 15:12
This is how it should look like.
SP=$(/opt/bin/coreutils-df "-B1")
echo -n $(echo "$SP"|grep opt|awk "{print \$3\":\"\$2}"):
echo -n $(echo "$SP"|grep disc0_3|awk "{print \$3\":\"\$2}")
echo
'
RRDgUM[5]='space (bytes)'
RRDgLIST[5]="30 31 32 33 34 35"
RRDgDEF[5]=$(cat <<EOF
'DEF:optzasede=\$RRD:optzasede:AVERAGE'
'DEF:optprosto=\$RRD:optprosto:AVERAGE'
'DEF:mntzasede=\$RRD:mntzasede:AVERAGE'
'DEF:mntprosto=\$RRD:mntprosto:AVERAGE'
'CDEF:bo=mntzasede,UN,0,mntzasede,IF,0,GT,UNKN,INF ,IF'
'AREA:bo#DDDDDD:'
'AREA:mntzasede#CC0033:disc0_3:'
'CDEF:root=mntzasede,mntprosto,+'
'VDEF:sumr=root,LAST'
You can check if rrd database is beeing updated with rrd with this:
[admin@dz0ny root]$ rrdtool lastupdate /path to/hdd.rrd
optprosto optzasede mntprosto mntzasede

1217337065: 264934400 226105344 73048051712 79097274368

lordbone
29-07-2008, 15:26
Thanks for the quick answer. I re-downloaded the file, and made the following modifications


#!/opt/bin/bash


instead of


#!/bin/bash


the modification u pasted now, with disc0_3, and


RRDTOOL=/opt/bin/rrdtool
RRDUPDATE=/opt/bin/rrdupdate
RRDDATA=/opt/var/lib/rrd
RRDOUTPUT=/opt/wwwroot/rrd/hdd
FORCEGRAPH=no


to reflect the settings i`m using.

This is what it shows when i run it


[xxx@xxx bin]$ ./rrdstorm.sh
[xxx@xxx bin]$ ls /opt/var/lib/rrd/
total 188
drwxr-xr-x 2 xxx root 4096 Jul 29 13:09 .
drwxr-xr-x 4 xxx root 4096 Jul 29 13:09 ..
-rw-r--r-- 1 xxx root 56736 Jul 29 16:17 eth1.rrd
-rw-r--r-- 1 xxx root 56736 Jul 29 16:17 vlan0.rrd
-rw-r--r-- 1 xxx root 56736 Jul 29 16:17 vlan1.rrd
[xxx@xxx bin]$ ls /opt/wwwroot/rrd/hdd
total 8
drwxr-xr-x 2 tbone root 4096 Jul 29 15:11 .
drwxr-xr-x 3 tbone root 4096 Jul 29 16:15 ..


It runs with no visible errors, but it kinda` doesn`t do anything.

Any idea ?

cupacup
29-07-2008, 15:38
Hello, yes because it should not. try
.rrdstorm.sh create 0 1 3 4 5 6
this one is for initial creating of databases an htmlfiles

.rrdstorm.sh update 0 1 3 4 5 6
this one is for updating values

.rrdstorm.sh graph 0 1 3 4 5 6
this one is for generating graphs

.rrdstorm.sh graph_cron s 0 1 3 4 5 6
and this one is for quick updates

I hope it works for you.

lordbone
29-07-2008, 15:51
Yup, worked. Nifty looking graphs :)

Thanks for everything mate.

cupacup
29-07-2008, 16:58
Yup, worked. Nifty looking graphs :)

Thanks for everything mate.

No problems, I am glad you like it.

poiu
29-07-2008, 19:31
Still no run here.
When i execute i get :

./rrdstorm.sh : line 594 : syntax error near unexpected token `) '
./rrdstorm.sh : line 594 : ` help)'

Between ` and help in line 2 is some spaces, but forum deleted them.
In cron modifications is done and modifications of script is the disk0_3 on right section and right paths for files.
Maybe my copy/paste skills is outdated :)
Try with different editors and browsers on win/router but same result.
Lordbone you can upload the file here ?

lordbone
29-07-2008, 20:09
Yup, here u go mate:

You can get it from here (http://lordbone.evonet.ro/mipsel/rrdstorm.sh)

Good luck with it :)

poiu
29-07-2008, 22:51
Thank you lordbone, your file work ok, maybe the script get tainted on source ...
Still prezentation is bad, need enter by hand cpu/hdd/ etc, the index is build empty, overall graphics is nice

cupacup
30-07-2008, 00:50
Still no run here.
When i execute i get :

./rrdstorm.sh : line 594 : syntax error near unexpected token `) '
./rrdstorm.sh : line 594 : ` help)'

Between ` and help in line 2 is some spaces, but forum deleted them.
In cron modifications is done and modifications of script is the disk0_3 on right section and right paths for files.
Maybe my copy/paste skills is outdated :)
Try with different editors and browsers on win/router but same result.
Lordbone you can upload the file here ?
Well my copy>paste skills were bad not yours, sorry for that!

poiu
30-07-2008, 18:21
No harm done, copacup, we all tanks you for sharing your work with us ^^ .
But a beauty will be if the graphics are build in main page, not spread.
This is html work i think, but not any skills here, again..
Overall charge on processor power is around 20% so i will live with, hope the Asus will too,, the another scripts find it around charge like 50% so was innaceptable, so i will let your script work.
Another thing, wlan is blank, because of interface diferences between v1 and v2 ?
And to kill cpu temp because wont work anyway what is needit ?

LE: Y want to kill memory alocation/load/cpu temp to save power, i wont need it, is a quick way to do it besides try to comment some portions of script ?
The 1,2,3,4,5,6, way will do ?

cupacup
31-07-2008, 01:02
Yes you could do it or simply delete all html files and issue command rrdstorm.sh create 4 5 6. Little explanation 0 is LOAD, 1 is MEMORY, 2 nothing yet, 3 CPU, WAN 4, DISK 5 and 6 WLAN.
So if you want to create, for example just stats for disk, you would issue command rrdstorm create 5, values would get updated by rrdstorm update 5 and so on.
LE: If you want just some graphs on main page, you can edit index html. And place those images there.

poiu
31-07-2008, 16:24
I do in cron section like this :

*/1 * * * * admin bash /tmp/harddisk/rrdstorm.sh update 3 4 5
*/12 * * * * admin bash /tmp/harddisk/rrdstorm.sh graph_cron s 3 4 5
0 */1 * * * admin bash /tmp/harddisk/rrdstorm.sh graph_cron h 3 4 5
3 */6 * * * admin bash /tmp/harddisk/rrdstorm.sh graph 3 4 5

So the only desired (cpu,hdd,wan) will be created, thus save the cpu power.
My skills on html is = 0, so i will live with this form ^^ .

Chillout
31-07-2008, 16:29
I'm gonna see if I can combine this with my current RRDGraph setup which displays my bandwidth. Let's see if I can add CPU load to it :-)

poiu
31-07-2008, 16:48
After 1 hour test new settings the load drop from 20% with spikes to 100%, to 5% with spikes max 50%, so this the sweet spot for me .
The graphics look nice and ease to folow, but maybe on hdd i chose another colors, the red is omnipresent for me and hard to see the diferences wich is what.
Tanks you copacup again.
LE: the spikes go to 100% but the time is under 0,5 sec, before they last like 1 sec or more.
And to not forget, i have 128 ram, maybe this is important too ^^ .

artur72
17-09-2008, 00:43
Where I find (witch adresses) in web browser,
I have error on http://192.168.1.1:81/rrd/index.html

artur72
17-09-2008, 23:50
I have all files in dir /opt/wwwroot/rrd/hdd/,
but how open /opt/wwwroot/rrd/hdd/index.html in web browser.

.rrdstorm.sh create 0 1 3 4 5 6

.rrdstorm.sh update 0 1 3 4 5 6

.rrdstorm.sh graph 0 1 3 4 5 6

.rrdstorm.sh graph_cron s 0 1 3 4 5 6

all this command works fine.


Please help me.

wirespot
19-09-2008, 17:18
artur, you need a web server (like lighttpd) pointing to that directory. Or you can share the dir with Samba and look at the html files with your browser from your PC.

A tip for everybody else. Updating the rrd databases takes little CPU, but generating the graphs takes a lot. So you could keep just the update commands in cron and generate the graphs only when you want to look at them.