Xymon Mailing List Archive search

Xymon PS Client

2 messages in this thread

list Stef Coene · Tue, 07 Apr 2015 15:47:03 +0200 ·
Hi,

We are using the Powershell client on new servers. But we are missing the option to execute external scripts. Has anyone an updated version or written a patch so you can execute external scripts with the Powershell cient?

And if not, how do you execute external scripts when using the Powershell client?


Stef
list Brandon Dale · Wed, 8 Apr 2015 02:57:19 +0000 ·
Might be a better way but this is how I do it (my external scripts are written in PowerShell however)


1. I put http://sourceforge.net/p/xymon/code/HEAD/tree/sandbox/WinPSClient/xymonsend.ps1 onto each server inside the same directory as the PowerShell client

2. I dot source this into my external scripts (which I normally store in c:\xymon\ext to keep it simple) and use it to send the status messages to xymon.

3. Run these as scheduled tasks in windows.


From the readme:


"Talking to the Xymon Server

===========================

The "xymonsend.ps1" script contains a PowerShell function "XymonSend"

that lets you communicate with the Xymon server in the same way that

the "bb" utility does on the Unix platforms. To use it, you must

"source" this into your PowerShell commandline window: At the "PS"

prompt, enter


                PS C:\xymon> . .\xymonsend.ps1

.."


Here's an example of how I use it -  pointless script to test if c:\windows exists and send the result to xymon (but you get the idea). It will display as the column “customtest” for the host “testserver01”


$date=get-date -format "ddd MMM dd HH':'mm':'ss zzz yyyy"

$DELAY="+10m"

$xymonserver="xymon01"

$machine="testserver01"

$column="Customtest"


#test logic

if(Test-Path c:\windows){

    $colour="green"

    $msg="&green ALL OK!"

    } else {

    $colour="red"

    $msg="&red world is ending"

    }


#send to xymon server

. c:\xymon\xymonsend.ps1


xymonsend "status$delay $machine.$column $colour $date


$msg


" "$xymonserver"


Then schedule that in windows to run however often you want, you need to set the delay to a value longer than then the interval between each run of your schedule task to avoid it going purple.


Regards,


Brandon
quoted from Stef Coene


-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Stef Coene
Sent: Tuesday, 7 April 2015 11:47 PM
To: xymon at xymon.com
Subject: [Xymon] Xymon PS Client


Hi,


We are using the Powershell client on new servers. But we are missing the option to execute external scripts. Has anyone an updated version or written a patch so you can execute external scripts with the Powershell cient?


And if not, how do you execute external scripts when using the Powershell client?


Stef