Ad Widget

Collapse

Multiline text using zabbix_sender with input files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mastopj
    Junior Member
    • May 2009
    • 10

    #1

    Multiline text using zabbix_sender with input files

    Hello all,

    I'm having some trouble with getting zabbix_sender to send multiline text items from an input file. I'm getting the feeling that it is not supported, and if so, I'd like to know so I can stop putting an effort in it.

    Background: I prefer using 'zabbix_sender -T -i <file>' because all the items in that update will have the same timestamp, and can be stacked in a graph without looking hideous. In that same zabbix_sender run, I have the (multiline) output of a storage controller command which I'd like to save.

    What I'm basically trying is:

    Input file "file.dat":
    Code:
    STORAGEARRAY controller.output 1361199449 "line1
    line 2
    line 3"
    And I run:
    Code:
    [B]# zabbix_sender -vv -c zabbix_agentd.conf -T -i file.dat[/B]
    zabbix_sender [1339]: Warning: [line 1] 'Key value' required
    zabbix_sender [1339]: Warning: [line 2] 'Key' required
    zabbix_sender [1339]: Warning: [line 3] 'Key' required
    sent: 0; skipped: 3; total: 3
    You can also try using "-i -" and typing the lines on STDIN, but that yields the same "Warning: 'Key' required" after each <return>.

    What does work, however, is the following trick:

    Code:
    [B]# zabbix_sender -vv -c zabbix_agentd.conf -s STORAGEARRAY -k controller.output -o "line1 [I]<press enter>[/I]
    > line 2 [I]<press enter>[/I]
    > line 3" [I]<press enter>[/I]
    zabbix_sender [13252]: DEBUG: Answer [{
    	"response":"success",
    	"info":"Processed 1 Failed 0 Total 1 Seconds spent 0.000039"}]
    Info from server: "Processed 1 Failed 0 Total 1 Seconds spent 0.000039"
    sent: 1; skipped: 0; total: 1
    Any thoughts? Is the input file option just something that doesn't go with multiline items?
  • mastopj
    Junior Member
    • May 2009
    • 10

    #2
    Before I forget, using v1.8.5 on the client, v2.0.3 on the server.

    Will try to reproduce once I get the client updated.

    Comment

    • mastopj
      Junior Member
      • May 2009
      • 10

      #3
      Retried using 2.0.3 binary, same effect.

      Comment

      • mastopj
        Junior Member
        • May 2009
        • 10

        #4
        Looking at the code for zabbix_sender.c of v2.0.3 it appears that standard 'fgets' is used, and that the code does not take multiline key values into account. Can anyone from the developers side confirm this?

        If so, we might need to sumbit an RFE.

        Comment

        • marcel
          Senior Member
          Zabbix Certified Specialist
          • Oct 2010
          • 112

          #5
          mastopj, did you find a way to walk around this issue? did you hack the code?
          Zabbix Certified Specialist for Large Environments since 12/2010

          Comment

          • mastopj
            Junior Member
            • May 2009
            • 10

            #6
            No, I haven't allowed myself the time yet to modify the source. Plus, my C skills are a bit rusty. I'd like to leave that to proper devs.

            Comment

            • marcel
              Senior Member
              Zabbix Certified Specialist
              • Oct 2010
              • 112

              #7
              So are you waiting for this to be implemented? Is there a Jira ticket for this? Can you reference it here?
              Zabbix Certified Specialist for Large Environments since 12/2010

              Comment

              • mastopj
                Junior Member
                • May 2009
                • 10

                #8
                Well, sort of. I'm not in a hurry to get it fixed, but I admit I can't fix it myself. To be honest I couldn't find any other references so I figured I was one of the few who actually missed such a feature.

                I don't have a Jira ticket for it, could make one if you like. I'd be happy to host and execute patches.

                Comment

                • mastopj
                  Junior Member
                  • May 2009
                  • 10

                  #9
                  Ticket created:

                  Comment

                  Working...