1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 10:23:46 +01:00

exchange checks added to nsclient config

This commit is contained in:
Páll Guðjón Sigurðsson 2010-09-20 11:16:24 +00:00
parent 7b5ffc6486
commit e261ce37e0
3 changed files with 13 additions and 5 deletions

View File

@ -45,6 +45,10 @@ check_eva=cmd /c scripts\check_eva\check_eva.exe
[External Alias] [External Alias]
[NRPE Handlers] [NRPE Handlers]
check_mailbox_health=cmd /c echo Scripts\check_exchange\MailboxHealth.ps1 | PowerShell.exe -Command -
check_public_folders=cmd /c echo Scripts\check_exchange\PublicFoldersMounted.ps1 | PowerShell.exe -Command -
check_replication=cmd /c echo Scripts\check_exchange\ReplicationHealth.ps1 | PowerShell.exe -Command -
[NRPE Client Handlers] [NRPE Client Handlers]

View File

@ -30,14 +30,14 @@
# #
# On the check_nrpe command include the -t 20, since it takes some time to load # On the check_nrpe command include the -t 20, since it takes some time to load
# the Exchange cmdlet's. # the Exchange cmdlet's.
Write-Host "Test"
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
$NagiosStatus = "0" $NagiosStatus = "0"
$NagiosDescription = "" $NagiosDescription = ""
$LongOutput = ""
ForEach ($DataBase in Get-MailboxDatabase) { ForEach ($DataBase in Get-MailboxDatabase) {
ForEach ($Status in Get-MailboxDatabaseCopyStatus -Identity $DataBase.Name) { ForEach ($Status in Get-MailboxDatabaseCopyStatus -Identity $DataBase.Name) {
$LongOutput = $LongOutput + $Status.Name + " is " + $Status.Status + "`n"
switch ($Status.Status) { switch ($Status.Status) {
"Failed" { "Failed" {
$NagiosStatus = "2" $NagiosStatus = "2"
@ -99,5 +99,7 @@ if ($NagiosStatus -eq "2") {
} else { } else {
Write-Host "OK: All Mailbox Databases are mounted and healthy." Write-Host "OK: All Mailbox Databases are mounted and healthy."
} }
Write-Host $LongOutput
exit $NagiosStatus exit $NagiosStatus

View File

@ -35,11 +35,10 @@ Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
$NagiosStatus = "0" $NagiosStatus = "0"
$NagiosDescription = "" $NagiosDescription = ""
$LongOutput = ""
ForEach ($Type in Test-ReplicationHealth -Identity $env:computername) { ForEach ($Type in Test-ReplicationHealth -Identity $env:computername) {
# Look for failed replications # Look for failed replications
if ($TypeResult -like "*FAILED*") { if ($Type.Result -like "*FAILED*") {
# Format the output for Nagios # Format the output for Nagios
if ($NagiosDescription -ne "") { if ($NagiosDescription -ne "") {
$NagiosDescription = $NagiosDescription + ", " $NagiosDescription = $NagiosDescription + ", "
@ -65,6 +64,7 @@ ForEach ($Type in Test-ReplicationHealth -Identity $env:computername) {
$NagiosStatus = "1" $NagiosStatus = "1"
} }
} }
$LongOutput = $LongOutput + $Type.Result + " on " + $Type.Check + "`n"
} }
# Output, what level should we tell our caller? # 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 "OK: All replication tests passed."
} }
Write-Host $LongOutput
exit $NagiosStatus exit $NagiosStatus