forked from wasserja/MrANagios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Disable-NagiosServiceGroupCheck.ps1
48 lines (42 loc) · 1.62 KB
/
Disable-NagiosServiceGroupCheck.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<#
.SYNOPSIS
Disables Nagios services checks for a specified servicegroup.
.DESCRIPTION
This function is a shortcut to Invoke-Nagios to automatically choose
to disable nagios checks for a specified servicegroup.
.EXAMPLE
Disable-NagiosServiceGroupCheck -ServiceGroup ServiceGroupName
.EXAMPLE
Disable-NagiosServiceGroupCheck -ServiceGroup ServiceGroupName -Credential $Credential
.EXAMPLE
Disable-NagiosServiceGroupCheck -ServiceGroup ServiceGroupName -Credential $Credential -NagiosCoreUrl https://nagiosdev.domain.com/nagios
#>
Function Disable-NagiosServiceGroupCheck {
Param (
# Nagios Host
[Parameter(Mandatory = $true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
Position = 0,
HelpMessage = "What nagios refers to service group(s) for which you wish to enable/disable checks and notifications. Nagios is case-sensitive for hosts (i.e. server01 != SERVER01)."
)]
[alias('sg')]
[string[]]$ServiceGroup,
# Nagios base url
[Parameter(
HelpMessage = "The base url of your nagios installation (i.e. http://nagios.domain.com/nagios)"
)]
[string]$NagiosCoreUrl,
# Nagios Credential
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]$Credential
)
begin {}
process {
foreach ($sg in $ServiceGroup) {
Write-Verbose "Disabling Nagios service group checks for $sg"
Invoke-NagiosRequest -ServiceGroup $sg -action 114 -Credential $Credential -NagiosCoreUrl $NagiosCoreUrl
}
}
end {}
}