blind-oracle / zabbix-sensors

Zabbix template & scripts to discover & monitor Linux sensors
36 stars 15 forks source link

Template not fetching sensor values #12

Closed gsaudade99 closed 7 months ago

gsaudade99 commented 7 months ago

Hello,

I'm having a problem with getting the values from the sensors of my linux server.The problems seems to be recurrent as I followed this thread in zabbix forum.

Could you look into this and give some feedback?

Kind regards,

blind-oracle commented 7 months ago

It's hard to say, but for sure this is wrong:

/etc/zabbix/zabbix_agentd.d/sensors.conf contains this line:

UserParameter=lmsensors.discover[*],/etc/zabbix/scripts/sensors.py $1

Please see this file https://github.com/blind-oracle/zabbix-sensors/blob/master/sensors.conf

gsaudade99 commented 7 months ago

After looking into the server logs I got this:

[root@zabbix-server ~]# tail -f /var/log/zabbix/zabbix_server.log 
1. Failed: SyntaxError: invalid json (at offset 1)
    at [anon] (duktape.c:37568) internal
    at parse () native strict preventsyield
    at [anon] (function:1) preventsyield
  1707:20240327:144326.301 discovery rule "srv-prox1-dc:sensors.discovery.voltage" became not supported: Preprocessing failed for: sh: 1: /etc/zabbix/scripts/sensors.py: Permission denied

I managed to fix it doing:

chmod +x /etc/zabbix/scripts/sensors.py
chown zabbix:zabbix /etc/zabbix/scripts/sensors.py
systemctl restart zabbix-agent2