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-IcingaCheckUsedPartitionSpace fails when not using percentages #228

Closed
ajoergensen opened this issue Sep 8, 2021 · 3 comments · Fixed by #233
Closed

Invoke-IcingaCheckUsedPartitionSpace fails when not using percentages #228

ajoergensen opened this issue Sep 8, 2021 · 3 comments · Fixed by #233
Assignees
Labels
bug Something isn't working question Further information is requested
Milestone

Comments

@ajoergensen
Copy link

Framework versions installed:

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.6.0      icinga-powershell-framework         {Add-IcingaArrayListItem, Add-IcingaForWindowsDaemon, Add-...
Script     1.6.0      icinga-powershell-plugins           {Add-IcingaProcessPerfData, Add-IcingaServiceSummary, Conv...

Powershell version:

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  2090

OS: Windows Server 2019 DC

When using Invoke-IcingaCheckUsedPartitionSpace with percantages it works as expected but when using other units it does not and fails with ConversionUnitMissing

Example:

> Invoke-IcingaCheckUsedPartitionSpace -Critical 10GB -Warning 20GB -Include E:

[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".
Exception calling "WarnOutOfRange" with "1" argument(s): "System error."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\1.6.0\plugins\Invoke-IcingaCheckUsedPartitionSp
ace.psm1:144 char:17
+ ...             $IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Cri ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ScriptMethodFlowControlException

[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".
Exception calling "WarnOutOfRange" with "1" argument(s): "System error."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\1.6.0\plugins\Invoke-IcingaCheckUsedPartitionSp
ace.psm1:144 char:17
+ ...             $IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Cri ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ScriptMethodFlowControlException

[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".
Exception calling "WarnOutOfRange" with "1" argument(s): "System error."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\1.6.0\plugins\Invoke-IcingaCheckUsedPartitionSp
ace.psm1:144 char:17
+ ...             $IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Cri ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ScriptMethodFlowControlException

[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".
Exception calling "Compile" with "0" argument(s): "Exception calling "Compile" with "0" argument(s): "Exception calling
 "Compile" with "0" argument(s): "Exception calling "__CreateDefaultThresholdObject" with "0" argument(s): "System erro
r.""""
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\1.6.0\cache\framework_cache.psm1:22891 char:1
6
+         return $IcingaCheckResult.Compile();
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ScriptMethodRuntimeException


Check
-----
@{Name=Used Partition Space; Verbose=0; __CheckPerfData=System.Collections.Hashtable; __Hidden=False; __Parent=; __I...
@LordHepipud
Copy link
Collaborator

This is weird - it works on my environments:

Invoke-IcingaCheckUsedPartitionSpace -Critical 10GB -Warning 20GB;

[UNKNOWN] Used Partition Space: 4 Unknown [UNKNOWN] Partition C: (724.81GiB), Partition D: (0B), Partition G: (1.49TiB), Partition R: (2.94TiB)
\_ [UNKNOWN] Partition C: Warning threshold range "21474836480" is greater than Critical threshold range "10737418240"
\_ [UNKNOWN] Partition D: No disk size and/or free space available
\_ [UNKNOWN] Partition G: Warning threshold range "21474836480" is greater than Critical threshold range "10737418240"
\_ [UNKNOWN] Partition R: Warning threshold range "21474836480" is greater than Critical threshold range "10737418240"| 'used_space_partition_r'=3236077000000B;21474836480;10737418240;0;4000768000000 'used_space_partition_g'=1641211000000B;21474836480;10737418240;0;2000381000000 'used_space_partition_c'=778254400000B;21474836480;10737418240;0;999527800000
3

What happens if you switch the values for the arguments? In your case, warning cannot be bigger than critical.

Invoke-IcingaCheckUsedPartitionSpace -Critical 20GB -Warning 10GB;

[UNKNOWN] Used Partition Space: 1 Unknown 3 Critical [UNKNOWN] Partition D: (0B) [CRITICAL] Partition C: (724.80GiB), Partition G: (1.49TiB), Partition R: (2.94TiB)
\_ [CRITICAL] Partition C: 724.80GiB is greater than threshold 20GiB
\_ [UNKNOWN] Partition D: No disk size and/or free space available
\_ [CRITICAL] Partition G: 1.49TiB is greater than threshold 20GiB
\_ [CRITICAL] Partition R: 2.94TiB is greater than threshold 20GiB
| 'used_space_partition_r'=3236093000000B;10737418240;21474836480;0;4000768000000 'used_space_partition_g'=1641211000000B;10737418240;21474836480;0;2000381000000 'used_space_partition_c'=778246600000B;10737418240;21474836480;0;999527800000

Could you please also try to wrap the values in single quotes?

Invoke-IcingaCheckUsedPartitionSpace -Critical '10GB' -Warning '20GB';

[UNKNOWN] Used Partition Space: 4 Unknown [UNKNOWN] Partition C: (724.80GiB), Partition D: (0B), Partition G: (1.49TiB), Partition R: (2.94TiB)
\_ [UNKNOWN] Partition C: Warning threshold range "20GB" is greater than Critical threshold range "10GB"
\_ [UNKNOWN] Partition D: No disk size and/or free space available
\_ [UNKNOWN] Partition G: Warning threshold range "20GB" is greater than Critical threshold range "10GB"
\_ [UNKNOWN] Partition R: Warning threshold range "20GB" is greater than Critical threshold range "10GB"
| 'used_space_partition_r'=3236122000000B;20000000000;10000000000;0;4000768000000 'used_space_partition_g'=1641211000000B;20000000000;10000000000;0;2000381000000 'used_space_partition_c'=778244400000B;20000000000;10000000000;0;999527800000

@LordHepipud LordHepipud self-assigned this Sep 8, 2021
@LordHepipud LordHepipud added bug Something isn't working question Further information is requested labels Sep 8, 2021
@LordHepipud LordHepipud added this to the v1.7.0 milestone Sep 8, 2021
@ajoergensen
Copy link
Author

It appears to be a local problem, I tried it on another server where it worked as expected.

I had missed the fact that it's not "space free" but "space used" so I'll stick with nscp for now, but thanks for looking into it anyway.

@LordHepipud
Copy link
Collaborator

Could you please test the linked PR? This provides a new improved version with less overhead, while allowing to check for free and used space depending on the plugin configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants