# Nagios Exchange 2010 Active Databases on Host Script # Author: Andy Grogan # Version 1.0 # www.telnetport25.com # ---------------------------------------- # Compatibility: # ---------------------------------------- # Nagios Version: 3.x # Exchange Version: 2010 # Powershell Version: 2.0 # NSClient++ Version: 3.x # ---------------------------------------- Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 $localServerName = Get-WmiObject -Class Win32_ComputerSystem | Select Name $DBS = Get-MailboxDatabase -Status -Server $localServerName.Name | Select Server,Name,Mounted | where {$_.Server -eq $localServerName.Name} foreach($db in $dbs){ If($db.Name -eq $null){ $Output = "OK: No Databases are active on this host" $statFlag = 0 }else{ if($db.Mounted -ne $true){ $statFlag = 1 $Output += "CRITICAL: Database Name: " + $db.Name + " " + " is not mounted" + " " }else{ $Output += "OK: Database Name: " + $db.Name + " " } } } Write-Host $Output if($statFlag -eq 1){ exit 2 }else{ exit 0 }