Ad Widget

Collapse

ZBX_NOTSUPPORTED while work with -t

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • frankcheong
    Member
    • Oct 2009
    • 73

    #1

    ZBX_NOTSUPPORTED while work with -t

    I have written a script to obtain the max no of open files for a particular process and I can successfully collect the value by directly issuing the command in OS as well as testing the option with zabbix_agentd -t while it didn't work with zabbix_get as well as the web interface reported ZBX_NOTSUPPORTED. Please find below config that I used to obtain the open file limit for a particular user (e.g. apache).

    Code:
    UserParameter=OpenFileLimit[*],/usr/bin/sudo /opt/zabbix/etc/maxFileOpen.sh "$1"
    /opt/zabbix/etc/maxFileOpen.sh
    Code:
    #!/bin/bash
    
    /bin/cat /proc/`/bin/ps -u ${1} -opid | /usr/bin/tail -1 | awk '{print $1}'`/limits | /bin/awk '/Max open files/ {print $5}'
    Code:
    [root@server ~]# /opt/zabbix/etc/maxFileOpen.sh apache
    1024
    [root@server ~]# /usr/bin/sudo -u zabbix /usr/bin/sudo /opt/zabbix/etc/maxFileOpen.sh apache
    1024
    [root@server ~]# /opt/zabbix/etc/maxFileOpen.sh "apache"
    1024
    [root@server ~]# /usr/bin/sudo -u zabbix /usr/bin/sudo /opt/zabbix/etc/maxFileOpen.sh "apache"
    1024
    [root@server ~]# /opt/zabbix/sbin/zabbix_agentd -t 'OpenFileLimit[apache]'
    OpenFileLimit[apache]                    [t|1024]
    [root@server ~]# /opt/zabbix/bin/zabbix_get -s 127.0.0.1 -key OpenFileLimit[apache]
    ZBX_NOTSUPPORTED
    In the zabbix log, it simply complain with :-
    Code:
     21145:20120424:181052.529 Run remote command [/usr/bin/sudo /opt/zabbix/etc/maxFileOpen.sh "apache"] Result [0] []...
     21145:20120424:181052.529 Sending back [ZBX_NOTSUPPORTED]
     21143:20120424:181052.932 In update_cpustats()
     21143:20120424:181052.932 End of update_cpustats()
    I have no idea on what would possibly be the problem, but I truly suspect the problem actually is permission related and I think I can get around this problem by setting the Allow Root to 1 but this is really not an ideal solution. Actually the zabbix_agentd is running under an non-privileged account zabbix. Does anyone have any idea?

    The environment using is zabbix 1.8.9 under RHEL 5.3
  • JBo
    Senior Member
    • Jan 2011
    • 310

    #2
    Hi,

    I also think it is related to permissions.

    zabbix_agentd -t command is run as root but zabbix_get connects to zabbix_agent that is running as zabbix user.

    Are you sure that your sudo configuration is correct ?
    How have you configured /opt/zabbix/etc/maxFileOpen.sh in /etc/sudoers ?

    Regards,
    JBo

    Comment

    • frankcheong
      Member
      • Oct 2009
      • 73

      #3
      Ops, forgot to also put the sudoer file here:-

      Code:
      User_Alias MONITOR=zabbix
      MONITOR ALL=NOPASSWD: ALL

      Comment

      • frankcheong
        Member
        • Oct 2009
        • 73

        #4
        Finally I know what is happening.

        After upgrading to 1.8.12, the verbosity is much improved, I then located an error msg in the zabbix_agentd.log as below:-

        Code:
        sudo: sorry, you must have a tty to run sudo
        After searching thru the internet. I found that in sudoer, there is a line:-

        Code:
        Defaults    requiretty
        All I have to do is to remark this line

        Code:
        #Defaults    requiretty
        And then everything works perfectly.

        Comment

        Working...