Ad Widget

Collapse

Try to get UserParameter to return a value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ting-sf
    Junior Member
    • Dec 2022
    • 5

    #1

    Try to get UserParameter to return a value

    Hi,

    I am trying to get UserParameter work, I have a host with zabbix agent2 installed, and few UserParameter set up working, but I can not get this one return any value, here is:

    UserParameter=disk1,smartctl -a /dev/sda | awk '/^(Elements).*:/ { print $3 }'

    if I run smartctl -a /dev/sda | awk '/^(Elements).*:/ { print $3 }', it will return a value I want, but somehow UserParameter does not return thsi value to zabbix, it show blank.

    anybody can help?

  • tikkami
    Member
    • May 2018
    • 71

    #2
    Agent is being run as "zabbix" user, that user might not have permissions to use smartctl.

    Comment

    • Ting-sf
      Junior Member
      • Dec 2022
      • 5

      #3
      Thanks for your reply.

      Yes, you are correct, I add sudo in the command line, it works

      UserParameter=disk1,sudo smartctl -a /dev/sda | awk '/^(Elements).*:/ { print $3 }'

      Comment

      Working...