mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes code styling
This commit is contained in:
parent
756a1587af
commit
ac41041f4e
10 changed files with 159 additions and 159 deletions
|
|
@ -40,10 +40,10 @@ function Invoke-IcingaCheckCPU()
|
||||||
param(
|
param(
|
||||||
[int]$Warning = $null,
|
[int]$Warning = $null,
|
||||||
[int]$Critical = $null,
|
[int]$Critical = $null,
|
||||||
[string]$Core = '*',
|
[string]$Core = '*',
|
||||||
[switch]$NoPerfData,
|
[switch]$NoPerfData,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$CpuCounter = New-IcingaPerformanceCounter -Counter ([string]::Format('\Processor({0})\% processor time', $Core));
|
$CpuCounter = New-IcingaPerformanceCounter -Counter ([string]::Format('\Processor({0})\% processor time', $Core));
|
||||||
|
|
|
||||||
|
|
@ -58,29 +58,29 @@ Import-IcingaLib provider\directory;
|
||||||
|
|
||||||
function Invoke-IcingaCheckDirectory()
|
function Invoke-IcingaCheckDirectory()
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
[string]$Path,
|
[string]$Path,
|
||||||
[array]$FileNames,
|
[array]$FileNames,
|
||||||
[switch]$Recurse,
|
[switch]$Recurse,
|
||||||
[int]$Critical = $null,
|
[int]$Critical = $null,
|
||||||
[int]$Warning = $null,
|
[int]$Warning = $null,
|
||||||
[string]$YoungerThen,
|
[string]$YoungerThen,
|
||||||
[string]$OlderThen,
|
[string]$OlderThen,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$DirectoryData = Get-IcingaDirectoryAll -Path $Path -FileNames $FileNames `
|
$DirectoryData = Get-IcingaDirectoryAll -Path $Path -FileNames $FileNames `
|
||||||
-Recurse $Recurse -YoungerThen $YoungerThen -OlderThen $OlderThen;
|
-Recurse $Recurse -YoungerThen $YoungerThen -OlderThen $OlderThen;
|
||||||
$DirectoryCheck = New-IcingaCheck -Name $Path -Value $DirectoryData.Count -NoPerfData;
|
$DirectoryCheck = New-IcingaCheck -Name $Path -Value $DirectoryData.Count -NoPerfData;
|
||||||
|
|
||||||
$DirectoryCheck.WarnOutOfRange(
|
$DirectoryCheck.WarnOutOfRange(
|
||||||
($Warning)
|
($Warning)
|
||||||
).CritOutOfRange(
|
).CritOutOfRange(
|
||||||
($Critical)
|
($Critical)
|
||||||
) | Out-Null;
|
) | Out-Null;
|
||||||
|
|
||||||
$DirectoryPackage = New-IcingaCheckPackage -Name $Path -OperatorAnd -Checks $DirectoryCheck -Verbose $Verbosity;
|
$DirectoryPackage = New-IcingaCheckPackage -Name $Path -OperatorAnd -Checks $DirectoryCheck -Verbose $Verbosity;
|
||||||
|
|
||||||
return (New-IcingaCheckresult -Check $DirectoryPackage -NoPerfData $TRUE -Compile);
|
return (New-IcingaCheckresult -Check $DirectoryPackage -NoPerfData $TRUE -Compile);
|
||||||
}
|
}
|
||||||
|
|
@ -3,8 +3,8 @@ Import-IcingaLib icinga\plugin;
|
||||||
function Invoke-IcingaCheckEventlog()
|
function Invoke-IcingaCheckEventlog()
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
$Warning = $null,
|
$Warning = $null,
|
||||||
$Critical = $null,
|
$Critical = $null,
|
||||||
[string]$LogName,
|
[string]$LogName,
|
||||||
[array]$IncludeEventId,
|
[array]$IncludeEventId,
|
||||||
[array]$ExcludeEventId,
|
[array]$ExcludeEventId,
|
||||||
|
|
@ -19,7 +19,7 @@ function Invoke-IcingaCheckEventlog()
|
||||||
[switch]$DisableTimeCache = $FALSE,
|
[switch]$DisableTimeCache = $FALSE,
|
||||||
[switch]$NoPerfData,
|
[switch]$NoPerfData,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$EventLogPackage = New-IcingaCheckPackage -Name 'EventLog' -OperatorAnd -Verbose $Verbosity;
|
$EventLogPackage = New-IcingaCheckPackage -Name 'EventLog' -OperatorAnd -Verbose $Verbosity;
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ function Invoke-IcingaCheckPerfcounter()
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
[array]$PerfCounter,
|
[array]$PerfCounter,
|
||||||
[double]$Warning = $null,
|
[double]$Warning = $null,
|
||||||
[double]$Critical = $null,
|
[double]$Critical = $null,
|
||||||
[switch]$NoPerfData,
|
[switch]$NoPerfData,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$Counters = New-IcingaPerformanceCounterArray -CounterArray $PerfCounter;
|
$Counters = New-IcingaPerformanceCounterArray -CounterArray $PerfCounter;
|
||||||
|
|
|
||||||
|
|
@ -39,33 +39,33 @@ Import-IcingaLib icinga\plugin;
|
||||||
|
|
||||||
function Invoke-IcingaCheckProcessCount()
|
function Invoke-IcingaCheckProcessCount()
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
[int]$Warning = $null,
|
[int]$Warning = $null,
|
||||||
[int]$Critical = $null,
|
[int]$Critical = $null,
|
||||||
[array]$Process,
|
[array]$Process,
|
||||||
[switch]$NoPerfData,
|
[switch]$NoPerfData,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$ProcessInformation = (Get-IcingaProcessData -Name $Process)
|
$ProcessInformation = (Get-IcingaProcessData -Name $Process)
|
||||||
|
|
||||||
$ProcessPackage = New-icingaCheckPackage -Name "Process Check" -OperatorAnd -Verbose $Verbosity -NoPerfData $NoPerfData;
|
$ProcessPackage = New-icingaCheckPackage -Name "Process Check" -OperatorAnd -Verbose $Verbosity -NoPerfData $NoPerfData;
|
||||||
|
|
||||||
if ($Process.Count -eq 0) {
|
if ($Process.Count -eq 0) {
|
||||||
$ProcessCount = $ProcessInformation['Process Count'];
|
$ProcessCount = $ProcessInformation['Process Count'];
|
||||||
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Process Count')) -Value $ProcessCount;
|
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Process Count')) -Value $ProcessCount;
|
||||||
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
||||||
$ProcessPackage.AddCheck($IcingaCheck);
|
$ProcessPackage.AddCheck($IcingaCheck);
|
||||||
} else {
|
} else {
|
||||||
foreach ($proc in $process) {
|
foreach ($proc in $process) {
|
||||||
$ProcessCount = $ProcessInformation."Processes".$proc.processlist.Count;
|
$ProcessCount = $ProcessInformation."Processes".$proc.processlist.Count;
|
||||||
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Process Count "{0}"', $proc)) -Value $ProcessCount;
|
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Process Count "{0}"', $proc)) -Value $ProcessCount;
|
||||||
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
||||||
$ProcessPackage.AddCheck($IcingaCheck);
|
$ProcessPackage.AddCheck($IcingaCheck);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (New-IcingaCheckResult -Check $ProcessPackage -NoPerfData $NoPerfData -Compile);
|
return (New-IcingaCheckResult -Check $ProcessPackage -NoPerfData $NoPerfData -Compile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,40 +32,40 @@ Import-IcingaLib icinga\plugin;
|
||||||
|
|
||||||
function Invoke-IcingaCheckService()
|
function Invoke-IcingaCheckService()
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
[array]$Service,
|
[array]$Service,
|
||||||
[ValidateSet('Stopped', 'StartPending', 'StopPending', 'Running', 'ContinuePending', 'PausePending', 'Paused')]
|
[ValidateSet('Stopped', 'StartPending', 'StopPending', 'Running', 'ContinuePending', 'PausePending', 'Paused')]
|
||||||
[string]$Status,
|
[string]$Status,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$ServicesPackage = New-IcingaCheckPackage -Name 'Services' -OperatorAnd -Verbose $Verbosity;
|
$ServicesPackage = New-IcingaCheckPackage -Name 'Services' -OperatorAnd -Verbose $Verbosity;
|
||||||
|
|
||||||
if ($Service.Count -ne 1) {
|
if ($Service.Count -ne 1) {
|
||||||
foreach ($services in $Service) {
|
foreach ($services in $Service) {
|
||||||
$IcingaCheck = $null;
|
$IcingaCheck = $null;
|
||||||
|
|
||||||
$FoundService = Get-IcingaServices -Service $services;
|
$FoundService = Get-IcingaServices -Service $services;
|
||||||
$ServiceName = Get-IcingaServiceCheckName -ServiceInput $services -Service $FoundService;
|
$ServiceName = Get-IcingaServiceCheckName -ServiceInput $services -Service $FoundService;
|
||||||
$ConvertedStatus = ConvertTo-ServiceStatusCode -Status $Status;
|
$ConvertedStatus = ConvertTo-ServiceStatusCode -Status $Status;
|
||||||
$StatusRaw = $FoundService.Values.configuration.Status.raw;
|
$StatusRaw = $FoundService.Values.configuration.Status.raw;
|
||||||
|
|
||||||
$IcingaCheck = New-IcingaCheck -Name $ServiceName -Value $StatusRaw -ObjectExists $FoundService -Translation $ProviderEnums.ServiceStatusName;
|
$IcingaCheck = New-IcingaCheck -Name $ServiceName -Value $StatusRaw -ObjectExists $FoundService -Translation $ProviderEnums.ServiceStatusName;
|
||||||
$IcingaCheck.CritIfNotMatch($ConvertedStatus) | Out-Null;
|
$IcingaCheck.CritIfNotMatch($ConvertedStatus) | Out-Null;
|
||||||
$ServicesPackage.AddCheck($IcingaCheck)
|
$ServicesPackage.AddCheck($IcingaCheck)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$FoundService = Get-IcingaServices -Service $Service;
|
$FoundService = Get-IcingaServices -Service $Service;
|
||||||
$ServiceName = Get-IcingaServiceCheckName -ServiceInput $Service -Service $FoundService;
|
$ServiceName = Get-IcingaServiceCheckName -ServiceInput $Service -Service $FoundService;
|
||||||
$Status = ConvertTo-ServiceStatusCode -Status $Status;
|
$Status = ConvertTo-ServiceStatusCode -Status $Status;
|
||||||
$StatusRaw = $FoundService.Values.configuration.Status.raw;
|
$StatusRaw = $FoundService.Values.configuration.Status.raw;
|
||||||
|
|
||||||
$IcingaCheck = New-IcingaCheck -Name $ServiceName -Value $StatusRaw -ObjectExists $FoundService -Translation $ProviderEnums.ServiceStatusName;
|
$IcingaCheck = New-IcingaCheck -Name $ServiceName -Value $StatusRaw -ObjectExists $FoundService -Translation $ProviderEnums.ServiceStatusName;
|
||||||
$IcingaCheck.CritIfNotMatch($Status) | Out-Null;
|
$IcingaCheck.CritIfNotMatch($Status) | Out-Null;
|
||||||
$ServicesPackage.AddCheck($IcingaCheck);
|
$ServicesPackage.AddCheck($IcingaCheck);
|
||||||
|
|
||||||
}
|
}
|
||||||
return (New-IcingaCheckResult -Name 'Services' -Check $ServicesPackage -NoPerfData $TRUE -Compile);
|
return (New-IcingaCheckResult -Name 'Services' -Check $ServicesPackage -NoPerfData $TRUE -Compile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,11 @@ function Invoke-IcingaCheckUpdates()
|
||||||
{
|
{
|
||||||
param (
|
param (
|
||||||
[array]$UpdateFilter,
|
[array]$UpdateFilter,
|
||||||
[int]$Warning = $null,
|
[int]$Warning = $null,
|
||||||
[int]$Critical = $null,
|
[int]$Critical = $null,
|
||||||
[switch]$NoPerfData,
|
[switch]$NoPerfData,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$PendingUpdates = Get-IcingaUpdatesPending;
|
$PendingUpdates = Get-IcingaUpdatesPending;
|
||||||
|
|
|
||||||
|
|
@ -34,25 +34,25 @@ Import-IcingaLib core\tools;
|
||||||
|
|
||||||
function Invoke-IcingaCheckUptime()
|
function Invoke-IcingaCheckUptime()
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
[string]$Warning = $null,
|
[string]$Warning = $null,
|
||||||
[string]$Critical = $null,
|
[string]$Critical = $null,
|
||||||
[switch]$NoPerfData,
|
[switch]$NoPerfData,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$WindowsData = Get-IcingaWindows;
|
$WindowsData = Get-IcingaWindows;
|
||||||
$Name = ([string]::Format('Windows Uptime: {0}', (ConvertFrom-TimeSpan -Seconds $WindowsData.windows.metadata.uptime.value)));
|
$Name = ([string]::Format('Windows Uptime: {0}', (ConvertFrom-TimeSpan -Seconds $WindowsData.windows.metadata.uptime.value)));
|
||||||
|
|
||||||
$IcingaCheck = New-IcingaCheck -Name 'Windows Uptime' -Value $WindowsData.windows.metadata.uptime.value -Unit 's';
|
$IcingaCheck = New-IcingaCheck -Name 'Windows Uptime' -Value $WindowsData.windows.metadata.uptime.value -Unit 's';
|
||||||
$IcingaCheck.WarnOutOfRange(
|
$IcingaCheck.WarnOutOfRange(
|
||||||
(ConvertTo-SecondsFromIcingaThresholds -Threshold $Warning)
|
(ConvertTo-SecondsFromIcingaThresholds -Threshold $Warning)
|
||||||
).CritOutOfRange(
|
).CritOutOfRange(
|
||||||
(ConvertTo-SecondsFromIcingaThresholds -Threshold $Critical)
|
(ConvertTo-SecondsFromIcingaThresholds -Threshold $Critical)
|
||||||
) | Out-Null;
|
) | Out-Null;
|
||||||
|
|
||||||
$CheckPackage = New-IcingaCheckPackage -Name $Name -OperatorAnd -Checks $IcingaCheck -Verbose $Verbosity;
|
$CheckPackage = New-IcingaCheckPackage -Name $Name -OperatorAnd -Checks $IcingaCheck -Verbose $Verbosity;
|
||||||
|
|
||||||
return (New-IcingaCheckresult -Check $CheckPackage -NoPerfData $NoPerfData -Compile);
|
return (New-IcingaCheckresult -Check $CheckPackage -NoPerfData $NoPerfData -Compile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,39 +44,39 @@ Import-IcingaLib icinga\plugin;
|
||||||
|
|
||||||
function Invoke-IcingaCheckUsedPartitionSpace()
|
function Invoke-IcingaCheckUsedPartitionSpace()
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
[int]$Warning = $null,
|
[int]$Warning = $null,
|
||||||
[int]$Critical = $null,
|
[int]$Critical = $null,
|
||||||
[array]$Include = @(),
|
[array]$Include = @(),
|
||||||
[array]$Exclude = @(),
|
[array]$Exclude = @(),
|
||||||
[switch]$NoPerfData,
|
[switch]$NoPerfData,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$DiskFree = Get-IcingaDiskPartitions;
|
$DiskFree = Get-IcingaDiskPartitions;
|
||||||
$DiskPackage = New-IcingaCheckPackage -Name 'Used Partition Space' -OperatorAnd -Verbos $Verbosity;
|
$DiskPackage = New-IcingaCheckPackage -Name 'Used Partition Space' -OperatorAnd -Verbos $Verbosity;
|
||||||
|
|
||||||
foreach ($Letter in $DiskFree.Keys) {
|
foreach ($Letter in $DiskFree.Keys) {
|
||||||
if ($Include.Count -ne 0) {
|
if ($Include.Count -ne 0) {
|
||||||
$Include = $Include.trim(' :/\');
|
$Include = $Include.trim(' :/\');
|
||||||
if (-Not ($Include.Contains($Letter))) {
|
if (-Not ($Include.Contains($Letter))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($Exclude.Count -ne 0) {
|
if ($Exclude.Count -ne 0) {
|
||||||
$Exclude = $Exclude.trim(' :/\');
|
$Exclude = $Exclude.trim(' :/\');
|
||||||
if ($Exclude.Contains($Letter)) {
|
if ($Exclude.Contains($Letter)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Partition {0}', $Letter)) -Value (100-($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);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (New-IcingaCheckResult -Check $DiskPackage -NoPerfData $NoPerfData -Compile);
|
return (New-IcingaCheckResult -Check $DiskPackage -NoPerfData $NoPerfData -Compile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,39 +37,39 @@ function Invoke-IcingaCheckUsers()
|
||||||
{
|
{
|
||||||
param (
|
param (
|
||||||
[array]$Username,
|
[array]$Username,
|
||||||
[int]$Warning = $null,
|
[int]$Warning = $null,
|
||||||
[int]$Critical = $null,
|
[int]$Critical = $null,
|
||||||
[switch]$NoPerfData,
|
[switch]$NoPerfData,
|
||||||
[ValidateSet(0, 1, 2, 3)]
|
[ValidateSet(0, 1, 2, 3)]
|
||||||
[int]$Verbosity = 0
|
[int]$Verbosity = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$UsersPackage = New-IcingaCheckPackage -Name 'Users' -OperatorAnd -Verbose $Verbosity;
|
|
||||||
$LoggedOnUsers = Get-IcingaLoggedOnUsers -UserFilter $Username;
|
|
||||||
|
|
||||||
if ($Username.Count -ne 0) {
|
$UsersPackage = New-IcingaCheckPackage -Name 'Users' -OperatorAnd -Verbose $Verbosity;
|
||||||
foreach ($User in $Username) {
|
$LoggedOnUsers = Get-IcingaLoggedOnUsers -UserFilter $Username;
|
||||||
$IcingaCheck = $null;
|
|
||||||
[int]$LoginCount = 0;
|
|
||||||
|
|
||||||
if ($LoggedOnUsers.users.ContainsKey($User)) {
|
if ($Username.Count -ne 0) {
|
||||||
$LoginCount = $LoggedOnUsers.users.$User.count;
|
foreach ($User in $Username) {
|
||||||
}
|
$IcingaCheck = $null;
|
||||||
|
[int]$LoginCount = 0;
|
||||||
|
|
||||||
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Logged On User "{0}"', $User)) -Value $LoginCount;
|
if ($LoggedOnUsers.users.ContainsKey($User)) {
|
||||||
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
$LoginCount = $LoggedOnUsers.users.$User.count;
|
||||||
$UsersPackage.AddCheck($IcingaCheck);
|
}
|
||||||
}
|
|
||||||
} else {
|
$IcingaCheck = New-IcingaCheck -Name ([string]::Format('Logged On User "{0}"', $User)) -Value $LoginCount;
|
||||||
foreach ($User in $LoggedOnUsers.users.Keys) {
|
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
||||||
$UsersPackage.AddCheck(
|
$UsersPackage.AddCheck($IcingaCheck);
|
||||||
(New-IcingaCheck -Name ([string]::Format('Logged On User "{0}"', $User)) -Value $LoggedOnUsers.users.$User.count)
|
}
|
||||||
);
|
} else {
|
||||||
}
|
foreach ($User in $LoggedOnUsers.users.Keys) {
|
||||||
$IcingaCheck = New-IcingaCheck -Name 'Logged On Users' -Value $LoggedOnUsers.count;
|
$UsersPackage.AddCheck(
|
||||||
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
(New-IcingaCheck -Name ([string]::Format('Logged On User "{0}"', $User)) -Value $LoggedOnUsers.users.$User.count)
|
||||||
$UsersPackage.AddCheck($IcingaCheck)
|
);
|
||||||
}
|
}
|
||||||
|
$IcingaCheck = New-IcingaCheck -Name 'Logged On Users' -Value $LoggedOnUsers.count;
|
||||||
return (New-IcingaCheckResult -Name 'Users' -Check $UsersPackage -NoPerfData $NoPerfData -Compile);
|
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
|
||||||
|
$UsersPackage.AddCheck($IcingaCheck)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (New-IcingaCheckResult -Name 'Users' -Check $UsersPackage -NoPerfData $NoPerfData -Compile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue