網(wǎng)站首頁 編程語言 正文
導(dǎo)語:通過node_exporter監(jiān)控GPU以及cpu頻率、溫度,不想用一個node_exporter再加一個dcgm,分開監(jiān)控。我這里監(jiān)控的是熱區(qū)的溫度。如果需要監(jiān)控各個cpu核心的溫度需要修改一下代碼。
結(jié)合了https://gitee.com/kevinliu_CQ/node_exporter監(jiān)控GPU的代碼。
加入了cpu的2項自定義監(jiān)控https://gitee.com/jiaminxu/self_node_exporter
安裝一下go
wget https://dl.google.com/go/go1.16.5.linux-amd64.tar.gz tar -xvf go1.16.5.linux-amd64.tar.gz cp -r ./go /usr/local cd /usr/local/go/bin cp -r * /usr/bin mkdir -p $HOME/go echo "export GOROOT=$HOME/go" >> /etc/profile echo "export GOPATH=$HOME/gopath" >> /etc/profile echo "export PATH=$PATH:$GOROOT/bin:$GOPATH/bin" >> /etc/profile echo "export env -w GO111MODULE=on" >> /etc/profile echo "export env -w GOPROXY=https://goproxy.io,direct" >> /etc/profile source /etc/profile cd /srv/ git clone https://gitee.com/kevinliu_CQ/node_exporter.git cd node_exporter/ # cp自己的go文件到collector/下 mkdir -p /usr/local/cuda/include cp -p nvml.h /usr/local/cuda/include export GOPROXY=https://goproxy.cn go build
編譯完直接使用./node_exporter二進(jìn)制文件即可。
gitee中已經(jīng)編譯好了amd64的可執(zhí)行文件。
這個版本添加了Nvidia GPU信息的抓取,所以編譯的時候需要nvml.h 復(fù)制到/usr/local/cuda/include 目錄里面 1. 復(fù)制依賴 ?```bash mkdir -p /usr/local/cuda/include cp -p nvml.h /usr/local/cuda/include ?``` 2. 定義GOPROXY變量 ?```bash export GOPROXY=https://goproxy.cn ?``` 3. 編譯項目 ?```bash cd /root/gitee_node_exporter go build 如果報錯kit相關(guān)需要替換"github.com/go-kit/log"為"github.com/go-kit/kit/log" ?``` 4. 在如果一切正常在目錄中會生成node_exporter的可執(zhí)行二進(jìn)制文件 5. 運行即可 ?```bash ./node_exporter --web.listen-address=":19200" ?``` 6. 打包arm64架構(gòu)的方法 * apt install gcc-aarch64-linux-gnu * env CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC_FOR_TARGET=gcc-aarch64-linux-gnu CC=aarch64-linux-gnu-gcc go build
CPU 溫度(最熱的核心)由 x86_pkg_temp 給出。
$ cat /sys/class/thermal/thermal_zone10/type x86_pkg_temp
然后/sys/class/thermal/thermal_zone10/temp
是應(yīng)該在 i3 狀態(tài)欄中使用的文件。
附帶說明一下,每個內(nèi)核的溫度都可以temp*_input
在/sys/devices/platform/coretemp.0/hwmon/hwmon*/
. 關(guān)聯(lián)temp*_label
顯示哪個文件與哪個內(nèi)核相關(guān)(在我的例子中是 4 個內(nèi)核):
.../hwmon*/$ grep "" temp*_label temp1_label:Physical id 0 temp2_label:Core 0 temp3_label:Core 1 temp4_label:Core 2 temp5_label:Core 3
該文件temp1_input
對應(yīng)于內(nèi)核的最熱值。
如果要獲取對應(yīng)每個cpu的溫度 需要
cat /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input
參考
https://qa.1r1g.cn/unix/ask/21339181/
https://cloud.tencent.com/developer/article/1820706
原文鏈接:https://blog.csdn.net/xujiamin0022016/article/details/124648395
相關(guān)推薦
- 2022-07-13 Android 動態(tài)獲取 Resource ID
- 2022-03-15 window.navigator.hid Cannot read properties of und
- 2022-12-27 K8S集群范圍使用imagePullSecret示例詳解_云和虛擬化
- 2022-05-02 C語言學(xué)生成績管理系統(tǒng)源碼_C 語言
- 2022-05-15 c++11?實現(xiàn)枚舉值到枚舉名的轉(zhuǎn)換問題_C 語言
- 2022-12-08 利用C語言編寫一個無限循環(huán)語句_C 語言
- 2022-01-04 給所有使用el-table組件特定列添加統(tǒng)一事件及樣式
- 2023-02-17 Python?樹表查找(二叉排序樹、平衡二叉樹)_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支