Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-IcingaCheckDiskHealth broken in v.1.10.0 #588

Closed
geotekberlin opened this issue Sep 3, 2022 · 21 comments · Fixed by #589
Closed

Invoke-IcingaCheckDiskHealth broken in v.1.10.0 #588

geotekberlin opened this issue Sep 3, 2022 · 21 comments · Fixed by #589
Assignees
Labels
Bug There is an issue present
Milestone

Comments

@geotekberlin
Copy link

geotekberlin commented Sep 3, 2022

After upgrading Powershell Framework and Plugins to v.1.10.0 the Invoke-IcingaCheckDiskHealth throws an error:

PS C:\> Invoke-IcingaCheckDiskHealth
[UNKNOWN]: Icinga Invalid Input Error was thrown: ConversionUnitMissing

Unable to parse input value. You have to add an unit to your input value. Example: "10GB". Allowed units are: "B, KB, MB, GB, TB, PB, KiB, MiB, GiB, TiB, PiB".
Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en):  "Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en):  "Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en):  "Ausnahme
beim Aufrufen von "Compile" mit 0 Argument(en):  "Ausnahme beim Aufrufen von "__CreateDefaultThresholdObject" mit 0 Argument(en):  "Systemfehler"""""
In C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:28116 Zeichen:16
+         return $IcingaCheckResult.Compile();
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ScriptMethodRuntimeException

Check
-----
@{Name=Physical Disk Package; Verbose=0; __CheckPerfData=System.Collections.Hashtable; __Hidden=False; __Parent=; __Indention=0; __ErrorMessage=; __CheckState=0; __CheckCommand=Invoke-...

Calling icinga -RebuildCache and Write-IcingaFrameworkCodeCache did not help. All other plugins continue to work as expected.

@Marci24h
Copy link

Hi,

i ran into the same issue.
On 15 Windows Servers, that have never had icinga for windows installed before, i deployed ifw.
On 14 Systems it works immediately, on one System the error occurs.
The Systems are split over different Zones, but all use the same ServiceSet / Templates.

PS C:\Windows\system32> Get-Module -ListAvailable -Name "icinga-powershell-*"


    Verzeichnis: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.10.0     icinga-powershell-framework         {Enable-IcingaFrameworkConsoleOutput, Get-IcingaInternalPluginExitCode, New-IcingaRepository, Get-IcingaForWindowsManagementConsoleAlias...}
Manifest   1.10.0     icinga-powershell-plugins           {Import-IcingaPowerShellComponentPlugins, Invoke-IcingaCheckBiosSerial, Invoke-IcingaCheckCertificate, Invoke-IcingaCheckCheckSum...}

Running the Example Command also throws the error.

PS C:\Windows\system32> Invoke-IcingaCheckDiskHealth  -DiskReadSecWarning 0 -DiskReadSecCritical 1 -DiskAvgTransSecWarning 5s -DiskAvgTransSecCritical 10s -DiskReadByteSecWarning 3000 -DiskReadByteSecCritical 5000 -Verbosity 2
[UNKNOWN]: Icinga Invalid Input Error was thrown: ConversionUnitMissing

Unable to parse input value. You have to add an unit to your input value. Example: "10GB". Allowed units are: "B, KB, MB, GB, TB, PB, KiB, MiB, GiB, TiB, PiB".
Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en):  "Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en):  "Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en):  "Ausnahme beim Aufrufen
von "Compile" mit 0 Argument(en):  "Ausnahme beim Aufrufen von "__CreateDefaultThresholdObject" mit 0 Argument(en):  "Systemfehler"""""
In C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:28116 Zeichen:16
+         return $IcingaCheckResult.Compile();
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ScriptMethodRuntimeException


Check
-----
@{Name=Physical Disk Package; Verbose=2; __CheckPerfData=System.Collections.Hashtable; __Hidden=False; __Parent=; __Indention=0; __ErrorMessage=; __CheckState=0; __CheckCommand=Invoke-IcingaCheckDisk...

image

image

@puseidr
Copy link

puseidr commented Sep 19, 2022

i got the same issue on my systems

@LordHepipud
Copy link
Collaborator

I have run a test on certain machines and I'm unable to reproduce this problem. As far as I can tell, only certain machines run into this problem.

Can you please check, what the difference regarding these machines is for disks? I'm pretty sure we can track down this problem. Sadly I have not access to such a broken machine, therefor it is hard for me to provide first steps for troubleshooting.

@LordHepipud LordHepipud self-assigned this Sep 20, 2022
@LordHepipud LordHepipud added the Bug There is an issue present label Sep 20, 2022
@puseidr
Copy link

puseidr commented Sep 20, 2022

on most of my servers the check is working, i got only 3 servers with that error in my enviroment:

1x physical S2D-Cluster Node (Windows Server 2019 Datacenter GER)
specs:

  • Raid 1 by Raidcontroller for System Disc (C)
  • a lot NVMe SSDs for Storage Space Direct/Cluster Shared Volumes
  • switching CVS to other Nodes doesn't affect the error (on identical Nodes the cmdlet is working...)

1x physical Domain Controller (Windows Server 2019 Standard GER)
specs:

  • Raid 1 by Raidcontroller for System Disc (C)
  • Raid 5 by Raidcontroller for an additional Partition

1x virtual machine (Windows Server 2016 Standard US)
specs:

  • Xen VM with a single System disk

i have no idea what's the common ground at that servers

@geotekberlin
Copy link
Author

My failing servers are running Windows Server 2019 or 2022 Standard (German) and have either a single hardware RAID volume C: or a single VMware 7 volume C:. After upgrading 3 servers from 1.9.2 to 1.10.0 and all of them showed this error, I stopped the rollout, which means I have no working 1.10.0 host for comparison.

@Hrocc
Copy link

Hrocc commented Sep 21, 2022

we got the same issue on new installations after a fresh OS reinstall on physical servers.

OS = Windows Server 2019 Datacenter
Hyper-V Cluster Node

[UNKNOWN]: Icinga Invalid Input Error was thrown: ConversionUnitMissing Unable to parse input value. You have to add an unit to your input value. Example: "10GB". Allowed units are: "B, KB, MB, GB, TB, PB, KiB, MiB, GiB, TiB, PiB". [UNKNOWN] Icinga Exception: Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en): "Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en): "Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en): "Ausnahme beim Aufrufen von "Compile" mit 0 Argument(en): "Ausnahme beim Aufrufen von "__CreateDefaultThresholdObject" mit 0 Argument(en): "Systemfehler""""" CheckCommand: Invoke-IcingaCheckDiskHealth Arguments: System.Collections.Hashtable StackTrace: bei New-IcingaCheckResult, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1: Zeile 28116 bei Invoke-IcingaCheckDiskHealth, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\compiled\icinga-powershell-plugins.ifw_compilation.psm1: Zeile 1086 bei Exit-IcingaExecutePlugin, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1: Zeile 26461 bei , : Zeile 1

@LordHepipud
Copy link
Collaborator

I have just tested this on an affected customer environment and was able to track down the issue.

The source of this is the function Convert-IcingaPluginThresholds.

If a serial number of the disks contains any of the values inside the regex, the regex will return true and try to proceed the unit conversion instead of simply using the plain string.

Example:

'6000c29dc425c3d96f02d0c3a0145870' -Match "(^-?[0-9].*)+((\.|\,)+[0-9])?(B|KB|MB|GB|TB|PT|KiB|MiB|GiB|TiB|PiB)"

Returns: False

'6000c29pt425c3d96f02d0c3a0145870' -Match "(^-?[0-9].*)+((\.|\,)+[0-9])?(B|KB|MB|GB|TB|PT|KiB|MiB|GiB|TiB|PiB)"

Returns: True

Reason: The serial number contains pt as string and the regex beliefs this is meant to be peta bytes.

This is why on most machines the plugin will work, because it only throws an error if any values like B, KB, MB GB, TB, PT, KiB, MiB, GiB, TiB or PiB are included

@Marci24h
Copy link

i tried to find a difference / similarities between the machines.
Hardware as well as virtuall Machines are affected.
so i updated a not affected machine to the same Windows Version as the affected one, but without success.

It could also be that the UniqueId or the ObjectId are affected.

i got a System where none of the strings is contained in the serialnumber, but in the UniqueId and ObjectId

image

@LordHepipud
Copy link
Collaborator

A possible fix would be to update the regex to this:

'6000c29pt425c3d96f02d0c3a0145870' -Match "(^-?[0-9]+)((\.|\,)[0-9]+)?(B|KB|MB|GB|TB|PT|KiB|MiB|GiB|TiB|PiB)$"

I will do more internal testing and provide a PR for testing afterwards.

@LordHepipud LordHepipud transferred this issue from Icinga/icinga-powershell-plugins Oct 18, 2022
@LordHepipud LordHepipud added this to the v1.10.1 milestone Oct 18, 2022
@LordHepipud
Copy link
Collaborator

I just created the linked PR for the Framework. Can anyone please test and validate my internal results? This should resolve the above mentioned issues for all checks and thresholds.

@puseidr
Copy link

puseidr commented Oct 18, 2022

i've tried your PR but in my case it didnt fixed the problem. and it also messed up other checks like "Invoke-IcingaCheckNetworkInterface"
which results in an error like this:

[UNKNOWN] Icinga Exception: Ausnahme beim Aufrufen von "WarnIfMatch" mit 1 Argument(en):  "Ausnahme beim Aufrufen von "WarnIfLike" mit 1 Argument(en):  "Der Wert "425.984Mbit" kann nicht in den Typ "System.Decimal" konvertiert werden. Fehler: "Die Eingabezeichenfolge hat das falsche Format."""
CheckCommand: Invoke-IcingaCheckNetworkInterface Arguments: System.Collections.Hashtable StackTrace: bei Get-IcingaNetworkSpeedChecks, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\compiled\icinga-powershell-plugins.ifw_compilation.psm1: Zeile 9332 bei Invoke-IcingaCheckNetworkInterface, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\compiled\icinga-powershell-plugins.ifw_compilation.psm1: Zeile 2549 bei Exit-IcingaExecutePlugin, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1: Zeile 26462 bei , : Zeile 1

