网站建设资讯

NEWS

网站建设资讯

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

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

洛川ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18982081108(备注:SSL证书合作)期待与您的合作!

[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命令应该也能显示出调整后的信息


网页标题:因为CPU数变化导致执行sar命令报错:Invalidsystemactivityfile:/var/log/sa/saxx
本文来源:http://cdweb.net/article/ijeceh.html