View previous topic :: View next topic |
Author |
Message |
shernyeexing
Joined: 02 Aug 2009 Posts: 20
|
Posted: Tue May 15, 2012 2:36 am Post subject: Monitor MSExchange with HM |
|
|
MSExchange ,the Exchange Command Management Console with PowerShell can get some infomation such as mailbox statistics ,mail server statistics to monitor the exchange, but these commands can only run at the Exchange Command Management Console .
How can i run these commands like get-mailbox through HM(with rma) for monitoring?
thanks. |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Tue May 15, 2012 6:51 am Post subject: |
|
|
You may use Shell Script test method to run MS Exchange Powershell commands.
E.g. You may use the following powershell script with Shell Script test method to check MS Exchange mailbox database state:
Code: | Add-PSSnapin Microsoft.Exchange.*
$mounted = (Get-MailboxDatabase -Identity $args[0] -status).Mounted
if($mounted)
{echo $statusOk}
else
{echo $statusBad} |
Start CMD: powershell.exe %script% %params%
Please check the manual or visit our web site for more information at:
Shell Script test method: http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#chkShell |
|
Back to top |
|
|
shernyeexing
Joined: 02 Aug 2009 Posts: 20
|
Posted: Tue May 15, 2012 8:07 pm Post subject: |
|
|
thank you first.
there is a ps1 file, when execute on the remote exchange server , it is ok.
but can't be executed on the HM server by rma.
the ps1 file:
Add-PSSnapin Microsoft.Exchange.*
$HMMailNums1 = Get-MailboxStatistics -Identity archiver | ft -h totalitemsize > c:\test\test.tmp1
$HMMailNums2 = (get-content c:\test\test.tmp1)[1] > c:\test\test.tmp2
$HMMailNums = (get-content c:\test\test.tmp2 -delimiter B)[0]
echo $HMMailNums
the error msg:
[9:54:21] Agent: 172.28.90.2 is going to execute "PowerShell: Get-MailboxStatistics totalitemsize" script ...
[9:54:22] Script started, invalid result received:
----------
?
C
the reply:
Error: Invalid result (C
the startcmd:
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe %script% %params%
or
powershell.exe %script% %params% |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed May 16, 2012 6:40 am Post subject: |
|
|
Shell Script test has special script output requirement.
Your script should echo string like
scriptres:Host is alive:1000 ms
or
scriptres:Bad:90 % e.t.c.
With such output HostMonitor is able to recognise test Status and Reply.
You may find Powershell Script sample in HostMonitor Script Manager.
Please check for details at: http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#chkShell
Also, what HostMonitor and RMA version do you use ? |
|
Back to top |
|
|
shernyeexing
Joined: 02 Aug 2009 Posts: 20
|
Posted: Wed May 16, 2012 9:16 pm Post subject: |
|
|
HM VER: 8.86
RMA VER: 3.85 |
|
Back to top |
|
|
|