Mrtg help...

Hello All,

Can anyone tell me that how to make MRTG graph by picking values through a simple file. If you have such script of MRTG then please tell me the details.

Actually my scenarios is that i want to make a Graph through a simple file in which values randomly changes.

I hop you understand, what i am trying to explain..

Regards,
Waqas Ahmed

Definately do-able :slight_smile:

In the place of your normal SNMP target line, add an entry to call your script thus:

Target[routername.yourname.com]: `/fully/path/to/your/script.sh parameters`

Then set your script up to return exactly 4 values, one per line:

  1. first value to graph
  2. second value to graph
  3. uptime string
  4. hostname (or application name)

You can leave out the second two output lines if you want, all it does it print "<hostname> has been up for <uptime string>" at the top of each graph.

Then it's just a matter to making a short script to get the relevant values out of your text file.
If the text file has one number per line and you know the line number to get, you can pull the info out via a shell script using:

head -<line number> <file> | tail -1

For anything more complex, I'd suggest awk within a shell script. For anything even more complex, switch to perl. :slight_smile: