서버의 센서 정보를 웹 정보로 전환하는 방법을 찾고 있다.
Ubuntu landscape API /etc/update-motd.d/50-landscape-sysinfo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 $ /etc/update-motd.d/50-landscape-sysinfo System information as of Tue 18 Jul 2023 01:33:55 AM KST System load: 0.12 Usage of /: 63.4% of 115.96GB Memory usage: 27% Swap usage: 0% Temperature: 62.0 C Processes: 237 Users logged in: 1 IPv4 address for br-1b16e8b29ebf: 172.18.0.1 IPv4 address for br-b83c6ec1591c: 172.20.0.1 IPv4 address for docker0: 172.17.0.1 IPv4 address for enp3s0: 125.142.68.143
/usr/bin/landscape-sysinfo
https://ubuntu.com/landscape/docs/python-module
https://pypi.org/project/landscape-api-py3/
psensor-server GUI 를 가진 데스크탑 환경이면 좋다. 웹 서버가 데스크탑 GUI pserver 를 통해서 데이터를 제공받아 내 환경에 적합하지 않는다.
psensor-server는 하드웨어 센서를 원격에서 모니터링 할 수 있는 웹 서버이다. 단 It provides a JSON Web service which can be used by psensor(1) to monitor remotely the hardware sensors of a computer.
단 psensor 를 기반으로 하기 때문에 아래 사이트의 내용도 함께 봐야 한다.
설치
apt install lm-sensors hddtemp
sudo apt install psensor psensor-server
psensor-server 는 단독으로
lm-sensors 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 $ sensors coretemp-isa-0000 Adapter: ISA adapter Package id 0: +70.0°C (high = +86.0°C, crit = +100.0°C) Core 0: +70.0°C (high = +86.0°C, crit = +100.0°C) Core 1: +65.0°C (high = +86.0°C, crit = +100.0°C) Core 2: +67.0°C (high = +86.0°C, crit = +100.0°C) Core 3: +62.0°C (high = +86.0°C, crit = +100.0°C) BAT1-acpi-0 Adapter: ACPI interface in0: 12.41 V curr1: 0.00 A nouveau-pci-0100 Adapter: PCI adapter GPU core: 1000.00 mV (min = +0.83 V, max = +1.03 V) temp1: +66.0°C (high = +95.0°C, hyst = +3.0°C) (crit = +105.0°C, hyst = +5.0°C) (emerg = +135.0°C, hyst = +5.0°C) acpitz-acpi-0 Adapter: ACPI interface temp1: +27.8°C (crit = +100.0°C) temp2: +29.8°C (crit = +100.0°C) temp3: +70.0°C (crit = +100.0°C)
psensor-server 사용 사용
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 psensor-server [OPTION]... -p,--port=PORT webserver port -w,--wdir=DIR directory containing webserver pages -d, --debug=LEVEL set the debug level, integer between 0 and 3 -l, --log-file=PATH set the log file to PATH --sensor-log-file=PATH set the sensor log file to PATH --sensor-log-interval=S set the sensor log interval to S (seconds)
웹 API
아래 같은 형식으로 [id] 에 센서 아이디를 주면 정보를 얻을 수 있다.
1 http://hostname:3131/api/1.0/sensors/[id]