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? |
Advanced Bash-Scripting Guide
http://www.tldp.org/LDP/abs/html/ I would also give you an advice : write your first scripts one line at a time. Test every line before writing another. You won't believe the number of mistakes you can do in shell scripts. |
All times are GMT -5. The time now is 02:53 PM. |