Fun with MRTG :)
I want to use it feature to draw graphics via stats provided from external scripts and draw a graphic that looks like cardiogram. For that I need a script that will feed MRTG with appropriate numbers in dependance of time the script is called from the shell. For example:
i=i+1 #the counter that knows where in the cycle are we
if i=5 then i=0 #if one whole heartbeat cycle is passed the counter is reset
if i=1 then a=4 #'a' is the value returned to MRTG and drawn
if i=2 then a=5
if i=3 then a=7
if i=4 then a=1
This is very simple graphic built from 4 dots. My problem is how to gather the upper algorithm in a shell script. I may write 'i' in outer file and 'cat' it to get the current state, or just use the 'date' command and calculate the time.. i don't know. What would you recommened me?
|