Ad Widget

Collapse

zabbix-sensors not executed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nagylzs
    Junior Member
    • Nov 2017
    • 8

    #1

    zabbix-sensors not executed

    I have installed zabbix-sensors ( https://github.com/blind-oracle/zabbix-sensors ) on a zabbix agent. /etc/zabbix/zabbix_agentd.d/sensors.conf contains this line:

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

    This file is included from /etc/zabbix/zabbix_agent.conf:

    Include=/etc/zabbix/zabbix_agentd.d/*.conf


    The lm-sensors package was installed correctly. The zabbix agent runs as user "zabbix". I can see that JSON data is exported when I run this:

    sudo -u zabbix /etc/zabbix/scripts/sensors.py

    Results in something like this:


    [
    {
    "{#ADAPTER}": "k10temp-pci-00c3",
    "{#TYPE}": "TEMP",
    "{#NAME}": "Tdie",
    "{#MIN}": 0.0,
    "{#HIGH}": 70.0,
    "{#CRIT}": 77.0,
    "{#TEMP_ID}": "temp1"
    },
    {
    "{#ADAPTER}": "k10temp-pci-00c3",
    "{#TYPE}": "TEMP",
    "{#NAME}": "Tctl",
    "{#MIN}": 0.0,
    "{#HIGH}": 80.0,
    "{#CRIT}": 90.0,
    "{#TEMP_ID}": "temp2"
    },
    {
    "{#ADAPTER}": "acpitz-acpi-0",
    "{#TYPE}": "TEMP",
    "{#NAME}": "temp1",
    "{#MIN}": 0.0,
    "{#HIGH}": 18.720000000000002,
    "{#CRIT}": 20.8,
    "{#TEMP_ID}": "temp1"
    },
    {
    "{#ADAPTER}": "nouveau-pci-0600",
    "{#TYPE}": "VOLTAGE",
    "{#NAME}": "GPU core",
    "{#MIN}": 0.8,
    "{#HIGH}": 1.187,
    "{#CRIT}": 1.3057,
    "{#VOLTAGE_ID}": "in0"
    },
    {
    "{#ADAPTER}": "nouveau-pci-0600",
    "{#TYPE}": "FAN",
    "{#NAME}": "fan1",
    "{#MIN}": 0.0,
    "{#HIGH}": 0.0,
    "{#CRIT}": 0.0,
    "{#FAN_ID}": "fan1"
    },
    {
    "{#ADAPTER}": "nouveau-pci-0600",
    "{#TYPE}": "TEMP",
    "{#NAME}": "temp1",
    "{#MIN}": 0.0,
    "{#HIGH}": 95.0,
    "{#CRIT}": 105.0,
    "{#TEMP_ID}": "temp1"
    }
    ]


    I can also get actucal sensor values, for example:

    # sudo -u zabbix sensors -u | grep fan1
    fan1:
    fan1_input: 3630.000



    Next thing I did is that I have imported the zabbix-sensors template to zabbix server, and assigned this template to the given host. I can see that lmsensor discovery rules appeared in the host configuration.

    Then I restart the zabbix-agentd service, and I see this in the logs:

    7248:20210328:091052.879 IPv6 support: YES
    7248:20210328:091052.879 TLS support: YES
    7248:20210328:091052.879 **************************
    7248:20210328:091052.879 using configuration file: /etc/zabbix/zabbix_agentd.conf
    7248:20210328:091052.879 agent #0 started [main process]
    7250:20210328:091052.879 agent #1 started [collector]
    7251:20210328:091052.879 agent #2 started [active checks #1]
    7248:20210328:091102.562 Got signal [signal:15(SIGTERM),sender_pid:7356,sender_uid:113, reason:0]. Exiting ...
    7248:20210328:091102.562 Zabbix Agent stopped. Zabbix 5.0.9 (revision 4d07aaafe2).
    7811:20210328:091139.375 Starting Zabbix Agent [private.domain.com]. Zabbix 5.0.9 (revision 4d07aaafe2).
    7811:20210328:091139.375 **** Enabled features ****
    7811:20210328:091139.375 IPv6 support: YES
    7811:20210328:091139.375 TLS support: YES
    7811:20210328:091139.375 **************************
    7811:20210328:091139.375 using configuration file: /etc/zabbix/zabbix_agentd.conf
    7811:20210328:091139.375 agent #0 started [main process]
    7813:20210328:091139.375 agent #1 started [collector]
    7814:20210328:091139.376 agent #2 started [active checks #1]



    There are no errors. Everything seems to be fine. Except for the fact that "Latest data" does not show any data from sensors.

    The discovery interval is 1h, and I have been running this host for at least a day.

    What am I doing wrong?
  • ThW
    Junior Member
    • Apr 2023
    • 1

    #2
    Hallo nagylzs​,

    did you find any solution?

    I have got exactly the same issue. Only coretemp-isa-0000 works correctly, but not the other one. Zabbix agent detects all properly by script (sensor.py), but afterwards requests to the sensor are rejected.


    zabbix_get -s solo -k sensor["coretemp-isa-0000","temp2"]
    49.000000

    # zabbix_get -s solo -k sensor["acpitz-acpi-0","temp1"]
    ZBX_NOTSUPPORTED: Cannot obtain sensor information.


    Here are my sensor devices

    soc_dts1-virtual-0
    Adapter: Virtual device
    DTS 1: +47.0°C

    acpitz-acpi-0
    Adapter: ACPI interface
    ACPI 0: +46.6°C (crit = +100.0°C)

    coretemp-isa-0000
    Adapter: ISA adapter
    Core 0: +49.0°C (high = +90.0°C, crit = +90.0°C)
    Core 1: +49.0°C (high = +90.0°C, crit = +90.0°C)
    Core 2: +48.0°C (high = +90.0°C, crit = +90.0°C)
    Core 3: +49.0°C (high = +90.0°C, crit = +90.0°C)

    axp288_fuel_gauge-isa-0000
    Adapter: ISA adapter
    Vcore 0: 4.49 V
    curr1: 0.00 A

    soc_dts0-virtual-0
    Adapter: Virtual device
    DTS 0: +49.0°C

    Any suggestions?

    In the meanwhile I went this way. witch worked out.

    UserParameter=system.cpu.temperature.sockel,sensor s | grep "ACPI 0" | awk -F'[:+°]' '{print $3}'
    UserParameter=system.cpu.temperature.dts0,sensors | grep "DTS 0" | awk -F'[:+°]' '{print $3}'
    UserParameter=system.cpu.temperature.dts1,sensors | grep "DTS 1" | awk -F'[:+°]' '{print $3}'
    UserParameter=system.cpu.temperature.core0,sensors | grep "Core 0" | awk -F'[:+°]' '{print $3}'
    UserParameter=system.cpu.temperature.core1,sensors | grep "Core 1" | awk -F'[:+°]' '{print $3}'
    UserParameter=system.cpu.temperature.core2,sensors | grep "Core 2" | awk -F'[:+°]' '{print $3}'
    UserParameter=system.cpu.temperature.core3,sensors | grep "Core 3" | awk -F'[:+°]' '{print $3}'



    Tnx in advance ThW

    Comment

    • gsaudade
      Junior Member
      • Mar 2024
      • 2

      #3
      Hi ThW and nagylzs

      I'm having the same exact problem:

      python3 /etc/zabbix/scripts/sensors.py
      {
      "hwmon0-i350bb": {
      "temp1": {
      "crit": 110000,
      "input": 75000,
      "label": "loc1",
      "max": 120000,
      "sensor_type": "temp"
      }
      },
      ...

      root@srv-prox1-dc:~# tail -f /var/log/zabbix-agent/zabbix_agentd.log
      1211705:20240326:112757.298 TLS support: YES
      1211705:20240326:112757.298 **************************
      1211705:20240326:112757.298 using configuration file: /etc/zabbix/zabbix_agentd.conf
      1211705:20240326:112757.298 agent #0 started [main process]
      1211706:20240326:112757.298 agent #1 started [collector]
      1211707:20240326:112757.298 agent #2 started[listener #1]
      1211708:20240326:112757.299 agent #3 started[listener #2]
      1211709:20240326:112757.299 agent #4 started[listener #3]
      1211710:20240326:112757.299 agent #5 started [active checks #1]
      1211711:20240326:112757.299 agent #6 started [active checks #2]


      everything seems to work fine except that the template is not returning values.
      I also tried directly add the UserParameter directly into the /etc/zabbix/zabbix_agentd.conf with no success.

      Any suggestions? Could this be becouse the package im using to run the zabbix-agent is the one that comes with linstor/ceph installation?

      Thanks

      Comment

      • gsaudade
        Junior Member
        • Mar 2024
        • 2

        #4
        Hello again, I have managed to fix this. It was wrong permissions in my case:

        [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

        Comment

        Working...