应用场景:
自动化获取,用于ansible获取cpu,内存,磁盘读写,网络上下行数据
使用方式:
typeperf \Processor(_Total)\% Processor Time
typeperf -cf counters.txt -si 5 -sc 50 -f TSV -o domain2.tsv
typeperf -qx PhysicalDisk -o counters.txt

获取cpu/内存/磁盘读写/网络上下行
c:\test.conf:
\Processor(_Total)\% Processor Time
\Memory\% Committed Bytes In Use
\PhysicalDisk(_Total)\Disk Read Bytes/sec
\PhysicalDisk(_Total)\Disk Write Bytes/sec
\Network Interface(*)\Bytes Received/sec
\Network Interface(*)\Bytes Sent/sec
typeperf -cf "c:\test.conf" -sc 5
注意:
遇到过一个场景,文件指定正确,无其他报错信息,错误:没有有效计数器
解决方式,上述cf指定的文件看一下编码格式,使用utf-8
用sublime打开查看:
本文介绍了如何使用Ansible自动化获取系统性能指标如CPU、内存、磁盘读写和网络流量,并提到遇到的计数器无效问题,解决方法是检查配置文件编码格式,以UTF-8为例。
67

被折叠的 条评论
为什么被折叠?



