mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Merge branch 'testing' of https://github.com/LordHepipud/icinga-module-windows into testing
This commit is contained in:
commit
ac025da700
5 changed files with 30 additions and 5 deletions
|
|
@ -13,10 +13,10 @@ function Invoke-IcingaCheckService()
|
||||||
$FoundService = Get-IcingaServices -Service $Service;
|
$FoundService = Get-IcingaServices -Service $Service;
|
||||||
$ServiceName = $FoundService.Values.metadata.ServiceName;
|
$ServiceName = $FoundService.Values.metadata.ServiceName;
|
||||||
$DisplayName = $FoundService.Values.metadata.DisplayName;
|
$DisplayName = $FoundService.Values.metadata.DisplayName;
|
||||||
# $Status = Get-IcingaServicesStatusTranslation -Status $Status;
|
$Status = ConvertTo-ServiceStatusCode -Status $Status;
|
||||||
$StatusRaw = $FoundService.Values.configuration.Status.raw;
|
$StatusRaw = $FoundService.Values.configuration.Status.raw;
|
||||||
|
|
||||||
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Service "{0} ({1})"', $DisplayName, $ServiceName)) -Value $StatusRaw -ObjectExists $FoundService -ValueTranslation $ProviderEnums.ServiceStatus;
|
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Service "{0} ({1})"', $DisplayName, $ServiceName)) -Value $StatusRaw -ObjectExists $FoundService -ValueTranslation $ProviderEnums.ServicesStatus;
|
||||||
$IcingaCheck.CritIfNotMatch($Status) | Out-Null;
|
$IcingaCheck.CritIfNotMatch($Status) | Out-Null;
|
||||||
|
|
||||||
exit (New-IcingaCheckResult -Name "Service $Service" -Check $IcingaCheck -NoPerfData $TRUE -Compile);
|
exit (New-IcingaCheckResult -Name "Service $Service" -Check $IcingaCheck -NoPerfData $TRUE -Compile);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
Import-IcingaLib core\perfcounter;
|
Import-IcingaLib core\perfcounter;
|
||||||
Import-IcingaLib icinga\plugin;
|
Import-IcingaLib icinga\plugin;
|
||||||
|
|
||||||
function Invoke-IcingaCheckFreePartition()
|
function Invoke-IcingaCheckUsedPartitionSpace()
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
$Warning,
|
$Warning,
|
||||||
|
|
@ -33,7 +33,7 @@ function Invoke-IcingaCheckFreePartition()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Partition {0}', $Letter)) -Value $DiskFree.([string]::Format($Letter))."Free Space" -Unit '%';
|
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Partition {0}', $Letter)) -Value (100-($DiskFree.([string]::Format($Letter))."Free Space")) -Unit '%';
|
||||||
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
||||||
$DiskPackage.AddCheck($IcingaCheck);
|
$DiskPackage.AddCheck($IcingaCheck);
|
||||||
}
|
}
|
||||||
|
|
@ -471,6 +471,15 @@
|
||||||
62= 'TPF';
|
62= 'TPF';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# /lib/provider/Services ###########################################################
|
||||||
|
##################################################################################################>
|
||||||
|
|
||||||
|
[hashtable]$ServiceStatus = @{
|
||||||
|
'Stopped' = 1;
|
||||||
|
'Running' = 4;
|
||||||
|
}
|
||||||
|
|
||||||
[hashtable]$ProviderEnums = @{
|
[hashtable]$ProviderEnums = @{
|
||||||
#/lib/provider/bios
|
#/lib/provider/bios
|
||||||
BiosCharacteristics = $BiosCharacteristics;
|
BiosCharacteristics = $BiosCharacteristics;
|
||||||
|
|
@ -493,6 +502,8 @@
|
||||||
WindowsOSProductSuite = $WindowsOSProductSuite;
|
WindowsOSProductSuite = $WindowsOSProductSuite;
|
||||||
WindowsProductType = $WindowsProductType;
|
WindowsProductType = $WindowsProductType;
|
||||||
WindowsOSType = $WindowsOSType;
|
WindowsOSType = $WindowsOSType;
|
||||||
|
#/lib/provider/services
|
||||||
|
ServiceStatus = $ServiceStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
Export-ModuleMember -Variable @('ProviderEnums');
|
Export-ModuleMember -Variable @('ProviderEnums');
|
||||||
14
lib/provider/services/ConvertTo-ServiceStatusCode.psm1
Normal file
14
lib/provider/services/ConvertTo-ServiceStatusCode.psm1
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
function ConvertTo-ServiceStatusCode()
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
$Status
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($Status -match "^\d+$") {
|
||||||
|
return $Status
|
||||||
|
} else {
|
||||||
|
$Status = $ProviderEnums.ServiceStatus.($Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $Status;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue