Ad Widget

Collapse

UserParameter not returning expected

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Durwin
    Junior Member
    • Apr 2015
    • 19

    #1

    UserParameter not returning expected

    I am using zabbix-agent-2.2.8-1.fc21.x86_64. I added this line directly from the example into /etc/zabbix_agentd.conf. I just renamed key. I then restarted zabbix-agent.service.

    Code:
    UserParameter=dir.size[*],dir="$1"; du -s -B 1 "${dir:-/tmp}" | cut -f1
    I then ran zabbix_get.

    Code:
    zabbix_get -s 127.0.0.1 -p 10050 -k "dir.size[/home/userdir]"
    The value I get is 4096 which is the size of a directory structure. The 'du' command as supplied should return the size of the entire directory including all sub directories.

    Any help on this?

    Thank you,

    Durwin
  • Michel
    Junior Member
    • Apr 2015
    • 1

    #2
    Hi

    Have you sure Zabbix have good rights on directory ?

    If I try your UserParameter with this modification
    UserParameter=dir.size[*],dir="$1"; du -s -B 1 "${dir:-/tmp}" 2>/dev/null | cut -f1

    > zabbix_get -s 192.168.130.206 -k dir.size[/tmp]
    53248

    Really, with root a du -s -B 1 /tmp returns
    86016 /tmp

    The difference is the size of files that Zabbix cannot acceded.

    Hope that's help you.
    Regards

    Comment

    • Durwin
      Junior Member
      • Apr 2015
      • 19

      #3
      Solved

      Thank you for the reply. Shortly after I posted I recalled that zabbix runs as zabbixsrv. As soon as I set the SUID on 'du' all worked as expected.

      Comment

      Working...