Linux GNUPLOT非法月日
我正试图从stat.dat文件中生成一个包含以下内容的图表:Linux GNUPLOT非法月日,linux,time,format,gnuplot,cpu,Linux,Time,Format,Gnuplot,Cpu,我正试图从stat.dat文件中生成一个包含以下内容的图表: ----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
----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
#!/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" with lines, \
"stat.dat" using 1:2 title "user" with lines, \
"stat.dat" using 1:4 title "idle" with lines
我有一个gnu.sh包含:
----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
#!/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" with lines, \
"stat.dat" using 1:2 title "user" with lines, \
"stat.dat" using 1:4 title "idle" with lines
运行gnu文件时,我收到以下错误:
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
是否有人熟悉此错误以及任何有帮助的解决方案?在解析数据文件的第一行时,gnuplot遇到了一个非法的月份 在解析数据文件前,必须以某种方式跳过前两行。使用版本5.0或4.6.6,您可以使用新的跳过选项来实现这一点。这会跳过数据文件开头的多行,而不进行分析,而不是每行,这会在分析后跳过多行,但仍会出现错误:
set xdata time
set timefmt "%d-%m %H:%M:%S"
set format x "%H:%M"
set style data lines
set border back
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"
还要注意,您的列计数是错误的。日期包含一个空格,因此当您引用以下值时,它将计为两列
或者,如果您没有版本5.0或4.6.6,可以使用外部工具(如tail)跳过前两行:
set xdata time
set timefmt "%d-%m %H:%M:%S"
set format x "%H:%M"
set style data lines
set border back
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"
您知道是否可以使用dstat监控pid或一个进程吗?