Ad Widget

Collapse

UserParameter script not returning a value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • huent99
    Junior Member
    • Jan 2020
    • 1

    #1

    UserParameter script not returning a value

    The UserParameter script takes about 1 to 2 seconds to excute locally so I change the timeout to 10 seconds but it did not help.

    The script returns a null value [] which makes the item unsupported giving the error message: the Value "" of type "string" is not suitable for value type "Numeric (float)"

    Running the script locally returns a value of 35.0:

    root@pve:/var/log/zabbix-agent# smartctl -A -d megaraid,0 /dev/sda | grep 'Current Drive Temperature' | awk '{printf "%2.1f\n", $4}'
    35.0
    root@pve:/var/log/zabbix-agent#

    From the zabbix-agent log, the return value is null:

    25674:20191029:190530.373 Requested [cluster1.hdd1Temp]
    25674:20191029:190530.373 In zbx_popen() command:'smartctl -A -d megaraid,1 /dev/sda | grep 'Current Drive Temperature' | awk '{print $4}''
    25674:20191029:190530.374 End of zbx_popen():7
    26322:20191029:190530.374 zbx_popen(): executing script
    25674:20191029:190530.392 In zbx_waitpid()
    25674:20191029:190530.392 zbx_waitpid() exited, status:0
    25674:20191029:190530.392 End of zbx_waitpid():26322
    25674:20191029:190530.392 EXECUTE_STR() command:'smartctl -A -d megaraid,1 /dev/sda | grep 'Current Drive Temperature' | awk '{print $4}'' len:0 cmd_result:''
    25674:20191029:190530.392 Sending back []

    There is a second script on the same server which excutes in less than 1 second and it works fine, here is the log:

    25674:20191029:190531.401 Requested [cluster1.cpuTemperature]
    25674:20191029:190531.401 In zbx_popen() command:'sensors | tail -n 7 | head -n 6 | awk -F'[:+°]' '{avg+=$3}END{printf "%2.1f\n", avg/NR}''
    25674:20191029:190531.401 End of zbx_popen():7
    26326:20191029:190531.401 zbx_popen(): executing script
    25674:20191029:190531.406 In zbx_waitpid()
    25674:20191029:190531.406 zbx_waitpid() exited, status:0
    25674:20191029:190531.406 End of zbx_waitpid():26326
    25674:20191029:190531.406 EXECUTE_STR() command:'sensors | tail -n 7 | head -n 6 | awk -F'[:+°]' '{avg+=$3}END{printf "%2.1f\n", avg/NR}'' len:4 cmd_result:'40.2'
    25674:20191029:190531.406 Sending back [40.2]

    If you look at the time stamps in the first log, the zbx_popen() appears to be waiting about 19ms (394-373) so I am wondering is there another timer setting that controls this rather than the global Timeout setting?

    Thank you

  • gofree
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2017
    • 400

    #2
    just from curiosity try to run the command not as root but zabbix user or some other non-admin user - could be that zsabbix user dont have permission

    Comment

    Working...