LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-16-2008, 12:49 PM   #1
Lordandmaker
Member
 
Registered: Sep 2005
Location: London, UK
Distribution: Debian
Posts: 258

Rep: Reputation: 39
Time-based range in gnuplot?


I've got a script which, amongst other things copies a file across the network, times how long it takes, and dumps a log file with some data.
I then plot a graph with gnuplot every 10 mins with the following script:

Code:
set terminal png
set size 2,0.75
set data style linespoints
set title "speedtest results for last 6 hours."
set xdata time
set timefmt "%H:%M"
set format x "%H:%M"
set xlabel "Time of day"
set yrange [0:100]
set ytics 20
set y2range [0:100]
set y2tics 50
set grid noxtics y2tics
set ylabel "Transfer rate\n Mbs^-1"
plot "/home/avi/www/speedtest/jup-linux.log" using 8:($2*8) title "jup-linux down", \
"/home/avi/www/speedtest/jup-linux.log" using 8:($3*8) title "jup-linux up", \
"/home/avi/www/speedtest/tony.log" using 9:($2*8) title "tony up"
The log files are created just beforehand by tailing the actual generated logfiles for 6hrs worth of logs. The problem I'm having is that I'm about to add two hosts that both are shutdown overnight. Rather than add dead lines to the logfile, is there a way of telling gnuplot to plot the last six hours, say, of a field?

I know I could explicity set it, and create the gnuplot script each time I want to create the graph, but that seems a bit of a bodge if I can set the range more dynamically.
 
Old 12-17-2008, 03:11 PM   #2
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
I don't think gnuplot has a notion of units, including units of time.

I'd say generate the script. You can probably do it easily with something like
Code:
m4 -DCURRENT_TIME=$(date +%s) bandwidth.gp.m4 > bandwidth.gp
gnuplot bandwidth.gp
And suitable changes to your gnuplot script and (perhaps) logging format.
 
Old 12-18-2008, 12:16 PM   #3
Lordandmaker
Member
 
Registered: Sep 2005
Location: London, UK
Distribution: Debian
Posts: 258

Original Poster
Rep: Reputation: 39
Yeah, I've got a perl script set up to do it, was just wondering if gnuplot could do it.
 
  


Reply

Tags
gnuplot


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
Script using case, based on number range kinetik Programming 7 03-13-2012 07:24 AM
gnuplot - plot horizontal line over shorter range than the axis Meson Linux - Software 5 10-18-2008 08:41 AM
BASH : how to act based on test against a range of numbers hollywoodb Programming 4 07-06-2006 06:09 PM
Squid Time Access for a range of domains Palula Linux - Software 1 03-04-2006 12:45 PM
Linux based gateway for time-based wireless service. TotalDefiance Linux - Software 0 10-03-2005 06:06 PM

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

All times are GMT -5. The time now is 07:01 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