Ad Widget

Collapse

Zabbix Sender

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

    #1

    Zabbix Sender

    From version 1.6 of Zabbix, zabbix_sender is changed, and it doesn't read config file from the command line anymore...

    We've got a whole bunch of plugins with hardcoded calls to zabbix_sender, and now we can't migrate them to zabbix agents 1.6.

    I've strace-ed zabbix_sender, and there is no open call for anything I put after -c parameter...

    Is this a bug?!

    Look at this:

    Code:
    # /usr/sbin/zabbix_sender -z myserver.mydomain.com -c /etc/zabbix/zabbix_agentd.conf -k mysql.bytesreceived -o 45940
    Info from server: "Processed 1 Failed 0 Total 1 Seconds spent 0.004097"
    sent: 1; skipped: 0; total: 1
    And this time without '-z':
    Code:
    # /usr/sbin/zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k mysql.bytesreceived -o 45940
    usage: zabbix_sender [-Vhv] {[-zpsI] -ko | [-zpI] -i <file>} [-c <file>]
    And now with strace, without '-z':
    Code:
    # strace /usr/sbin/zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k mysql.bytesreceived -o 45940 2>&1 | grep open | grep etc
    open("/etc/ld.so.cache", O_RDONLY)      = 3
    Why is zabbix_sender ignoring -c command line option?!?!
  • jsosic
    Member
    • Apr 2008
    • 47

    #2
    It's very interesting to note that if the sender iz called with both '-z' and '-c' options, it then opens config file....

    I'll try to write a patch.

    Comment

    • jsosic
      Member
      • Apr 2008
      • 47

      #3
      OK I've got it.
      Problem is that function that parses options from command line has wrong check... It only checks if ZABBIX_SERVER is on the command line ('-z' argument), and if it's not, it exits with error. That is not the correct behaviour because ZABBIX_SERVER can be stated in the config file too. Here is the patch:
      Code:
      --- src/zabbix_sender/zabbix_sender.c   2008-12-19 16:59:18.428357863 +0100
      +++ src/zabbix_sender/zabbix_sender.c   2008-12-19 17:07:56.309106954 +0100
      @@ -360,7 +360,7 @@
                                      break;
                      }   
       
      -       if(ZABBIX_SERVER == NULL)
      +       if((ZABBIX_SERVER == NULL) && (CONFIG_FILE == NULL))
              {   
                      usage();
                      exit(FAIL);
      I guess that this is not enough, and that Server=something parameter must be checked within the config file too. But this is enough for me and my organization, and I'm building the RPM's with this patch included.

      I hope that you fix this soon.

      Thank you.

      Comment

      • jsosic
        Member
        • Apr 2008
        • 47

        #4
        Alexei or somebody, are you interested that I write another patch for zabbix_sender, that checks for Server= directive in zabbix_agentd.conf ? Where can I apply patches except on this forums?

        Comment

        • Justin Freeman
          Junior Member
          • Jan 2009
          • 18

          #5
          Bump

          +1 *bump bump*

          Same problem in latest version 1.6.2.

          Actually I found that:
          zabbix_sender -z -k asterisk.status -o 0 -c /etc/zabbix/zabbix_agentd.conf

          Does not work - it still uses the -z parameter even if nothing is specified.

          Whereas:
          zabbix_sender -z zabbix.my.net -k asterisk.status -o 0 -c /etc/zabbix/zabbix_agentd.conf

          Does work, but is still not optimal - since it is overriding the configuration file option.
          Last edited by Justin Freeman; 27-01-2009, 13:02.

          Comment

          • jsosic
            Member
            • Apr 2008
            • 47

            #6
            I don't get it, I even wrote a patch and nobody cares

            Where's zabbix bugzilla, I'll try and open new ticket there...

            Comment

            • Justin Freeman
              Junior Member
              • Jan 2009
              • 18

              #7
              Zabbix Bugzilla

              Try registering the problem at https://support.zabbix.com

              Comment

              • jsosic
                Member
                • Apr 2008
                • 47

                #8
                Thank you very much. This one is registered as ZBX-677.

                Comment

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

                  #9
                  Hi

                  see my patch here.
                  And you should post your patch in that group, too. or use mine

                  It will allow to omit the now mandatory "-z ZABBIX-Server".
                  That's all you have to change.
                  Read the thread and you'll see my thoughts.

                  The patch was initially for 1.6 but works with 1.6.1 and should apply to 1.6.2, too.

                  Addition: Your patch is included in zabbix 1.6 R6679.

                  HTH,

                  Norbert.
                  Last edited by NOB; 10-02-2009, 10:45. Reason: Added: integration in R6679 was done

                  Comment

                  • jsosic
                    Member
                    • Apr 2008
                    • 47

                    #10
                    I've seen it, issue ZBX-677 is resolved...

                    Now I should write a patch for a zabbix_agentd that doesn't read all the config files from conf.d dir for some reason...

                    Comment

                    Working...