網站首頁 編程語言 正文
導語:通過node_exporter監控GPU以及cpu頻率、溫度,不想用一個node_exporter再加一個dcgm,分開監控。我這里監控的是熱區的溫度。如果需要監控各個cpu核心的溫度需要修改一下代碼。
結合了https://gitee.com/kevinliu_CQ/node_exporter監控GPU的代碼。
加入了cpu的2項自定義監控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二進制文件即可。
gitee中已經編譯好了amd64的可執行文件。
這個版本添加了Nvidia GPU信息的抓取,所以編譯的時候需要nvml.h 復制到/usr/local/cuda/include 目錄里面 1. 復制依賴 ?```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相關需要替換"github.com/go-kit/log"為"github.com/go-kit/kit/log" ?``` 4. 在如果一切正常在目錄中會生成node_exporter的可執行二進制文件 5. 運行即可 ?```bash ./node_exporter --web.listen-address=":19200" ?``` 6. 打包arm64架構的方法 * 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
是應該在 i3 狀態欄中使用的文件。
附帶說明一下,每個內核的溫度都可以temp*_input
在/sys/devices/platform/coretemp.0/hwmon/hwmon*/
. 關聯temp*_label
顯示哪個文件與哪個內核相關(在我的例子中是 4 個內核):
.../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
對應于內核的最熱值。
如果要獲取對應每個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
相關推薦
- 2022-11-23 解決vant組件van-list 首屏加載兩次的情況
- 2022-12-11 C++?Boost?Tokenizer使用詳細講解_C 語言
- 2022-08-21 Python中條件語句、循環語句和pass語句的使用示例_python
- 2022-06-02 Go語言流程控制詳情_Golang
- 2023-07-04 SpringBoot不在使用@Validated 做參數校驗但是不想在Controller層怎么辦?
- 2022-06-16 golang?gorm實現get請求查詢案例測試_Golang
- 2023-01-01 用幾行C#代碼實現定時關機/重啟(超詳細!建議新手練習)_C#教程
- 2022-03-29 Python數據類型-序列sequence_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支