Hello! I'm copy/write powershell xml script for monitoring Exchange DB Status.
$servername = "servermbx" $pssession = new-pssession -configurationname "Microsoft.Exchange" -connectionuri "http://$servername/Powershell" -Authentication Kerberos $startsession = import-pssession -session $pssession -allowclobber -WarningAction SilentlyContinue | out-null $dbstatus = get-mailboxdatabasecopystatus | select name,ActiveCopy $dbcount = (Get-MailboxDatabaseCopyStatus).count $prtg = '<?xml version="1.0" encoding="Windows-1252" ?> <prtg>' foreach ($db in $dbstatus) { $dbname = $db.Name $dbstate = $db.ActiveCopy $dbvalue = "10" if ($dbstate -match "False") { $dbvalue = "1" } if ($dbstate -match "Active") { $dbvalue = "2" } $prtg +=" <result> <channel>$dbname</channel> <value>$dbvalue</value> <showChart>1</showChart> <showTable>1</showTable> <mode>Absolute</mode> </result> " } $prtg +="<text>The number of databases: $dbcount</text> </prtg>" remove-pssession -session $pssession $prtg
How i can edit this script or this:
When state of database False - sensor OK, state of database - Active - Sensor Error.
Now, in both cases state False or Active PRTG monitor say what sensor is Ok.
Add comment