You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plugin should also be able to handle negative offsets.
Current Behavior
After upgrading the PowerShell Plugins from 1.4.0 to 1.5.1 the plugin returns the following message when the time offset is negative:
Output:
[UNKNOWN] Icinga Exception: Exception calling "WarnOutOfRange" with "1" argument(s): "Cannot convert value "-0.02s" to type "System.Decimal". Error: "Input string was not in a correct format.""
CheckCommand: Invoke-IcingaCheckTimeSync Arguments: -Server ntp.domain.net -Warning 1m -Critical 3m -Verbosity 2 StackTrace: at Invoke-IcingaCheckTimeSync, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\plugins\Invoke-IcingaCheckTimeSync.psm1: line 77 at Exit-IcingaExecutePlugin, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\lib\icinga\plugin\Exit-IcingaExecutePlugin.psm1: line 17 at , : line 1
We've imported the baskets with the modified variables etc. into Icinga Director during the migration from 1.4.0 to 1.5.1.
Possible Solution
Maybe there is a bug in the implementation of the following issue:
Thanks for the quick reply / fix.
After modifying the file Convert-IcingaPluginThresholds.psm1 to the version in the referenced PR, negative time offsets are handled correctly (see below).
PS C:\WINDOWS\system32> Invoke-IcingaCheckTimeSync -Server ntp.domain.net -Warning -60s:60s -Critical -180s:180s -Verbosity 2
[CRITICAL] Time Package [CRITICAL] Time Offset (-5.19m)
\_ [OK] Sync Status: NoLeapWarning
\_ [CRITICAL] Time Offset: -5.19m is outside range -3m and 3m
\_ [OK] Time Service: Running
| 'time_offset'=-311.660004s;-60:60;-180:180 'time_service'=4;;4
2
PS C:\WINDOWS\system32> Invoke-IcingaCheckTimeSync -Server ntp.domain.net -Warning -60s:60s -Critical -180s:180s -Verbosity 2
[WARNING] Time Package [WARNING] Time Offset (-1.44m)
\_ [OK] Sync Status: NoLeapWarning
\_ [WARNING] Time Offset: -1.44m is outside range -1m and 1m
\_ [OK] Time Service: Running
| 'time_offset'=-86.150002s;-60:60;-180:180 'time_service'=4;;4
1
Important note to users: The thresholds need to be set as min./max. settings with negative and positive limits (see example above).
Expected Behavior
Plugin should also be able to handle negative offsets.
Current Behavior
After upgrading the PowerShell Plugins from 1.4.0 to 1.5.1 the plugin returns the following message when the time offset is negative:
We've imported the baskets with the modified variables etc. into Icinga Director during the migration from 1.4.0 to 1.5.1.
Possible Solution
Maybe there is a bug in the implementation of the following issue:
Fix: Time offset calculation for Invoke-IcingaCheckTimeSync should allow negative offset Icinga/icinga-powershell-plugins#182
Steps to Reproduce (for bugs)
Modify Date/Time on your Windows machine to the future with "Set-Date yyyy-mm-dd hh:mm:ss" and run the check.
Context
When the time offset is negative the plugin returns the state UNKNOWN.
Your Environment
$PSVersionTable.PSVersion
):The text was updated successfully, but these errors were encountered: