Ad Widget

Collapse

Zabbix sender messy output

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

    #1

    Zabbix sender messy output

    Hi,

    I've observed some scewed behaviour of zabbix_sender in versions 2.0+.

    In previous version (1.8), I could normaly pipe output of zabbix_sender, but not after upgrade to 2.0.

    Here are the examples:

    Code:
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14
    info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000017"
    sent: 1; skipped: 0; total: 1
    Code:
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 | head -1
    sent: 1; skipped: 0; total: 1
    And again:

    Code:
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 | grep -v pero
    sent: 1; skipped: 0; total: 1
    
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 | sed 's/foo/bar/'
    sent: 1; skipped: 0; total: 1
    
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 | tee
    sent: 1; skipped: 0; total: 1
    And now piping:
    Code:
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 2>&1 | tee
    sent: 1; skipped: 0; total: 1

    OK, so what's up with this? strace shows the following:

    Code:
    ...
    ...
    munmap(0x7f3079add000, 4096)            = 0
    clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f3079ad49d0) = 13637
    wait4(13637, info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000023"
    [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 13637
    --- SIGCHLD (Child exited) @ 0 (0) ---
    fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3079add000
    write(1, "sent: 1; skipped: 0; total: 1\n", 30sent: 1; skipped: 0; total: 1
    ) = 30
    exit_group(0)                           = ?

    Is this a bug, or what?!
  • neogan
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2011
    • 118

    #2
    Originally posted by jsosic
    Hi,

    I've observed some scewed behaviour of zabbix_sender in versions 2.0+.

    In previous version (1.8), I could normaly pipe output of zabbix_sender, but not after upgrade to 2.0.

    Here are the examples:

    Code:
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14
    info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000017"
    sent: 1; skipped: 0; total: 1
    Code:
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 | head -1
    sent: 1; skipped: 0; total: 1
    And again:

    Code:
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 | grep -v pero
    sent: 1; skipped: 0; total: 1
    
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 | sed 's/foo/bar/'
    sent: 1; skipped: 0; total: 1
    
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 | tee
    sent: 1; skipped: 0; total: 1
    And now piping:
    Code:
    # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 2>&1 | tee
    sent: 1; skipped: 0; total: 1

    OK, so what's up with this? strace shows the following:

    Code:
    ...
    ...
    munmap(0x7f3079add000, 4096)            = 0
    clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f3079ad49d0) = 13637
    wait4(13637, info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000023"
    [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 13637
    --- SIGCHLD (Child exited) @ 0 (0) ---
    fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3079add000
    write(1, "sent: 1; skipped: 0; total: 1\n", 30sent: 1; skipped: 0; total: 1
    ) = 30
    exit_group(0)                           = ?

    Is this a bug, or what?!
    Registred already ZBX-6285.
    but another environment.

    Comment

    • vintagegamingsystems
      Member
      • Jun 2013
      • 57

      #3
      Efficient logging of zabbix_sender command is impossible

      There doesn't seem to be any way to pipe or redirect the command without standard output. I can't efficiently log the output of the command due to this problem. I may look at the code and see what is wrong with this.

      Comment

      • steveboyson
        Senior Member
        • Jul 2013
        • 582

        #4
        I noticed this as well.
        In our perl scripts where we rely on the FULL output of zabbix-sender, we are using IPC::Run.

        Found here:
        http://stackoverflow.com/questions/1...perl-open-pipe

        Comment

        Working...