Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-22012

agent2 plugin running delay

    XMLWordPrintable

Details

    • Problem report
    • Status: Closed
    • Trivial
    • Resolution: Won't fix
    • 6.0.10
    • None
    • None
    • None

    Description

      Steps to reproduce:

      I create a agent2 plugin. the function is to execute fping, obtain the result of fping, and execute it every 5 seconds. When my parameter IP is reachable, there is no problem with the data obtained, but when the IP is unreachable, there will be a cycle (5s) Delay

       

      // code placeholder
      
      package icmpimport (
          "encoding/json"
          "fmt"
          "regexp"
          "time"    "zabbix.com/pkg/zbxcmd"
      )const Timeout = 30func FilterLossOrLatency(pingResult string) (result interface{}, err error) {    re := regexp.MustCompile(`[-]?\d[\d,]*[\.]?[\d{2}]*`)    resultFping := re.FindAllString(pingResult, -1)    filterResult := make(map[string]string)    if resultFping[len(resultFping)-1] == "100" && len(resultFping) < 6 {
              filterResult["lossrate"] = resultFping[4]
              filterResult["latency"] = "1000"    } else {
              filterResult["lossrate"] = resultFping[4]
              filterResult["latency"] = resultFping[6]
          }
          return filterResult, nil
      }func ICMPCheck(host string) (result interface{}, err error) {    c := make(map[string](chan interface{}))
          // for _, host := range params {
          // c[host] = make(chan interface{})
          // go ICMPping(host, c[host])
          // }    c["host"] = make(chan interface{})
          go ICMPping(host, c["host"])
          m := make(map[string]interface{}, 0)
          for ind, ch := range c {
              m[ind] = <-ch
          }
          jsonRes, err := json.Marshal(m)    if err != nil {
              return nil, fmt.Errorf("%s (%s)", err.Error(), "Cannot marshal JSON")
          }    return string(jsonRes), nil
      }func ICMPping(host string, c chan interface{}) {
          s := "/usr/sbin/fping -q -b 2000 -c 5  -i 1000 " + host
          stdoutStderr, _ := zbxcmd.Execute(s, time.Second*time.Duration(Timeout), "")
          result, _ := FilterLossOrLatency(stdoutStderr)
          c <- result
      }

       

       

      Debug Result:

      normal:

      // code placeholder
      2022/12/01 19:36:06.352556 received passive check request: 'network.cas.ping[172.16.250.83,class]' from '172.16.250.17'
      2022/12/01 19:36:06.353080 [1] processing update request (1 requests)
      2022/12/01 19:36:06.353140 [1] adding new request for key: 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:06.353181 [1] created direct exporter task for plugin 'Icmp' itemid:0 key 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:06.353327 executing direct exporter task for key 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:10.364825 executed direct exporter task for key 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:10.364923 sending passive check response: '{"latency":"0.67","lossrate":"0"}' to '172.16.250.17'
      2022/12/01 19:36:11.087799 received passive check request: 'network.cas.ping[172.16.250.83,class]' from '172.16.250.17'
      2022/12/01 19:36:11.087923 [1] processing update request (1 requests)
      2022/12/01 19:36:11.087959 [1] adding new request for key: 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:11.087982 [1] created direct exporter task for plugin 'Icmp' itemid:0 key 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:11.088058 executing direct exporter task for key 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:12.000888 executing exporter task for itemid:1662492 key 'disk.on.linux'
      2022/12/01 19:36:12.001171 executed exporter task for itemid:1662492 key 'disk.on.linux'
      2022/12/01 19:36:12.672319 [101] upload history data, 1/100 value(s)
      2022/12/01 19:36:13.214964 received passive check request: 'net.if.discovery' from '172.16.250.17'
      2022/12/01 19:36:13.215390 [1] processing update request (1 requests)
      2022/12/01 19:36:13.215615 [1] adding new request for key: 'net.if.discovery'
      2022/12/01 19:36:13.215848 [1] created direct exporter task for plugin 'NetIf' itemid:0 key 'net.if.discovery'
      2022/12/01 19:36:13.216102 executing direct exporter task for key 'net.if.discovery'
      2022/12/01 19:36:13.216445 executed direct exporter task for key 'net.if.discovery'
      2022/12/01 19:36:13.216645 sending passive check response: '[{"{#IFNAME}":"lo"},{"{#IFNAME}":"eth0"}]' to '172.16.250.17'
      2022/12/01 19:36:14.001796 executing exporter task for itemid:1662494 key 'vfs.fs.discovery'
      2022/12/01 19:36:14.002309 executed exporter task for itemid:1662494 key 'vfs.fs.discovery'
      2022/12/01 19:36:15.098100 executed direct exporter task for key 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:15.098461 sending passive check response: '{"latency":"0.67","lossrate":"0"}' to '172.16.250.17'
      2022/12/01 19:36:16.472267 received passive check request: 'network.cas.ping[172.16.250.83,class]' from '172.16.250.17'
      2022/12/01 19:36:16.472372 [1] processing update request (1 requests)
      2022/12/01 19:36:16.472434 [1] adding new request for key: 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:16.472458 [1] created direct exporter task for plugin 'Icmp' itemid:0 key 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:16.472551 executing direct exporter task for key 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:18.672273 [101] upload history data, 1/100 value(s)
      2022/12/01 19:36:20.482603 executed direct exporter task for key 'network.cas.ping[172.16.250.83,class]'
      2022/12/01 19:36:20.482850 sending passive check response: '{"latency":"0.62","lossrate":"0"}' to '172.16.250.17' 

      abnormal:

      // code placeholder
      2022/12/01 19:40:11.052986 received passive check request: 'network.cas.ping[172.16.250.89,class]' from '172.16.250.17'                                                                     2022/12/01 19:40:11.053355 [1] processing update request (1 requests)                                                                                                                       2022/12/01 19:40:11.053430 [1] adding new request for key: 'network.cas.ping[172.16.250.89,class]'                                                                                          2022/12/01 19:40:11.053467 [1] created direct exporter task for plugin 'Icmp' itemid:0 key 'network.cas.ping[172.16.250.89,class]'                                                          2022/12/01 19:40:11.053581 executing direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                   2022/12/01 19:40:12.000822 executing exporter task for itemid:1662492 key 'disk.on.linux'                                                                                                   2022/12/01 19:40:12.001033 executed exporter task for itemid:1662492 key 'disk.on.linux'                                                                                                    2022/12/01 19:40:13.219557 received passive check request: 'net.if.discovery' from '172.16.250.17'                                                                                          2022/12/01 19:40:13.219979 [1] processing update request (1 requests)                                                                                                                       2022/12/01 19:40:13.220031 [1] adding new request for key: 'net.if.discovery'                                                                                                               2022/12/01 19:40:13.220048 [1] created direct exporter task for plugin 'NetIf' itemid:0 key 'net.if.discovery'                                                                              2022/12/01 19:40:13.220123 executing direct exporter task for key 'net.if.discovery'                                                                                                        2022/12/01 19:40:13.220276 executed direct exporter task for key 'net.if.discovery'                                                                                                         2022/12/01 19:40:13.220337 sending passive check response: '[{"{#IFNAME}":"lo"},{"{#IFNAME}":"eth0"}]' to '172.16.250.17'                                                                   2022/12/01 19:40:14.001584 executing exporter task for itemid:1662494 key 'vfs.fs.discovery'                                                                                                2022/12/01 19:40:14.002796 executed exporter task for itemid:1662494 key 'vfs.fs.discovery'                                                                                                 2022/12/01 19:40:17.067048 executed direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                    2022/12/01 19:40:17.067144 sending passive check response: '{"latency":"1000","lossrate":"100"}' to '172.16.250.17'                                                                         2022/12/01 19:40:17.672327 [101] upload history data, 2/100 value(s)                                                                                                                        2022/12/01 19:40:21.112848 received passive check request: 'network.cas.ping[172.16.250.89,class]' from '172.16.250.17'                                                                     2022/12/01 19:40:21.112950 [1] processing update request (1 requests)                                                                                                                       2022/12/01 19:40:21.112988 [1] adding new request for key: 'network.cas.ping[172.16.250.89,class]'                                                                                          2022/12/01 19:40:21.113013 [1] created direct exporter task for plugin 'Icmp' itemid:0 key 'network.cas.ping[172.16.250.89,class]'                                                          2022/12/01 19:40:21.113080 executing direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                   2022/12/01 19:40:27.123546 executed direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                    2022/12/01 19:40:27.123883 sending passive check response: '{"latency":"1000","lossrate":"100"}' to '172.16.250.17'                                                                         2022/12/01 19:40:31.158627 received passive check request: 'network.cas.ping[172.16.250.89,class]' from '172.16.250.17'                                                                     2022/12/01 19:40:31.158895 [1] processing update request (1 requests)                                                                                                                       2022/12/01 19:40:31.158962 [1] adding new request for key: 'network.cas.ping[172.16.250.89,class]'                                                                                          2022/12/01 19:40:31.158980 [1] created direct exporter task for plugin 'Icmp' itemid:0 key 'network.cas.ping[172.16.250.89,class]'                                                          2022/12/01 19:40:31.159079 executing direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                   2022/12/01 19:40:36.001226 executing exporter task for itemid:1975056 key 'disk.on.linux.io'                                                                                                2022/12/01 19:40:36.002006 executed exporter task for itemid:1975056 key 'disk.on.linux.io'                                                                                                 2022/12/01 19:40:37.170606 executed direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                    2022/12/01 19:40:37.170804 sending passive check response: '{"latency":"1000","lossrate":"100"}' to '172.16.250.17'                                                                         2022/12/01 19:40:39.672250 [101] upload history data, 1/100 value(s)                                                                                                                        2022/12/01 19:40:41.088191 received passive check request: 'network.cas.ping[172.16.250.89,class]' from '172.16.250.17'                                                                     2022/12/01 19:40:41.088460 [1] processing update request (1 requests)                                                                                                                       2022/12/01 19:40:41.088562 [1] adding new request for key: 'network.cas.ping[172.16.250.89,class]'                                                                                          2022/12/01 19:40:41.088637 [1] created direct exporter task for plugin 'Icmp' itemid:0 key 'network.cas.ping[172.16.250.89,class]'                                                          2022/12/01 19:40:41.088923 executing direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                   2022/12/01 19:40:45.672341 [101] In refreshActiveChecks() from [172.16.250.17:31351 172.16.250.18:31351]                                                                                    2022/12/01 19:40:45.685266 [101] End of refreshActiveChecks() from [172.16.250.17:31351 172.16.250.18:31351]                                                                                2022/12/01 19:40:45.685424 [101] processing update request (3 requests)                                                                                                                     2022/12/01 19:40:45.685487 [101] adding new request for key: 'disk.on.linux'                                                                                                                2022/12/01 19:40:45.685575 [101] adding new request for key: 'disk.on.linux.io'                                                                                                             2022/12/01 19:40:45.685641 [101] adding new request for key: 'vfs.fs.discovery'                                                                                                             2022/12/01 19:40:47.100356 executed direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                    2022/12/01 19:40:47.100548 sending passive check response: '{"latency":"1000","lossrate":"100"}' to '172.16.250.17'                                                                         2022/12/01 19:40:51.203461 received passive check request: 'network.cas.ping[172.16.250.89,class]' from '172.16.250.17'                                                                     2022/12/01 19:40:51.203566 [1] processing update request (1 requests)                                                                                                                       2022/12/01 19:40:51.203596 [1] adding new request for key: 'network.cas.ping[172.16.250.89,class]'                                                                                          2022/12/01 19:40:51.203618 [1] created direct exporter task for plugin 'Icmp' itemid:0 key 'network.cas.ping[172.16.250.89,class]'                                                          2022/12/01 19:40:51.203681 executing direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                   2022/12/01 19:40:57.215216 executed direct exporter task for key 'network.cas.ping[172.16.250.89,class]'                                                                                    2022/12/01 19:40:57.215420 sending passive check response: '{"latency":"1000","lossrate":"100"}' to '172.16.250.17'                                                

      Attachments

        Activity

          People

            zabbix.support Zabbix Support Team
            yinyaliang yinyaliang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: