Ad Widget

Collapse

packetloss

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mansourh12120
    Junior Member
    • Jun 2021
    • 10

    #1

    packetloss

    Hi to all!
    Does anyone have a script for Packet Loss in zabbix?
  • vitS
    Member
    • Apr 2021
    • 43

    #2
    Hi,

    For example:
    UserParameter=pLoss,ping -q -i 0.50 -n -s 50 -c5 IPaddress | grep "packet loss" | cut -d " " -f7 | cut -d "%" -f1

    Will be in result 0.0 -> Trigger more then 20 - Alarm

    Maybe it will help You,

    Thanks,

    Comment

    • mansourh12120
      Junior Member
      • Jun 2021
      • 10

      #3
      Thanks,but it doesn't work correctly!

      Comment

      • vitS
        Member
        • Apr 2021
        • 43

        #4
        What do You mean?

        [root@server /]# ping -q -i0.30 -n -s 50 -c5 ip | grep "packet loss" | cut -d " " -f7 | cut -d "%" -f1
        0.0

        Comment


        • mansourh12120
          mansourh12120 commented
          Editing a comment
          I run it but don't display any result.
      • vitS
        Member
        • Apr 2021
        • 43

        #5
        Hi,

        Just a question: did You replace ip with real ip in: [root@server /]# ping -q -i0.30 -n -s 50 -c5 ip | grep "packet loss" | cut -d " " -f7 | cut -d "%" -f1

        I mean:
        [root@server /]# ping -q -i0.30 -n -s 50 -c5 127.0.0.1 | grep "packet loss" | cut -d " " -f7 | cut -d "%" -f1

        Thanks,

        Comment


        • mansourh12120
          mansourh12120 commented
          Editing a comment
          yes yes i replace my ip with "IP"
      • vitS
        Member
        • Apr 2021
        • 43

        #6
        Try to play with these flags:

        Starting with simple ping:

        And then add flags by one:

        ping -q -i0.30 -n -s 50 -c5 127.0.0.1 | grep "packet loss"
        5 packets transmitted, 5 packets received, 0.0% packet loss

        Comment


        • mansourh12120
          mansourh12120 commented
          Editing a comment
          Thank you very much dear friend, the problem was solved.
      • mansourh12120
        Junior Member
        • Jun 2021
        • 10

        #7
        hello every body!
        i created a file in externalscript and wrote below script in it

        #!/bin/bash
        packetloss= 'ping -q -i0.30 -n -s 50 -c5 ${1} | grep "packet loss" | cut -d " " -f6 | cut -d "%" -f1
        [ -z "$ {packetloss}" ] && packetloss=100
        echo "${packetloss}"

        now i create an item with key packetloss(script file name) but i get this error" value of type "string" is not suitable for value type(float)".value "connect:invalid argument
        thanks

        Comment

        • cyber
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Dec 2006
          • 4807

          #8
          Why would you need a script, if there is a built in functionality?

          Comment

          Working...