linux - GNUPLOT Illegal day of month -


i trying make graph out of stat.dat file containing:

----system---- ----total-cpu-usage---- ------memory-usage----- -net/total-      time     |usr sys idl wai hiq siq| used  buff  cach  free| recv  send 22-04 16:44:48|  0   0 100   0   0   0| 162m 57.1m  360m 3376m|   0     0 22-04 16:44:58|  0   0 100   0   0   0| 161m 57.1m  360m 3377m| 180b  317b 

and have gnu.sh containing:

#!/usr/bin/gnuplot set terminal png set output "top.png" set title "cpu usage" set xlabel "time" set ylabel "percentage" set xdata time set timefmt "%d-%m %h:%m:%s" set format x "%h:%m" plot "stat.dat"  using 1:3 title "system" lines, \ "stat.dat" using 1:2 title "user" lines, \ "stat.dat" using 1:4 title "idle" lines 

when run gnu file receive error:

could not find/open font when opening font "/usr/share/fonts/truetype/ttf-liberation/liberationsans-regular.ttf", using internal non-scalable font ----system---- ----total-cpu-usage---- ------memory-usage----- -net/total... stat.dat:1:"./gnu.sh", line 12: illegal day of month 

is familiar error , solution help?

when parsing first line of data file, gnuplot encounters illegal day of month.

you must somehow skip first 2 lines of data file before parsed. using version 5.0 or 4.6.6 can use new skip option achieve this. skips number of lines @ beginning of data file without parsing them (as opposed every, can skip number of lines after parsing, still give error):

set xdata time set timefmt "%d-%m %h:%m:%s" set format x "%h:%m" set style data lines set border plot "stat.dat" using 1:4 skip 2 lw 3 title "system", \      "" using 1:3 skip 2 lw 3 title "user", \      "" using 1:5 skip 2 lw 3 title "idle" 

note also, column counting wrong. date contains white space, counts 2 columns when refer following values.

alternatively, if don't have version 5.0 or 4.6.6, can use external tool tail skip first 2 lines:

set xdata time set timefmt "%d-%m %h:%m:%s" set format x "%h:%m" set style data lines set border plot "< tail -n +3 stat.dat" using 1:4 lw 3 title "system", \      "" using 1:3 lw 3 title "user", \      "" using 1:5 lw 3 title "idle" 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -