kirukan |
03-26-2010 02:43 AM |
Mrtg graphing with script
I try to graph No of open files using simple shell script but it's unsuccessful to draw graph continuously. Please anybody assist me to solve this problem, following are my mrtg.cfg and script.
And i am bit unclear with MaxBytes. How we can define this?
PHP Code:
# No of open files #Target[Est-files]: `lsof | wc -l | awk '{printf("%d\n",$1); printf("%d\n",0); printf("%d\n",0)}'` Target[Est-files]: `/usr/local/mrtg/scripts/openfiles_lsof.sh` Title[Est-files]: Number of open files Est PageTop[Est-files]:<H1>Number of open files Est</H1> MaxBytes[Est-files]: 4000 Options[Est-files]: growright,unknaszero,nopercent,gauge LegendI[Est-files]: LegendO[Est-files]: No of files: Ylegend[Est-files]: count ShortLegend[Est-files]: files Legend1[Est-files]: Number of open files #Directory[Est-files]: system
The script seems ok
PHP Code:
#!/bin/sh echo 0 DATA=`lsof | wc -l` if [ $DATA = 0 ] then echo 0 else echo $DATA | awk '{printf("%d\n",$1)}' echo 0 echo 0 fi #echo 0
Quote:
Script Output:-
# ./openfiles_lsof.sh
0
2051
0
0
|
|