<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Bookman Old Style";
        panose-1:2 5 6 4 5 5 5 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Arial","sans-serif";
        color:blue;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">

<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US">Hi Jeremy,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US">You are my saviour!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US">I’ve been banging my head against an issue for about 3 days now. I’ve been trying to get MQ monitoring working on a BBWin client, however,
 despite having written a powershell script that works perfectly as an external script when I run it from command line it doesn’t work properly when I add it to BBWin.cfg (it extracts the data from mq but one of the commands further in the script doesn’t work).
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US">I’ve just changed the output from my script so all it does is pull the data from MQ, write a header line to a file (client hostname.mqcollect
 mqcollect)  then append the MQ data. If I drop that file in the BBWin tmp directory, BBWin changes it before it sends it to the server however, if I drop it in /ext and I then use your script to send that file to Xymon “Xymonsend.ps1" server @ "C:\Program
 Files (x86)\BBWin\ext\mq..result", it works perfectly. The server correctly sees it as client data and I can add Queues to monitor into analysis.cfg.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US">Thank you very, very much.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy">Neil Simmonds</span></b><span style="color:blue"><o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:8.0pt;font-family:"Calibri","sans-serif";color:gray">Senior Operations Analyst (Operations Support Group)</span></b><b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:gray"><br>
</span></b><b><span style="font-size:10.0pt;font-family:"Bookman Old Style","serif";color:#CC9900">Express Gifts Limited</span></b><span style="color:blue"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Calibri","sans-serif";color:black">Express House</span><span style="color:blue"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Calibri","sans-serif";color:black">Clayton Business Park</span><span style="color:blue"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Calibri","sans-serif";color:black">Accrington</span><span style="color:blue"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Calibri","sans-serif";color:black">Lancashire</span><span style="color:blue"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:"Calibri","sans-serif";color:black">BB5 5JY
<br>
T: 01254 303092 | E: <a href="mailto:neil.simmonds@Express-Gifts.co.uk"><span style="color:blue">neil.simmonds@Express-Gifts.co.uk</span></a>
</span><span style="color:blue"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:blue"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Xymon [mailto:xymon-bounces@xymon.com]
<b>On Behalf Of </b>Jeremy Laidman<br>
<b>Sent:</b> 15 January 2014 07:15<br>
<b>To:</b> xymon@xymon.com<br>
<b>Subject:</b> [Xymon] A simple xymon client in Powershell<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Guys<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I thought some of you might find this useful.  It's an implementation of the "xymon" client program written in 6 lines of Powershell,  It lacks the ability to wait for data returned by the Xymon server, but it's fine for sending status
 and data messages.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">param($xymsrv=$(throw "ERROR: Specify xymon server and message lines"))<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">$socket=(new-object System.Net.Sockets.TcpClient($xymsrv,1984))<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">$writer=new-object System.IO.StreamWriter $socket.GetStream()<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">if ($args[0] -eq "@") { foreach ($line in Get-Content $args[1]) {$writer.Write($line+"`n")} }<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">else { foreach ($line in $args) {$writer.Write($line+"`n")} }<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">$writer.close()<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">You could run it like this:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">C:\>powershell -file xymon-powershell.ps1 %XYMSRV% "status %COMPUTERNAME%.mytest green %DATE% %TIME%" "The status of 'mytest' is 'satisfactory' at %DATE% %TIME%" "" "here's the last line"<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">or if you have the status/data message in a file:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">C:\>powershell -file xymon-powershell.ps1 %XYMSRV% @ statusfile.txt<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Cheers<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Jeremy<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>


<span style="mso-ascii-font-family:Calibri;mso-hansi-font-family:Calibri;mso-bidi-font-family:
Calibri;color:black"></span><p></p>

<p class="MsoNormal"><span style="font-size:9.0pt">Name & Registered Office:
EXPRESS GIFTS LIMITED, 2 GREGORY ST, HYDE, CHESHIRE, ENGLAND, SK14 4TH, Company
No. 00718151.</span></p>

<p class="MsoNormal" style="border:none;mso-border-bottom-alt:solid windowtext 1.5pt;
padding:0cm;mso-padding-alt:0cm 0cm 1.0pt 0cm"><span style="font-size:9.0pt">Express
Gifts Limited is authorised and regulated by the Financial Conduct Authority</span></p>
<hr />

<p class="MsoNormal"><span style="font-size:9.0pt">NOTE: This email and any
information contained within or attached in a separate file is confidential and
intended solely for the Individual to whom it is addressed. The information or
data included is solely for the purpose indicated or previously agreed. Any
information or data included with this e-mail remains the property of Findel
PLC and the recipient will refrain from utilising the information for any
purpose other than that indicated and upon request will destroy the information
and remove it from their records. Any views or opinions presented are solely
those of the author and do not necessarily represent those of Findel PLC. If
you are not the intended recipient, be advised that you have received this
email in error and that any use, dissemination, forwarding, printing, or
copying of this email is strictly prohibited. No warranties or assurances are
made in relation to the safety and content of this e-mail and any attachments.
No liability is accepted for any consequences arising from it. Findel Plc
reserves the right to monitor all e-mail communications through its internal
and external networks. If you have received this email in error please notify
our IT helpdesk on +44(0) 1254 303030</span></p>

<p class="MsoNormal"><span style="font-size:9.0pt"> </span></p>




</body>
</html>