翻译:使用文本收集器生成快速感应指标
来源:互联网 发布:windows old有什么用 编辑:程序博客网 时间:2024/06/14 00:12
原文:Quick Sensor Metrics with the Textfile Collector | Robust Perception
Quick Sensor Metrics with the Textfile Collector
使用文本收集器生成快速感应指标(Quick Sensor Metrics)
Brian Brazil August 8, 2015
Sometimes you need a machine metric that’s not exported yet by the node exporter. The textfile collector can be used to quickly get such metrics graphed in Prometheus.
有时你需要收集机器上没有被node exporter收集的指标(metric),那么可以使用文本收集器快速收集这类信息。
One of my computers was randomly getting turned off. Looking through the logs wasn’t fruitful, and as it has always run a bit hot I suspected thermal issues. The node exporter doesn’t yet export metrics related to temperature, fans and voltage so that’s not something Prometheus can provide out of the box. In addition every motherboard tends to have a different layout, but in this case I only care about one machine so I can do a hack for just this one machine. Using the sensors command I can get:
我的一台电脑总是时不时的关机,而日志中并没有提供详细的信息,我就怀疑是不是电脑发热导致的。Node exporter并没有提供与温度、风扇和电压相关的标量(metrics),同样的普罗米修斯没有提供立即可用的标量(metrics)。此外,每个主板都有不同的布局,但我只关心那台出问题的机器,所以我可以为这台机器收集额外的信息。使用sensors命令可以获得额外的信息
注:sensors的介绍,lm-sensors与样例的结果不一样。借鉴下Textfile Collector的做法即可。
Linux Read CPU Temperature Sensor Chip Data Including Voltage and Fan Speed With lm-sensors – nixCraft
yum install -y lm_sensors
atk0110-acpi-0Adapter: ACPI interfaceVcore Voltage: +1.12 V (min = +0.85 V, max = +1.60 V) +3.3 Voltage: +3.29 V (min = +2.97 V, max = +3.63 V) +5 Voltage: +4.92 V (min = +4.50 V, max = +5.50 V) +12 Voltage: +12.05 V (min = +10.20 V, max = +13.80 V)CPU FAN Speed: 0 RPM (min = 600 RPM)CHASSIS FAN Speed: 0 RPM (min = 600 RPM)CPU Temperature: +94.0°C (high = +60.0°C, crit = +95.0°C)GPU Temperature: +89.0°C (high = +60.0°C, crit = +95.0°C)
A little bit of sed produces output that’s compatible with the Prometheus text output format:
使用sed输出与普罗米修斯兼容的文本
$ sensors | sed -ne 's/\..*//; s/ /_/; s/: *+/ /; /Temp/p'
CPU_Temperature 94
GPU_Temperature 89
Finally this can be put in a crontab to run every minute, with a little code to ensure atomicity:
最后,在crontab中运行每分钟运行这段小代码以确保原子性
* * * * * sensors | sed -ne 's/\..*//; s/ /_/; s/: *+/ /; /Temp/p' > /var/lib/node_exporter/textfile_collector/lmsensors.prom.$$ && mv /var/lib/node_exporter/textfile_collector/lmsensors.prom.$$ /var/lib/node_exporter/textfile_collector/lmsensors.prom
/var/lib/node_exporter/textfile_collector/ is the default location for the textfile collector to look at for node exporter Debian packages from deb.robustperception.io.
/var/lib/node_exporter/textfile_collector/是文本收集器的默认位置。访问deb.robustperception.io可以获取node exporter的Debian发行包。
- 翻译:使用文本收集器生成快速感应指标
- 使用SLXT传输翻译文本
- 文本wiki,主要字体用[]来描述,自动感应[],快速切换
- 翻译:Laravel-4-Generators 使用自定义代码生成工具快速进行Laravel开发
- 文本分类指标解释
- 使用TextRank生成文本摘要
- 会计报表分析相关指标收集
- G1垃圾收集器入门【翻译】
- 文本分类性能评价指标
- 使用screenrecord对APP性能测试中的响应时间指标进行收集
- 如何在CentOS 7上使用Packetbeat和ELK收集基础结构指标
- 快速文本分类器 FastText
- 使用ifstream ofstream copy快速处理文本
- thinkpad 使用重力感应编程
- android 重力感应的使用
- iOS设备使用重力感应
- iOS设备使用重力感应
- 使用Json-lib生成JSON文本
- windows study
- es6 study
- Linux编译器GCC
- selenium实现文件上传
- PowerShell Study
- 翻译:使用文本收集器生成快速感应指标
- hdu1540-Tunnel Warfare 线段树区间合并
- 翻译:为普罗米修斯添加Nginx基本认证(Basic Auth)
- MAC显示隐藏文件AppleScript工具
- 深度学习优化器详解:梯度更新规则+缺点+如何选择
- cytoscape study
- Linux下安装及使用mysql
- java方法
- blockcluster