#!/bin/bash

# This agent script can be installed on a Zyxel NAS326 and will provide CPU temperature and Fan speed.
# Uses lm-sensors infrastructure on the Observium side by faking output format to lm-sensors style.
# Requires i2c-tools package to be installed (for i2cget).

CPU=$(($(i2cget -y 0x0 0x0a 0x07)))
FAN=$[60000/$(($(i2cget -y 0x0 0x0a 0x08)))]

echo '<<<lmsensors>>>'
echo 'nas326-i2c-0'
echo "CPU:        +${CPU}°C (crit = +70°C)"
echo "Fan:        $FAN RPM   (min =    0 RPM)"
