Skip to content

Problem with Invoke-IcingaCheckTimeSync when offset is negative - after upgrading from 1.4.0 to 1.5.1  #311

@408573

Description

@408573

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:

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:

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

  • PowerShell Version used ($PSVersionTable.PSVersion):
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  4467
  • Operating System and version:
Windows Server 2016

Metadata

Metadata

Assignees

Labels

BugThere is an issue present

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions