Icinga / icinga-powershell-plugins

A collection of Windows check plugins for the Icinga PowerShell Framework
GNU General Public License v2.0
51 stars 28 forks source link

Invoke-IcingaCheckUsedPartitionSpace - iSCI disks not check #230

Open CHOOH1992 opened 3 years ago

CHOOH1992 commented 3 years ago

Hi team, we are runnig the plugin on some machines with iSCI disks. These disks are directly visible in the diskmgmt.msc, and also fetched by the legacy check_disk.exe; but the new plugin of the powershell framework is not even detecting them.

Legacy check_disk: PS C:\Program Files\ICINGA2\sbin> .\check_disk.exe -unit gb DISK OK - free space:C:\ 131 GB (66%); C:\Storage\ex_db_101\ 283 GB (63%); C:\Storage\ex_db_102\ 281 GB (62%); C:\Storage\ex_db_103\ 305 GB (68%); C:\Storage\ex_db_104\ 293 GB (65%); C:\Storage\ex_db_105\ 287 GB (64%); C:\Storage\ex_log_101\ 36 GB (16%); C:\Storage\ex_log_102\ 71 GB (32%); C:\Storage\ex_log_103\ 63 GB (29%); C:\Storage\ex_log_104\ 76 GB (35%); C:\Storage\ex_log_105\ 43 GB (20%); | 'C:\'=131GB;;;0;199 'C:\Storage\ex_db_101\'=283GB;;;0;450 'C:\Storage\ex_db_102\'=281GB;;;0;450 'C:\Storage\ex_db_103\'=305GB;;;0;450 'C:\Storage\ex_db_104\'=293GB;;;0;450 'C:\Storage\ex_db_105\'=287GB;;;0;450 'C:\Storage\ex_log_101\'=36GB;;;0;220 'C:\Storage\ex_log_102\'=71GB;;;0;220 'C:\Storage\ex_log_103\'=63GB;;;0;220 'C:\Storage\ex_log_104\'=76GB;;;0;220 'C:\Storage\ex_log_105\'=43GB;;;0;220

Invoke-IcingaCheckUsedPartionSpace Invoke-IcingaCheckUsedPartitionSpace -Include C:\storage\ex_db_102

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "iSCSI" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "SAS" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:122 char:17
+                 $DiskInfo.BusType           = @{
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Cannot convert value "OK" to type "System.Int32". Error: "Input string was not in a correct format."
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPhysicalDiskInfo.psm1:130 char:25
+ ...             Add-IcingaHashtableItem -Hashtable $OperationalStatus -Ke ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

[UNKNOWN] Used Partition Space: No checks added to this package
|
3

Best regards

LordHepipud commented 3 years ago

Hello

Thank you for the issue. The error output you receive should be fixed with v1.7.0, but I assume the disks are still not fetched then. From my understanding, for your use case you should try the Cluster Shared Volume plugin: https://icinga.com/docs/icinga-for-windows/latest/cluster/doc/plugins/02-Invoke-IcingaCheckClusterSharedVolume/

This plugin is part of this repository: https://github.com/Icinga/icinga-powershell-cluster

Does this check include your disks?

CHOOH1992 commented 3 years ago

Hello Christian, thank you for the fast reply! :-)

I just tried the ClusterSharedVolume-Check, but this also not works. May I need to say our disk are not shared.

Invoke-IcingaCheckClusterSharedVolume -Verbosity 3

[UNKNOWN] Network Volumes Package: No checks added to this package (All must be [OK])
|
3

You got any other ideas? Wouldnt be the problem to define a check for each disk (I'd actually prefer this). Best regards

LordHepipud commented 3 years ago

Thank you for the input. Could you please run this command and share it? I would assume that iSCI disks have a different drive type than 3:

Get-CimInstance Win32_LogicalDisk
CHOOH1992 commented 3 years ago

Hi Christian, well actually we are not mounting the iSCIs to a mount point (folder) not to a drive. The command you requested is just showing drives; I think.

Anyways your output:

DeviceID DriveType ProviderName VolumeName                  Size         FreeSpace
-------- --------- ------------ ----------                  ----         ---------
C:       3                                                  214170595328 142245634048
D:       5                      EXCHANGESERVER2019-X64-CU11 6259685376   0
E:       5

I am able to grep some infos this way: Invoke-IcingaCheckPerfCounter "\LogicalDisk(*)\free megabytes"

[OK] Performance Counter
| 'logicaldiskcstorageex_log_101free_megabytes'=35054;; 'logicaldiskcstorageex_db_102free_megabytes'=287803;; 'logicaldiskharddiskvolume1free_megabytes'=146;; 'logicaldiskcstorageex_db_101free_megabytes'=288187;; 'logicaldiskcfree_megabytes'=135663;; 'logicaldiskcstorageex_db_104free_megabytes'=300091;; 'logicaldiskcstorageex_db_103free_megabytes'=312763;; 'logicaldiskcstorageex_log_103free_megabytes'=64715;; 'logicaldiskcstorageex_log_105free_megabytes'=42083;; 'logicaldiskcstorageex_db_105free_megabytes'=292535;; 'logicaldiskcstorageex_log_102free_megabytes'=72160;; 'logicaldiskcstorageex_log_104free_megabytes'=77703;; 'logicaldisk_totalfree_megabytes'=1908903;;
0

Invoke-IcingaCheckPerfCounter "\LogicalDisk(*)\% free space"

[OK] Performance Counter
| 'logicaldiskcstorageex_log_101_free_space'=15.56137;; 'logicaldiskcstorageex_log_104_free_space'=34.49435;; 'logicaldiskcstorageex_log_102_free_space'=32.03367;; 'logicaldiskcstorageex_db_102_free_space'=62.45088;; 'logicaldiskcstorageex_log_103_free_space'=28.72864;; 'logicaldiskcstorageex_db_104_free_space'=65.11727;; 'logicaldiskcstorageex_db_105_free_space'=63.47768;; 'logicaldiskcstorageex_log_105_free_space'=18.68172;; 'logicaldiskc_free_space'=66.42072;; 'logicaldiskcstorageex_db_101_free_space'=62.5342;; 'logicaldisk_total_free_space'=52.50953;; 'logicaldiskcstorageex_db_103_free_space'=67.86699;; 'logicaldiskharddiskvolume1_free_space'=26.64234;;

Best regards

LordHepipud commented 3 years ago

Mh, interesting. Perfcounter Information are present, but LogicalDisk is not showing them. Sadly I have no iSCI devices on hand to play around and test on how we can monitor them properly.

Would there be a way to simulate your configuration with Windows configurations, like VHDX or something similar?

CHOOH1992 commented 3 years ago

Hello, I think this will fit :-)

https://www.it-zeugs.de/iscsi-target-unter-windows-server-2016-einrichten.html

Best Regards