LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-14-2004, 03:17 PM   #1
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 32
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?
 
Old 08-14-2004, 07:42 PM   #2
futhark
Member
 
Registered: Nov 2003
Location: Montréal (Can)
Distribution: FC4
Posts: 110

Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rrd mrtg & mrtg-rrd.cgi ducati620 Linux - Newbie 0 06-03-2004 07:29 PM
Just for fun hyper guy Linux - Newbie 4 03-04-2004 06:07 PM
Various Fun wdavidson Linux - General 4 09-29-2003 10:13 AM
Just for fun neo77777 General 0 09-24-2002 06:42 PM
Fun with my new billsabub Linux - Software 4 02-09-2001 03:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration