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::vmware::connector::plugin] mode "time-host" -> wrong behaviour with negative value #4677

Closed ermurenz closed 1 year ago

ermurenz commented 1 year ago

Hi, this is our problem. The vmware connector check for the time offset for ESXi nodes , seems isn't working as espected with negative value. But I don't know if i'm doing something wrong here with threshold.

Example:

/usr/lib/centreon/plugins/centreon-pack/centreon_plugins.pl --plugin apps::vmware::connector::plugin --mode=time-host --custommode=connector --connector-hostname=127.0.0.1 --connector-port='5700' --container=xxxx --esx-hostname='xxxxxxxxxxx' --critical-time 5 --debug

CRITICAL : Host 'esxi02prdpom.acapo.it' : time offset 0 second(s) : 2023-09-27T16:48:54.661368Z | 'offset'=-0.66s;;0:5;; {"extra_message":"","identity":"client-b6d7e633a4964f668fdcfd9ba36bd8fe","short_message":"OK","data":{"host-118311":{"name":"xxxxxxxxxxxxxx","current_time":"2023-09-27T16:48:54.661368Z","state":"connected"}},"code":0,"vmware_connector_version":"3.2.5"}

Host 'xxxxxxxxxxxxx' : status connected, time offset 0 second(s) : 2023-09-27T16:48:54.661368Z

As you can see check it come back with "CRITICAL" even with -0.66s offset. Same with "--warning-time"

I apologize in advance if I'm getting something wrong. Thank you in avanced.

ermurenz commented 1 year ago

UPDATE:

It looks like I should have used this one:

--warning-time '-2:5'

Sorry for the useless post.

omercier commented 1 year ago

Hi @ermurenz, Personnally, I would rather set symmetrical thresholds, such as -5:5 since a time offset does not appear worse in a way than in another, but glad you found the solution ;-)