Ad Widget

Collapse

Zabbix sender check

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madu
    Junior Member
    • Feb 2012
    • 6

    #1

    Zabbix sender check

    Hi there,
    i am using bash script like this:

    Code:
    for f in $FILES
    do
    	echo "sending file $f"
    	zabbix_sender -T -c /etc/zabbix/zabbix_agentd.conf -i $f
    done
    and i would like to ask you if there is any way how can i check if the file was really send via zabbix sender

    Martin
  • madu
    Junior Member
    • Feb 2012
    • 6

    #2
    no one knows?

    Comment

    • eskytthe
      Senior Member
      Zabbix Certified Specialist
      • May 2011
      • 363

      #3
      You can check the output msg from zabbix_sender. Think "Failed 0" can do it.
      /Erik

      Comment

      • madu
        Junior Member
        • Feb 2012
        • 6

        #4
        And how would you do that? I have tried something like this:
        Code:
        if [ failed > 0 ]; then...
        but it does not work to me. I would be really pleased if anyone of you can help me with this.

        Martin

        Comment

        • eskytthe
          Senior Member
          Zabbix Certified Specialist
          • May 2011
          • 363

          #5
          You will get something like this:
          Info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000011"
          sent: 1; skipped: 0; total: 1

          (The failed is per item - failed to send)

          You can scan this msg for "Failed 0" with sed or something else.
          "Failed 0" = all ok

          Comment

          • madu
            Junior Member
            • Feb 2012
            • 6

            #6
            Could you help me with this? I have no idea how can i scan info from server with sed. I found some examples but it was not much helpful.. It would be really kind of you.

            Comment

            • madu
              Junior Member
              • Feb 2012
              • 6

              #7
              Or is there any way how can i save the info from server into text file?

              Comment

              • madu
                Junior Member
                • Feb 2012
                • 6

                #8
                So i did it like this:
                Code:
                zabbix_sender -T -c /etc/zabbix/zabbix_agentd.conf -i $f > $SENDLOG	
                	if grep "Failed 0" "$SENDLOG"; then
                	echo OK
                	rm $f
                	else
                	echo KO!!
                	fi
                Thanks for help

                Comment

                Working...