Ad Widget

Collapse

zabbix_sender patch + zabbix_agentd.conf bug?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jsosic
    Member
    • Apr 2008
    • 47

    #1

    zabbix_sender patch + zabbix_agentd.conf bug?

    OK, I've posted on other two subforums, but I thing the developers read this one... so here it goes.

    My first problem was with zabbix_sender version 1.6, which has changed behaviour from 1.4 version. If you put '-c' on the command line, configuration is not read, and zabbix_sender exits with standard help greeter. If I put both '-z' and '-c', then configuration is read. But I don't want to specify the server (-z) on the command line, because it's already in the config file... Why would I then need the -c? So, here is the description and the patch that can be applied to version 1.6.1 of the zabbix_sender:



    So, this one is solved, but I would like you to accept the patch.



    Next is the problem with the agentd, and the configuration directive "Include". I've put the following code at the end of my zabbix_agentd.conf:
    Code:
    ####### INCLUDE CONFIGURATIONS #######
    Include=/etc/zabbix/agent-conf.d
    Problem is that for some of my UserParameteres in the config files in that directory, zabbix_agentd reports ZBX_NOTSUPPORTED. If I copy the exact same lines to the bottom of zabbix_agentd.conf, then it works perfectly. On the other hand, there are some UserParameters that just work (TM). I don't have the time to debug the zabbix_agentd too, strace shows that the config files from within agent-conf.d directory are opened and read... so I wonder if maybe Alexei you know something about this one?

    Here is the explanation and more information:
  • jsosic
    Member
    • Apr 2008
    • 47

    #2
    Come on guys, zero replies in 3 thread in almost a week

    Comment

    • jsosic
      Member
      • Apr 2008
      • 47

      #3
      Alexei, have read this? Please post anything...

      Comment

      • jsosic
        Member
        • Apr 2008
        • 47

        #4
        OK... Because nobody cares, and I'm the one assigned to maintaing RPM packages for agentd, and some other stuff, I found a bug and wrote a patch myself...
        So here the story goes. File src/libs/zbxconf/cfg.c has this define:
        Code:
        #define ZBX_MAX_INCLUDE_LEVEL 10
        I don't know what is the scope of this define, and is there any problem if the define is higher than 10, but when it is 10, then I have problems with reading lots of configuration files from Include directory. Here are the logs:
        Code:
         12148:20090211:204923 Pas jebo mater: loaded config file: '/etc/zabbix/zabbix_agentd.conf'
         12148:20090211:204923 Pas jebo mater: some level limit je 10? : '6'
         12148:20090211:204923 Pas jebo mater: loaded config file:
        '/etc/zabbix/agent-conf.d'
         12148:20090211:204923 Pas jebo mater: parsed config file: '¹A'
         12148:20090211:204923 Pas jebo mater: loaded config file:
        '/etc/zabbix/agent-conf.d/rpc.conf'
         12148:20090211:204923 Pas jebo mater: some level limit je 10? : '7'
         12148:20090211:204923 Accepted configuration parameter: 'UserParameter'
        = 'rpc.all,/usr/libexec/zabbix-agentd/rpc.pl'
         12148:20090211:204923 Pas jebo mater: loaded config file:
        '/etc/zabbix/agent-conf.d/postfix.conf'
         12148:20090211:204923 Pas jebo mater: some level limit is 10? : '8'
         12148:20090211:204923 Accepted configuration parameter: 'UserParameter'
        = 'postfix.all,/usr/bin/sudo /usr/libexec/zabbix_agentd/postfix.pl'
         12148:20090211:204923 Pas jebo mater: loaded config file:
        '/etc/zabbix/agent-conf.d/sshd.conf'
         12148:20090211:204923 Pas jebo mater: some level limit is 10? : '9'
         12148:20090211:204923 Accepted configuration parameter: 'UserParameter'
        = 'sshd.openconnections,/usr/bin/sudo /usr/sbin/lsof -i -n -l -P |
        /bin/egrep -c 'sshd.*ESTABLISHED''
         12148:20090211:204923 Pas jebo mater: loaded config file:
        '/etc/zabbix/agent-conf.d/ntpd.conf'
         12148:20090211:204923 Pas jebo mater: some level limit is 10? : '10'
         12148:20090211:204923 Pas jebo mater: level limit exceeded : '11'
         12148:20090211:204923 Pas jebo mater: loaded config file:
        '/etc/zabbix/agent-conf.d/mysql.conf'
         12148:20090211:204923 Pas jebo mater: some level limit is 10? : '11'
         12148:20090211:204923 Pas jebo mater: level limit exceeded : '12'
        I've added few additions to log stuff I need. 'Pas jebo mater' is Croatian phrase, which I've added for easy grepping.

        Now what happens? Variable static int level, defined in parse_cfg_file function grows and grows and grows, and it touches level 10 pretty fast. After that, all loaded files are ignored. That's why strace shows that zabbix loads files without problem, but it doesn't interpret them as it should. If I rise this define:
        Code:
        #define ZBX_MAX_INCLUDE_LEVEL 110
        , this is what happens:
        Code:
         12060:20090211:204852 Pas jebo mater: loaded config file: '/etc/zabbix/zabbix_agentd.conf'
         12060:20090211:204852 Pas jebo mater: neki level limit je 10? : '6'
         12060:20090211:204852 Pas jebo mater: loaded config file: '/etc/zabbix/agent-conf.d'
         12060:20090211:204852 Pas jebo mater: parsed config file: '¹A'
         12060:20090211:204852 Pas jebo mater: loaded config file: '/etc/zabbix/agent-conf.d/rpc.conf'
         12060:20090211:204852 Pas jebo mater: neki level limit je 10? : '7'
         12060:20090211:204852 Accepted configuration parameter: 'UserParameter' = 'rpc.all,/usr/libexec/zabbix-agentd/rpc.pl'
         12060:20090211:204852 Pas jebo mater: loaded config file: '/etc/zabbix/agent-conf.d/postfix.conf'
         12060:20090211:204852 Pas jebo mater: neki level limit je 10? : '8'
         12060:20090211:204852 Accepted configuration parameter: 'UserParameter' = 'postfix.all,/usr/bin/sudo /usr/libexec/zabbix_agentd/postfix.pl'
         12060:20090211:204852 Pas jebo mater: loaded config file: '/etc/zabbix/agent-conf.d/sshd.conf'
         12060:20090211:204852 Pas jebo mater: neki level limit je 10? : '9'
         12060:20090211:204852 Accepted configuration parameter: 'UserParameter' = 'sshd.openconnections,/usr/bin/sudo /usr/sbin/lsof -i -n -l -P | /bin/egrep -c 'sshd.*ESTABLISHED''
         12060:20090211:204852 Pas jebo mater: loaded config file: '/etc/zabbix/agent-conf.d/ntpd.conf'
         12060:20090211:204852 Pas jebo mater: neki level limit je 10? : '10'
         12060:20090211:204852 Accepted configuration parameter: 'UserParameter' = 'ntp.offset,/usr/sbin/ntpq -pn | /usr/bin/gawk 'BEGIN { offset=1000 } $1 ~ /\*/ { offset=$9 } END { print offset }''
         12060:20090211:204852 Accepted configuration parameter: 'UserParameter' = 'ntp.jitter,/usr/sbin/ntpq -pn | /usr/bin/gawk 'BEGIN { offset=1000 } $1 ~ /\*/ { offset=$10 } END { print offset }''
         12060:20090211:204852 Accepted configuration parameter: 'UserParameter' = 'ntp.delay,/usr/sbin/ntpq -pn | /usr/bin/gawk 'BEGIN { offset=1000 } $1 ~ /\*/ { offset=$8 } END { print offset }''
         12060:20090211:204852 Pas jebo mater: loaded config file: '/etc/zabbix/agent-conf.d/mysql.conf'
         12060:20090211:204852 Pas jebo mater: neki level limit je 10? : '11'
         12060:20090211:204852 Accepted configuration parameter: 'UserParameter' = 'mysql.all,/usr/libexec/zabbix-agentd/mysql.sh'
        Note the number of Accepted configuration parameters, which is now higher. So, I propose the Zabbix team to resolve this issue by rising the zabbix_agent limit to 110, which would be OK for the most of the people. Also, it should be documented then that the limit is 100 included conf files or something.

        I will open bug with this explanations and will put the ZBX-### here afterwards.

        Comment

        • jsosic
          Member
          • Apr 2008
          • 47

          #5
          OK here it is: ZBX-699

          Comment

          • NOB
            Senior Member
            Zabbix Certified Specialist
            • Mar 2007
            • 469

            #6
            Hi

            for me it looks like this is a limit to protect against circular includes.
            Simplest case: One include file includes itself !

            Just raising it to any imaginable number seems to be the wrong fix.
            I guess the real reason is in the code implementing this protection.

            Your patch will solve your problem now, however.

            Regards,

            Norbert.

            Comment

            Working...