mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2026-02-06 07:05:17 +01:00
exchange checks added to nsclient config
This commit is contained in:
@@ -30,14 +30,14 @@
|
||||
#
|
||||
# On the check_nrpe command include the -t 20, since it takes some time to load
|
||||
# the Exchange cmdlet's.
|
||||
Write-Host "Test"
|
||||
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
|
||||
|
||||
$NagiosStatus = "0"
|
||||
$NagiosDescription = ""
|
||||
|
||||
$LongOutput = ""
|
||||
ForEach ($DataBase in Get-MailboxDatabase) {
|
||||
ForEach ($Status in Get-MailboxDatabaseCopyStatus -Identity $DataBase.Name) {
|
||||
$LongOutput = $LongOutput + $Status.Name + " is " + $Status.Status + "`n"
|
||||
switch ($Status.Status) {
|
||||
"Failed" {
|
||||
$NagiosStatus = "2"
|
||||
@@ -99,5 +99,7 @@ if ($NagiosStatus -eq "2") {
|
||||
} else {
|
||||
Write-Host "OK: All Mailbox Databases are mounted and healthy."
|
||||
}
|
||||
Write-Host $LongOutput
|
||||
|
||||
exit $NagiosStatus
|
||||
|
||||
|
||||
@@ -35,11 +35,10 @@ Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
|
||||
|
||||
$NagiosStatus = "0"
|
||||
$NagiosDescription = ""
|
||||
|
||||
$LongOutput = ""
|
||||
ForEach ($Type in Test-ReplicationHealth -Identity $env:computername) {
|
||||
|
||||
# Look for failed replications
|
||||
if ($TypeResult -like "*FAILED*") {
|
||||
if ($Type.Result -like "*FAILED*") {
|
||||
# Format the output for Nagios
|
||||
if ($NagiosDescription -ne "") {
|
||||
$NagiosDescription = $NagiosDescription + ", "
|
||||
@@ -65,6 +64,7 @@ ForEach ($Type in Test-ReplicationHealth -Identity $env:computername) {
|
||||
$NagiosStatus = "1"
|
||||
}
|
||||
}
|
||||
$LongOutput = $LongOutput + $Type.Result + " on " + $Type.Check + "`n"
|
||||
}
|
||||
|
||||
# Output, what level should we tell our caller?
|
||||
@@ -76,5 +76,7 @@ if ($NagiosStatus -eq "2") {
|
||||
Write-Host "OK: All replication tests passed."
|
||||
}
|
||||
|
||||
Write-Host $LongOutput
|
||||
exit $NagiosStatus
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user