Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1237587
  • 博文数量: 389
  • 博客积分: 2874
  • 博客等级: 少校
  • 技术积分: 3577
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-24 10:34
文章分类

全部博文(389)

文章存档

2020年(2)

2018年(39)

2017年(27)

2016年(3)

2015年(55)

2014年(92)

2013年(54)

2012年(53)

2011年(64)

分类: LINUX

2014-08-21 15:59:46

Gnu是一个命令行的交互式绘图工具(command-driven interactive function plotting program)。用户通过输入命令,可以逐步设置或修改绘图环境,并以图形描述数据或函数,使我们可以借由图形做更进一步的分析。
案例分析:绘制cpu负载曲线图
一,软件安装
                 yum -y install     gnuplot
二  ,搜集数据   
        搜集2013-08-02号的cpu负载数据  
         sar -q -f /var/log/sa/sa02
三,   格式化数据:           
         sar -q -f /var/log/sa/sa02 |awk '/^[^a-z]/ {print  $1,$5,$6,$7}' |grep -v [a-z] |grep -v [A-Z] >/root/cpu.txt
四,用gnuplot 绘制cpu负载曲线图                        
gnuplot> set xdata time                     #定义x轴为时间         
gnuplot> set timefmt "%H:%M:$S"     #定义时间类型           
gnuplot> set term png size 1024,768 #定义图片大小   
Terminal type set to 'png'                                
Could not find/open font when opening font "arial", using internal non-scalable font
Options are 'nocrop medium size 1024,768 '        
gnuplot> set output "/root/cpu.png"        #定义输出位置 
gnuplot> plot "/root/cpu.txt"  using 1:2 title "1min"with  lines, "/root/cpu.txt" using 1:3 title "3min "with lines ,"/root/cpu.txt" using 1:4 title "5min" with lines #绘制
gnuplot> 
五,测试结果              





阅读(1107) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~