gnuplot错误 - “文件中没有数据”,“x范围无效”,“坏数据行1” - 在gnuplot中使用虚拟机统计信息

时间:2015-02-04 10:21:02

标签: linux bash graph ubuntu-12.04 gnuplot

我在下面写了一个脚本来输出vmstat,iostat和sar的统计信息。他们输出正常,我强调他们检查比较。一旦它们运行,我就一直在运行gnuplot,试图在图形上获得统计信息输出。我已经在我的ubuntu 12.04服务器上安装了gnuplot和dstat,但图表无效。它给了我几个我在标题中提到的错误。我最终决定从我的脚本中删除对gnuplot的所有引用,只是在命令行调用我的文件时使用gnuplot,它仍然会抛出上述错误消息之一。我在网上找到的每个模板都是一样的,这让我很生气。有人可以解决吗?我想要做的就是运行统计数据并从中制作图表 - 它不应该是如此令人沮丧。

我已经包含了我的脚本以备不时之需。是否可以在我的脚本中使用gnuplot,以便用户可以选择时间长度并立即运行脚本?或者应该将gnuplot分成完全不同的bash脚本? 我之前已经问过这个问题,但答案的质量很糟糕。

#!/bin/bash
#
# Script to get sar statistics#
echo "Enter the number of intervals (seconds) for the sar statistics:"
read int
echo "enter the number of output lines (count) to process:"
read cnt
clear
#set while

    while true; do
    clear
echo "*******************************"
echo "* Choose from the following: *"
echo "*******************************"
echo "* [1] To view process creation statistics *"
echo "* [2] To view I/O and transfer rate statistics *"
echo "* [3] To view paging statistics *"
echo "Press A to quit."
echo "************************"
echo -n "Enter your menu choice [0-15]: "
D=`/bin/date '+%B.%d'`
INT=$int
CNT=$cnt
read mychoice
case $mychoice in
1) echo "process creation statistics";
vmstat $INT $CNT |tee /tmp/sar_proc_stat_$D
echo "This file will be saved to /tmp/sar_pc_stat_$D"
sleep 3 ;;
2) echo "I/O and transfer rate statistics"
iostat $INT $CNT |tee /tmp/sar_IO_TR_stat_$D
echo "This file will be saved to /tmp/sar_IO_TR_stat_$D"
sleep 3 ;;
3) echo "paging statistics"
sar  $INT $CNT |tee /tmp/sar_pag_stat_$D
echo "This file will be saved to /tmp/sar_pag_stat_$D"
sleep 3 ;;
A) #Quit option
    echo You have now quit. Please return to the main menu. 
    exit;;

    *) #Wildcard option
     echo Invalid choice, please make another choice;;

esac
done

0 个答案:

没有答案