icinga-powershell-plugins icon indicating copy to clipboard operation
icinga-powershell-plugins copied to clipboard

Invoke-IcingaCheckPartitionSpace doesn't work on 1 server called from Icinga, but works on other servers

Open Laszlo-Fiat opened this issue 3 years ago • 5 comments

So I have updated all the windows servers to the newest stable icinga for windows versions. All servers work happily, except one, where in Icinga I get an Unknown result:

***** Service Monitoring on icinga-server *****

disk on file-server is UNKNOWN!

Info:    [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: Exception calling "WarnOutOfRange" with "1" argument(s): "System error."



CheckCommand: Invoke-IcingaCheckPartitionSpace

Arguments: -Warning 80% -Critical 90% -Include System.Object[] -Exclude System.Object[] -CheckUsedSpace



StackTrace:

at Invoke-IcingaCheckPartitionSpace, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\plugins\Invoke-IcingaCheckUsedPartitionSpace.psm1: line 147

at Exit-IcingaExecutePlugin, C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework

While running directly on the same server from Administrator Powershell I get the proper result:

PS C:\> Invoke-IcingaCheckPartitionSpace -Warning 80% -Critial 90% -CheckUsed
[WARNING] Used Partition Space: 1 Warning 7 Ok [WARNING] Partition D: (87.72% (2.80TiB))
\_ [WARNING] Partition D: 87.72% (2.80TiB) is greater than threshold 80% (2.55TiB)
| 'used_space_partition_f'=1369839000000B;1661385600000;;0;2076732000000 'used_space_partition_j'=1264494000000B;1286400
000000;;0;1608000000000 'used_space_partition_e'=1553037000000B;1741303200000;;0;2176629000000 'used_space_partition_m'=
1026039000000B;3518220800000;;0;4397776000000 'used_space_partition_d'=3078402000000B;2807618400000;;0;3509523000000 'us
ed_space_partition_c'=116417900000B;168691520000;;0;210864400000 'used_space_partition_i'=862352200000B;1661280800000;;0
;2076601000000 'used_space_partition_l'=843989400000B;7916132800000;;0;9895166000000
1

What could cause this? I am sure I have updated the framework, the .psm1 file in question is the same size as on all other servers. Thank you for helping.

Laszlo-Fiat avatar Dec 03 '21 14:12 Laszlo-Fiat

This is an interesting issue. Is this error still happening?

Is it possible, that a non-administrative user is not having permission to access a certain partition?

LordHepipud avatar Jan 22 '22 20:01 LordHepipud

It was a rights issue afterall. The Icinga Service was installed to run as user Network Service, and then only C: can be monitored successfully. If I change the user to a more powerful user, all the other drives can be monitored also. The biggest issue with this is that it gives a misleading error message (see in the original bug report), instead of giving an access denied.

Laszlo-Fiat avatar Apr 06 '22 14:04 Laszlo-Fiat

Thank you for the update. The problem is that we do not know if simply no data could be retrieved, or permissions are not present properly. If we throw a permission error by default in this case, we would also give "false" outputs. If there is an idea on how we can improve this, I will be happy to implement it.

LordHepipud avatar Apr 06 '22 15:04 LordHepipud

Thank your for your work. From user point of view, it would be nice if it "just worked" like in nscp++ times, I installed the client, implemented the checks in nagios/icinga, and it worked, there was no need to fiddle with permissions, either the installer set it up properly, or it run with administrative privilege by default. Or the otherwise excellent, detailed manual should contain a section how to set up permissions needed for certain checks to work properly. But I'm 100% certain, that it is not correct if there is a permission issue, and you get an error message: "Icinga Invalid Input Error was thrown: ConversionUnitMissing" Either input saniitization should be done before, so you are sure the input parameters are ok, and then if no value returned, it is most likely a permission issue. BTW: The Icinga 2 Service is set up to run as Network Service by default. I needed to change that to SYSTEM to have the proper permission. Is it safe to run Icinga 2 as SYSTEM?

Laszlo-Fiat avatar Apr 11 '22 08:04 Laszlo-Fiat

Have you tried JEA? This could help you with the permission issue.

K0nne avatar May 31 '23 16:05 K0nne