[Xymon] External Powershell script not working

Michael Schultheiss schultmc at ivytech.edu
Wed Aug 6 16:40:23 CEST 2014


We've created an external powershell script for monitoring one of our
Exchange servers. The script has been listed in the externals section of
BBwin.cfg and we've verified the script is outputing to 
C:\Program Files (x86)\BBWin\tmp

but the results aren't showing up on the xymon server page.

We have other servers running external scripts but haven't been able to
determine the difference between the working external script and the
non-working one.

Powershell script:


Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Support -ErrorAction SilentlyContinue

$count = Get-TransportServer | Get-Message | Measure-Object | Select-Object Count -ExpandProperty Count
$sAlarm = "green"
$datetime = (Get-Date).ToString()

If ($count -gt 150) {
    $sAlarm = "yellow"
}    

$sAlarm,$datetime | Out-File -FilePath "C:\Program Files (x86)\BBWin\tmp\exchqueues"

Output:

green
8/6/2014 10:32:22 AM

BBwin.cfg snippet:


<externals>
	<setting name="timer" value="5m" />
	<setting name="logstimer" value="60" />
	<load value="C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -nologo -ExecutionPolicy Unrestricted -File 'C:\Program Files(x86)\BBWin\ext\exchqueues.ps1'" />
	<!-- externals launch examples
	<load value="cscript mybbscript.vbs" />
	<load value="myexternal.exe" />
	<load value="cscript wlbs.vbs" timer="15m" />
	<load value="cluster.exe" timer="90s" /> -->
</externals>

-- 
-------------------------------------------------------------
Michael Schultheiss, RHCSA, RHCE   OIT Administration
Sr. Unix Systems Engineer          Ivy Tech Community College
schultmc at ivytech.edu



More information about the Xymon mailing list