LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mrtg graphing with script (https://www.linuxquestions.org/questions/linux-newbie-8/mrtg-graphing-with-script-797984/)

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 ]
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

kirukan 03-26-2010 03:50 AM

1 Attachment(s)
For further information herewith attached graph, please ignore the green plot because it has changed to LegendO(blue)


All times are GMT -5. The time now is 12:59 AM.