温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

因为CPU数变化导致执行sar命令报错:Invalid system activity file: /var/log/sa/saxx

发布时间:2020-08-11 21:03:04 来源:ITPUB博客 阅读:276 作者:guocun09 栏目:建站服务器

29号早上9点对一台Linux redhat 6 的VM(虚拟机)在调整CPU数(2->8)后发现,sar 查看当天CPU loading时,报错:


[root@vswhInd4DBt ~]# sar

Invalid system activity file: /var/log/sa/sa29


查看SYSSTAT官网

http://sebastien.godard.pagesperso-orange.fr/faq.html

主要说可能是因为sysstat版本变化照成saxx文件(/var/log/sa/sa29)格式的变化,不兼容导致不可读sarxx文件

Invalid system activity file: ... 

You are trying to use a file which is not a system activity file, or whose format is no longer compatible with that of files created by current version of sar.
If you were trying to use the standard system activity files located in the /var/log/sa directory then the solution is easy: Just log in as root and remove by hand all the files located in the /var/log/sa directory: 

rm /var/log/sa/sa??  

If you are using sysstat 11.1.1 and later, you can also use the sadf command to convert an old system activity binary datafile (version 9.1.6 and later) to current up-to-date format. Use the following syntax:

sadf -c old_datafile > new_datafile

Note: Starting with sysstat version 8.1.1 and later, it is possible to know which version of sar or sadc has been used to create a data file. Just enter the following command:

sadf -H /your/datafile | grep sysstat
File created using sar/sadc from sysstat version 8.1.7


回到我的环境,sysstat版本并没有变化。

怀疑因为CPU数的变化,导致saxx文件记录及运算的变化,使saxx文件写入失败sar不可读。


准备等30号再看是否正常,果然命令显示正常:

[root@vswhInd4DBt ~]# sar

Linux 2.6.32-504.el6.x86_64 (vswhInd4DBt)       07/30/2018      _x86_64_        (8 CPU)


12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle

12:10:01 AM     all      0.48      0.00      0.11      0.12      0.00     99.29

12:20:01 AM     all      0.27      0.00      0.10      0.06      0.00     99.57

12:30:02 AM     all      0.21      0.00      0.08      0.02      0.00     99.68

...

当然,在29号对CPU调整后rm -rf /var/log/sa/sa29 ,sar命令应该也能显示出调整后的信息

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI