Gnuplot in bash


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Gnuplot in bash
# 1  
Old 06-23-2014
Gnuplot in bash

Hi,

I want a graph plot using gnuplot for df -h command.

like filesystem, total size and avail size.

Thanks,
Anjan

---------- Post updated at 02:35 PM ---------- Previous update was at 02:34 PM ----------

I want a graph plot using gnuplot for df -h command per hour.
# 2  
Old 06-23-2014
I suggest you find a demo that is close to what you want. You should also familiarize yourself with the gnuplot language. Here is a sample...
gnuplot demo script: gantt.dem
# 3  
Old 06-23-2014
Yes I am looking at gnuplot. I have installed and checking. If you help that will be good.
# 4  
Old 06-23-2014
Firstly your going to need to collect hourly usage data into a datafile, cron is probably the best way perhaps something like this:

Code:
for filesystem in var usr tmp
do
   df -Pm /$filesystem | awk -v d=$(date date '+%Y/%m/%d %T') 'NR==2{print d,$3,$4}' OFS="\t" >> /usr/lib/${filesystem}_disk_data
done

Once you have your data you can use gnuplot to produce the grap, below is an example for the var datafile:

Code:
#!/usr/bin/gnuplot

set terminal png font "helvetica"
set output 'var_graph.png'

# For pdf output (requires ps2pdf) replace with below
# set terminal postscript landscape color
# set output '| ps2pdf - var_usage.pdf'

set title "Var filesystem usage over Time"
set timestamp "Last updated: %m/%d/%Y, %H:%M" top

set xlabel "Date (mm/yy)"
set timefmt "%Y/%m/%d %H:%M"
set xdata time
set format x "%m/%Y"

set ylabel "GB"
set yrange [ 0 : ]

set key left
set grid
set datafile separator "\t"

show variables

plot '/usr/lib/var_disk_data'     using 1:2 t 'Used' with lines

# 5  
Old 06-23-2014
That is impressively quick.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Gnuplot script

Need assistance in getting a script right. It requires little tweaking and I am not getting it right . Using below data and the below script it creates a table with png file but regarding the time it create 6,7,8 and i want each time 6:15 ,6:30 and so on So that i can view the exact graph... (3 Replies)
Discussion started by: ajayram_arya
3 Replies

2. Shell Programming and Scripting

Gnuplot 3d binning

Hello I have a text file with tens of thousands of rows The format is x y where both x and y can be anything between -100 and +100. What I would like to do is have a 3d gnuplot where there are 10,000 squared or bins and each bin will count how many rows have a value that would be... (1 Reply)
Discussion started by: garethsays
1 Replies

3. Shell Programming and Scripting

gnuplot do not take my variable

Hi! i want to print ot my data of the last seven days with gnuplot. in a script i put my gnuplot-script and at the top i generate my date-variable. #/bin/bash -e # Gnuplot script "API_Status.txt" # set terminal postscript color landscape dl 2 lw 2 'Helvetica' 15 ; # set output... (2 Replies)
Discussion started by: IMPe
2 Replies

4. UNIX for Dummies Questions & Answers

Need help! How to gnuplot a picture??

I would like to ask if I have already plot a graph using gnuplot, the setting(made by others) is in "gnuplot.defaults": gnuplot> load '<ParadisDir>/inputs/gnuplot.defaults' gnuplot> splot 'box.in' with lines, '0t0001' w lines How to transform it to bmp file? (or other types of pictures?) ... (2 Replies)
Discussion started by: kelvin490
2 Replies

5. Emergency UNIX and Linux Support

GNUPLOT help needed

Dear All, I am new to GNUPLOT :D and dont know how it works, but actually there is a LINUX script generated by me which is running & capturing data in real time, the problem is that i want to plot that data in real time using GNUPLOT.:confused: please help.:wall: (5 Replies)
Discussion started by: jojo123
5 Replies

6. Shell Programming and Scripting

bash-gnuplot: unexpected end of file

Hi I can't figure out why i get the "unexpected end of file". #! /bin/bash for file1 in /figures/*; do gnuplot << EOF set terminal postscript eps color enhanced set output "$file1.eps" set bar 1.000000 ... (2 Replies)
Discussion started by: Dedalus
2 Replies

7. Shell Programming and Scripting

xargs and gnuplot

Hi All, Seems I have an xargs stdin problem that I don't understand. I have a script (call it myscript.sh) that takes the names of one or more file(s) specified on the command line and creates a single gnuplot command file containing multiple records, one for each specified file. Each of... (9 Replies)
Discussion started by: paulianna2002
9 Replies

8. UNIX and Linux Applications

GNUplot

Hi, I am trying to make a plot of an ASCII file using GNUplot, but I keep getting error msg: for example plot filename.txt It says that (.txt ) is not identified ... I tried to write it without the .txt part, but I also get the error msg. Any idea why? :confused: (1 Reply)
Discussion started by: cosmologist
1 Replies

9. UNIX for Dummies Questions & Answers

Help with gnuplot

Hi, I am a beginner using UNIX, and was wondering how to use gnuplot from UNIX on my pc. I am connected remotely to my work's UNIX server using Secure Shell Client, and gnuplot won't open a new window when I use the plot command. How do I do this? Moreover, is it possible to save things from the... (0 Replies)
Discussion started by: KTTFB64
0 Replies
Login or Register to Ask a Question