Ad Widget

Collapse

Packet loss monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MartinZapa
    Junior Member
    • Jul 2007
    • 16

    #1

    Packet loss monitoring

    Dear forum,
    please is possible monitoring link packet loss?
    Thank you.
    Best regards,
    Martin
  • gescheit
    Senior Member
    • Jul 2007
    • 156

    #2
    ping -q -n -c 10 192.168.0.2 | grep "packet loss" | cut -d " " -f 6 | cut -d "%" -f1

    Use as external check. This string return packet loss .

    Comment

    • MartinZapa
      Junior Member
      • Jul 2007
      • 16

      #3
      Dear Gescheit,
      thank you for quick answer and neat solution.
      Best Regards,
      Martin

      Comment

      • MartinZapa
        Junior Member
        • Jul 2007
        • 16

        #4
        Dear Gescheit,
        I was tried write script withh your string for external checks.
        packetloss.sh :

        #!/bin/bash

        pl=`/bin/ping -q -n -c 10 $1 | /bin/grep "packet loss" | /usr/bin/cut -d " " -f 6 | /usr/bin/cut -d "%" -f1`
        echo $pl

        My key in item ICMP-PL External check is : packetloss.sh (192.168.200.165)
        After pres save button zabbix say : * Incorrect key format key_name[param1,param2,...]'

        When I tried in key field type packetloss.sh [192.168.200.165] in log is :

        Parameter [packetloss.sh[192.168.200.165]] is not supported by agent on host [Martin-Test] Old status [0]

        Also if I copy your plane string to script pl.sh and key is : pl.sh have in log:

        Parameter [pl.sh] is not supported by agent on host [Martin-Test] Old status [0]

        My zabbix version is: ZABBIX Server (daemon) v1.4.1 (29 June 2007)
        In /zabbix_server.conf I have : ExternalScripts=/etc/zabbix/externalscripts
        /etc/zabbix/externalscripts is owned by zabbix:zabbix,scripts have 4750
        and are also owned by zabbix:zabbix

        Please help me if you can. This function is verry important for me.

        Best regards,
        Martin

        Comment

        • gescheit
          Senior Member
          • Jul 2007
          • 156

          #5
          Little upgraded script:
          #!/bin/bash
          IP=`mysql -b -D zabbix -u zabbix -ppass -e "SELECT ip FROM hosts WHERE host='$1' LIMIT 1" | cut -f 2 | grep -v ip`
          ping -q -A -c 10 $IP | grep "packet loss" | cut -d " " -f 6 | cut -d "%" -f1 2>/dev/null

          and in zabbix key like: packetloss.sh()

          MySQL query need because zabbix passes _host name_ instead of IP or dns.
          I do not know why so and would be happy if the developers are correct this.

          Comment

          • MartinZapa
            Junior Member
            • Jul 2007
            • 16

            #6
            Dear Gescheit,
            thank you for script upgrade,but I have always similar problem.
            When I trying make new item for host and type as key
            packetloss.sh() zabbix say after press save : * Incorrect key format 'key_name[param1,param2,...]'
            When I type packetloss.sh[] always have in log Parameter [packetloss.sh[]] is not supported by agent on host [Martin-Test] Old status [0]
            For more accurately informations I have not running agent on server even host side.
            Thanks for any help.

            Best regards,
            Martin

            Comment

            • gescheit
              Senior Member
              • Jul 2007
              • 156

              #7
              This is a bug in web interface on zabbix 1.4.1.
              Zabbix_server 1.4.1 understands keys like (), but in web interface keys with () do not pass. I solved the problem using zabbix_server 1.4.1 and web interface from zabbix 1.4.0.

              Comment

              • MartinZapa
                Junior Member
                • Jul 2007
                • 16

                #8
                Dear Gescheit,
                I thank you verry much for your help and time.
                It works just perfectly!
                Only I has had to insert -w 4 parameter for ping because if line is down timeout was to long and in log zabbix said: Timeout while answering request.

                Best regards,
                Martin
                Last edited by MartinZapa; 25-07-2007, 11:34.

                Comment

                • holtet
                  Junior Member
                  • Aug 2007
                  • 9

                  #9
                  Originally posted by gescheit
                  This is a bug in web interface on zabbix 1.4.1.
                  Zabbix_server 1.4.1 understands keys like (), but in web interface keys with () do not pass. I solved the problem using zabbix_server 1.4.1 and web interface from zabbix 1.4.0.
                  You can also solve it by entering the key with [] in web interface and change it to () directly in the database. You probably have to set it back to "activated" and remove the "error" entry also, at least that happened to me.

                  Comment

                  • mujzeptu
                    Junior Member
                    • Mar 2008
                    • 1

                    #10
                    edit:::EDIT::::edit
                    Last edited by mujzeptu; 18-07-2014, 04:52.

                    Comment

                    • holtet
                      Junior Member
                      • Aug 2007
                      • 9

                      #11
                      Actually, I found a better solution to this problem. Change the following file:

                      <zabbix web path>/htdocs/include/defines.inc.php

                      Line 391:

                      From:
                      define('ZBX_EREG_ITEM_KEY_FORMAT', '('.ZBX_EREG_INTERNAL_NAMES.'(\['.ZBX_EREG_PARAMS.'\]){0,1})');

                      To:
                      define('ZBX_EREG_ITEM_KEY_FORMAT', '('.ZBX_EREG_INTERNAL_NAMES.'(\('.ZBX_EREG_PARAMS. '\)){0,1})');


                      Then the web interface will accept correct entries.

                      In database you would do something like this for each key (my example key is sip_regs_sum):

                      use zabbix;
                      update items set key_='sip_regs_sum()' where key_='sip_regs_sum[]' limit 1;

                      Comment

                      • fableman
                        Member
                        • Oct 2007
                        • 78

                        #12
                        to send 10 pings each of 48byte don't say much about packetloss in reality

                        add this.

                        ping -q -i0.30 -n -s30000 -c 10 192.168.9.1



                        will then send 10 ping of 30000 bytes each every 30ms then you generate some load to trigger packetloss to happen.

                        if you doing this to an internet site it wont work then you have to send around 1000 max else firewalls and other stuff will block the too big icmp.

                        good luck.

                        Comment

                        • oneye
                          Junior Member
                          • May 2008
                          • 27

                          #13
                          Hello,
                          I'm still having problems with monitoring packet loss. I have made a shell script like "gescheit" recommended.
                          It has read & execute rights by others and it looks like this:

                          #!/bin/bash
                          IP=`mysql -b -D zabbix -u zabbix -pzabbix -e "SELECT ip FROM hosts WHERE host='$1' LIMIT 1" | cut -f 2 | grep -v ip`
                          ping -q -A -c 10 $IP | grep "packet loss" | cut -d " " -f 6 | cut -d "%" -f1 2>/dev/null


                          I have tryed executing the script in command line and it worked: ncs:/etc/zabbix/externalscripts# ./packetloss "test"
                          0


                          Then I changed the line 404 in my defines.inc.php like "holtet" recommended.
                          From:
                          define('ZBX_EREG_ITEM_KEY_FORMAT', '('.ZBX_EREG_KEY_NAME.'(\['.ZBX_EREG_PARAMS.'\]){0,1})');
                          to:
                          define('ZBX_EREG_ITEM_KEY_FORMAT', '('.ZBX_EREG_KEY_NAME.'(\('.ZBX_EREG_PARAMS.'\)){0 ,1})');
                          I even checked the database and my key_ in items looks like this: "packetloss(test)".

                          So I have a host "test" and I put in an Item with type "external check" and the key looks like "packetloss(test)" and I still get the problem:
                          Parameter [packetloss(test)] is not supported by agent on host [test] Old status [0]

                          Any ideas? Am I doing somthing wrong? Please give me some advice. This is very important to me.

                          thank you
                          Last edited by oneye; 08-05-2008, 10:26.

                          Comment

                          • fableman
                            Member
                            • Oct 2007
                            • 78

                            #14
                            what is your zabbix version ?
                            I suggest you upgrade to latest stabiel version then I can make a script for ya without the mysql parts.

                            Comment

                            • oneye
                              Junior Member
                              • May 2008
                              • 27

                              #15
                              Hi fableman,

                              I use Zabbix ver. 1.4.5. This is the latest stable version.

                              P.S.: although I do not know where to check the version of the Zabbix frontend.

                              Thanks & best regards,

                              oneye

                              Comment

                              Working...