Ad Widget

Collapse

UserParameter not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whitehat
    Junior Member
    • Feb 2010
    • 25

    #1

    UserParameter not working

    Hi!
    Added two UserParameter strings into zabbix_agentd.conf:
    Code:
    UserParameter=mdstat[*],grep -A1 $1 /proc/mdstat | grep -c UU                                                    
    UserParameter=smartd[*],/usr/bin/sudo /usr/sbin/smartctl -H /dev/$1|/bin/grep -c PASSED
    First string works great and returns real values,

    Code:
    52sh-3.2$ whoami 
    zabbix
    sh-3.2$ grep -A1 md0 /proc/mdstat | grep -c U
    1
    and in log
    Code:
    88:20100723:201620.808 Requested [mdstat[md0]]
      5288:20100723:201620.814 Run remote command [grep -A1 md0 /proc/mdstat | grep -c U] Result [1] [1]...
    but the second always returns "0"
    Code:
    sh-3.2$ /usr/bin/sudo /usr/sbin/smartctl -H /dev/sda|/bin/grep -c PASSED
    1
    but in log
    Code:
     5288:20100723:201846.891 Requested [smartd[sda]]
      5288:20100723:201846.898 Run remote command [/usr/bin/sudo /usr/sbin/smartctl -H /dev/sda|/bin/grep -c PASSED] Result [1] [0]...
    Why? (the second value should be 1)
  • Wonderer
    Member
    Zabbix Certified Specialist
    • May 2010
    • 53

    #2
    UserParameter commands are run with zabbix user permissions.
    Are you sure that sudo has proper rights set for the zabbix user?

    Try to log as zabbix user, and then run you command.

    Comment

    • whitehat
      Junior Member
      • Feb 2010
      • 25

      #3
      Originally posted by Wonderer
      UserParameter commands are run with zabbix user permissions.
      Are you sure that sudo has proper rights set for the zabbix user?

      Try to log as zabbix user, and then run you command.
      Hi. I've already done so, as you can see from my first post. Zabbix is in the sudoers without password...

      Comment

      • whitehat
        Junior Member
        • Feb 2010
        • 25

        #4
        solved

        The problem was with "sudo" command:
        You must add string:
        Defaults:zabbix !requiretty
        with visudo

        Comment

        Working...