[Xymon] External Powershell script not working

Lennon, Padraig Padraig.Lennon at pioneerinvestments.com
Thu Aug 7 09:18:09 CEST 2014


Hi Michael,

I ran into this issue a few times before (hopefully this fix works for
you..)

You need to ensure that the output file is written in ASCII mode
otherwise the Xymon cannot understand the format (to my limited
knowledge..)

Add "-Encoding ASCII" as shown here with your example

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


regards
- Padraig Lennon 

-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Shea, Graeme A
Sent: Wednesday, August 06, 2014 10:49 PM
To: Michael Schultheiss; xymon at xymon.com
Subject: Re: [Xymon] External Powershell script not working

Hello Michael,

if you concatenate the strings with a space between them follow by a
blank line rather than having separate lines it may work. Early versions
of BBWin needed the first line to contain the date (or at least more
information) after the "green", don't know if this has been fixed in the
later versions. 

Regards
Graeme

-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Michael
Schultheiss
Sent: Thursday, 7 August 2014 12:40 AM
To: xymon at xymon.com
Subject: [Xymon] External Powershell script not working

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
_______________________________________________
Xymon mailing list
Xymon at xymon.com
http://lists.xymon.com/mailman/listinfo/xymon

Important - This email and any attachments may be confidential. If
received in error, please contact us and delete all copies. Before
opening or using attachments check them for viruses and defects.
Regardless of any loss, damage or consequence, whether caused by the
negligence of the sender or not, resulting directly or indirectly from
the use of any attached files our liability is limited to resupplying
any affected attachments. Any representations or opinions expressed are
those of the individual sender, and not necessarily those of the
Department of Education and Early Childhood Development.
_______________________________________________
Xymon mailing list
Xymon at xymon.com
http://lists.xymon.com/mailman/listinfo/xymon
-------------- next part --------------



The information in this e-mail and in any attachments is confidential and intended solely for the attention and use of the named addressee(s). This information may be subject to legal, professional or other privilege and further distribution of it is strictly prohibited without our authority. If you are not the intended recipient, you are not authorised to disclose, copy, distribute, or retain this message or any part of it, and should notify us immediately. 

Please note that for business and regulatory purposes, emails and telephone calls to and from us, or our affiliates, may be subject to recording, storage and review. This email has been automatically scanned for the presence of computer viruses, profanities and certain file types but we cannot accept  responsibility for any loss or damage whatsoever caused by same. 

Pioneer Investment Management Limited. 

1 George’s Quay Plaza, George’s Quay, Dublin 2, Ireland.

Registered in Ireland no. 287793.


More information about the Xymon mailing list