centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
311 stars 274 forks source link

apps::monitoring::speedtest::plugin --mode=internet-bandwidth: UNKNOWN: Cannot decode response #5078

Open joschi99 opened 5 months ago

joschi99 commented 5 months ago

Latest plugins

centreon_plugins.pl --plugin=apps::monitoring::speedtest::plugin --mode=internet-bandwidth --warning-ping-latency=200 --warning-bandwidth-download= --warning-bandwidth-upload= --critical-ping-latency=500 --critical-bandwidth-download= --critical-bandwidth-upload= --warning-ping-jitter=10 --critical-ping-jitter=25 --debug
UNKNOWN: Cannot decode response
command response: {"type":"log","timestamp":"2024-06-24T04:39:28Z","message":"Error: [0] Cannot read from socket (0 bytes read)","level":"error"}
{"type":"result","timestamp":"2024-06-24T04:39:45Z","ping":{"jitter":0.389,"latency":10.697,"low":10.538,"high":11.315},"download":{"bandwidth":117303336,"bytes":1084639440,"elapsed":9408,"latency":{"iqm":25.887,"low":10.500,"high":34.739,"jitter":0.731}},"upload":{"bandwidth":88999241,"bytes":646122593,"elapsed":7305,"latency":{"iqm":11.246,"low":10.687,"high":12.817,"jitter":0.433}},"packetLoss":0,"isp":"Fastweb","interface":{"internalIp":"192.168.15.35","name":"ens192","macAddr":"00:50:56:84:85:BC","isVpn":false,"externalIp":"151.0.132.229"},"server":{"id":6339,"host":"speedtest.3psystem.net","port":8080,"name":"Connetical Srl","location":"Padova","country":"Italy","ip":"185.44.215.252"},"result":{"id":"c78729de-117a-46c7-88ad-5895d3e82e45","url":"https://www.speedtest.net/result/c/c78729de-117a-46c7-88ad-5895d3e82e45","persisted":true}}

If we launch the speedtest manualy we will have this output:

 speedtest

   Speedtest by Ookla

[error] Error: [0] Cannot read from socket:
      Server: FlyNet.it - Padova (id: 55688)
         ISP: Fastweb
Idle Latency:    10.90 ms   (jitter: 0.16ms, low: 10.75ms, high: 11.10ms)
    Download:   753.48 Mbps (data used: 1.4 GB)
                 23.94 ms   (jitter: 5.02ms, low: 9.94ms, high: 281.33ms)
      Upload:   711.06 Mbps (data used: 365.6 MB)
                 10.66 ms   (jitter: 2.41ms, low: 10.18ms, high: 80.35ms)
 Packet Loss:     0.7%
  Result URL: https://www.speedtest.net/result/c/81df0fd4-040c-473e-a3fd-144b8310fd2a

As you can see the speedtest by self is working but we have the exception [error] Error: [0] Cannot read from socket: wich probably will cause the problem. Could you ignore this exception in the plugin?

lucie-dubrunfaut commented 4 months ago

Hello :)

According to my research, it seems that the error management is not internal to the plugin itself but managed by the JSON::XS library and it is when it returns an error when decoding a JSON that the plugin returns the output Cannot decode response. It should therefore be possible to offer filtering on certain error(s) via an option. For this it would be necessary to generate test data in your conditions on which we could work to implement this option.

joschi99 commented 2 months ago

I send you here the complete json output:

[centreon-engine@srv-mou-poller ~]$ speedtest -f json
{"type":"log","timestamp":"2024-08-30T07:30:48Z","message":"Error: [0] Timeout occurred in connect.","level":"error"}
{"type":"result","timestamp":"2024-08-30T07:31:07Z","ping":{"jitter":0.065,"latency":1.057,"low":1.001,"high":1.146},"download":{"bandwidth":48121220,"bytes":592859280,"elapsed":12509,"latency":{"iqm":1.869,"low":1.009,"high":218.068,"jitter":9.665}},"upload":{"bandwidth":116247898,"bytes":686240420,"elapsed":5925,"latency":{"iqm":2.507,"low":1.478,"high":25.679,"jitter":1.464}},"packetLoss":0,"isp":"Optimum WiFi","interface":{"internalIp":"192.168.218.40","name":"ens192","macAddr":"00:50:56:87:1F:B2","isVpn":false,"externalIp":"65.51.128.50"},"server":{"id":62092,"host":"speedtest02.srv.prnynj.alticeusa.net","port":8080,"name":"Optimum Online","location":"Parsippany, NJ","country":"United States","ip":"148.76.236.58"},"result":{"id":"9c3b54fc-b176-4154-b6c7-af88d672dddd","url":"https://www.speedtest.net/result/c/9c3b54fc-b176-4154-b6c7-af88d672dddd","persisted":true}}

speedtest cli returns timeout and this will probably create the problem. every port for speedtest is open, we are not able to understand why we have this timeout on speedtest cli

lucie-dubrunfaut commented 2 months ago

Hello :)

Thanks for the test data. We'll see what we can do about it.