본문 바로가기
Windows

윈도우 온도 모니터링(zabbix, Openhardwaremonitor)

by 이르가체페 2024. 7. 23.

요구조건

1. OpenHardwareMonitor 설치 및 csv로 로그출력(1분이나 5분단위 권장)

   설치위치 :  C:\OpenHardwareMonitor

 

2. cygwin 설치(c:\cygwin64)

   c:\cygwin64\bin   PATH 추가

 

 

 

 

 

zabbix_agented.conf 편집

C:\Program Files\Zabbix Agent\zabbix_agentd.conf

UserParameter=Temperature.HDD, c:\cygwin64\bin\bash.exe C:\OpenHardwareMonitor\get_temp_hdd.sh 
UserParameter=Temperature.CPU, c:\cygwin64\bin\bash.exe C:\OpenHardwareMonitor\get_temp_cpu.sh 

수정, 저장후 서비스(Zabbix Agent) 재시작

 

 


로그파일 확인

test@DESKTOP-74ASQGW /cygdrive/c/OpenHardwareMonitor
$ ls -l *.csv
-rwxrwx---+ 1 Administrators 없음 74841 Jul 23 11:15 OpenHardwareMonitorLog-2024-07-23.csv


원하는 필드 찾기

test@DESKTOP-74ASQGW /cygdrive/c/OpenHardwareMonitor
$ cat *.csv | head -n 1 | sed 's/,/\n/g' > list

 


cat -n  명령으로 필드 확인

test@DESKTOP-74ASQGW /cygdrive/c/OpenHardwareMonitor
$ cat -n list | grep -i temp
    24  /lpc/nct6779d/temperature/3
   142  /hdd/0/temperature/0

 


cut -d 명령으로 해당필드 내용 확인

test@DESKTOP-74ASQGW /cygdrive/c/OpenHardwareMonitor
$ cat *.csv | head -n 20 | cut -d,  -f 24,142
/lpc/nct6779d/temperature/3,/hdd/0/temperature/0
"Temperature #3","Temperature"
43.5,35
43.5,35
43.5,35
43.5,35
43.5,35
43.5,35
43.5,35
43.5,35
43.5,35
43,35
43,35


마지막라인(최신값)의 필드 가져오기


test@DESKTOP-74ASQGW /cygdrive/c/OpenHardwareMonitor
$ cat get_temp_cpu.sh
#!/bin/bash
##!c:\cygwin64\bin\sh
path1="/cygdrive/c/OpenHardwareMonitor/"
fname=${path1}./OpenHardwareMonitorLog-`/bin/date +%Y-%m-%d`.csv
tail -n 1  $fname  |  cut -d,   -f 24

test@DESKTOP-74ASQGW /cygdrive/c/OpenHardwareMonitor
$ cat get_temp_hdd.sh
#!/bin/bash
##!c:\cygwin64\bin\sh
path1="/cygdrive/c/OpenHardwareMonitor/"
fname=${path1}./OpenHardwareMonitorLog-`/bin/date +%Y-%m-%d`.csv
tail -n 1  $fname  |  cut -d,   -f 142


반응형

댓글