@Marci24h
Copy link

Marci24h commented Oct 18, 2022

i checked out the commit: 92a56994633f6e0e4ca90c2169ae8c7e07cbbef1 and for me it works.
Tested on two different systems.
Bevore i got the [UNKNOWN] Result and now it is [OK].
After replacing the Files, i clear the framework cache.
@puseidr have you tried to clear the framework cache.

image
image

@puseidr
Copy link

puseidr commented Oct 18, 2022

i've edited the 2 files and than used "Write-IcingaFrameworkCodeCache"

@Marci24h
Copy link

Marci24h commented Oct 18, 2022

i've done it like it is mentioned in IWKB000014

Clear Cache:

  • stop Services (icinga2 & icingapowershell)
  • copy the File: \\remoteserver.dom.tld\c$\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\templates\framework_cache.psm1.template over \\remoteserver.dom.tld\c$\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1
  • start Services (icinga2 & icingapowershell)

@geotekberlin
Copy link
Author

Unfortunately, replacing the two files and resetting the framework cache did not solve the issue for me either.

@LordHepipud
Copy link
Collaborator

I checked the network plugin and you are right, this one is broken with the PR.
I will fix that by updating the PR with a new version shortly.

@Marci24h
Copy link

Marci24h commented Oct 25, 2022

i can confirm.
for me the network plugin also is broken after applying the PR.

@geotekberlin
Copy link
Author

I don't want to push, but I am eagerly awaiting a fix. Is there any progress yet?

@LordHepipud
Copy link
Collaborator

Can you please test the updated PR? This issue and the newly introduced one should be resolved now.

Release is planned for December including other issues currently open.

@puseidr
Copy link

puseidr commented Nov 22, 2022

the PR fixed the issue on all my affected systems
good job :)

@geotekberlin
Copy link
Author

The last PR fixed my issues as well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug There is an issue present
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants