[Xymon] Xymon PS Client and External VBS scripts

zak.beck at accenture.com zak.beck at accenture.com
Thu Apr 30 09:57:52 CEST 2015


Hi

 

The simplest way is to write your tests as Powershell scripts then use XymonSend.ps1 from the Windows PS Client to send in the results.

 

https://svn.code.sf.net/p/xymon/code/sandbox/WinPSClient/xymonsend.ps1

 

Cheers

 

Zak 

 

From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of martin.wojak at delwp.vic.gov.au
Sent: 30 April 2015 06:14
To: xymon at xymon.com
Subject: [Xymon] Xymon PS Client and External VBS scripts

 

Dear All, 

Does anyone have a way to run VBS External scripts via Windows Schedule Tasks, and send the results directly back to the Xymon Server? 

Martin. 

----- Forwarded by Martin Wojak/DSE/VICGOV1 on 30/04/2015 03:06 PM ----- 

From:        Brandon Dale <BDale at kitchengroup.com.au <mailto:BDale at kitchengroup.com.au> > 
To:        "martin.wojak at delwp.vic.gov.au <mailto:martin.wojak at delwp.vic.gov.au> " <martin.wojak at delwp.vic.gov.au <mailto:martin.wojak at delwp.vic.gov.au> >, 
Cc:        "stef.coene at docum.org <mailto:stef.coene at docum.org> " <stef.coene at docum.org <mailto:stef.coene at docum.org> > 
Date:        30/04/2015 01:44 PM 
Subject:        RE: Xymon PS Client and External VBS scripts 

  _____  




Hey Martin, 
  
I’m also just a sysadmin, this is something I have wanted to do as well as there are some vbscripts I could use as externals but haven’t worked out an easy way yet. I don’t really know vbscript either which doesn’t help :( 
  
These are the options I can think of: 
  
1.       Use bbwin just for these external tests. 
2.       Use Get-Content somehow in powershell to get the information you need from the output of those scripts and send that to xymon using xymonsend 
3.       I “think” there is a way to run vbscript code inside powershell, you could possibly put it inside a powershell script and send directly to xymon. 
  
The last and ideal option is rewrite them in powershell, I know there are some similar scripts already out there but they would need to be modified to work with xymon. For example  <https://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542> https://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542 and there are some nagios scripts that do similar things. 
  
Option 1 is the easiest if you don’t have the time to play around with PowerShell especially if you already have bbwin on all those servers. You should be able to just disable all the normal tests for the bbwin client by commenting out something in the .cfg file and use it only to send these externals. 
  
Regards, 
  
Brandon Dale 
Network Administrator 
  
Kitchen | Group 
  
1 Wella Way Somersby, NSW, 2250 
T (02) 4343 6000 | D (02) 4343 6052 | F (02) 4343 6080 
E BDale at kitchengroup.com.au <mailto:%20BDale at kitchengroup.com.au>  
please consider the environment before printing this e-mail 

  _____  


Disclaimer: This communication is confidential and intended only for the addressee. It may contain legally privileged information. By the use of email over the Internet, Kitchen Group is not waiving either confidentiality of, or legal privilege in, the contents of this email and any attachments. If you are not the addressee you may not use, disseminate or copy this information. If you have received this information in error please notify us immediately. Whilst we have taken all reasonable care to ensure that neither our system, this email nor any attachments has a virus, it is impossible to guard against every possible virus. We advise you to scan the email and any attachments with your anti virus software prior to use. We do not accept liability for any loss or damage which may arise from receipt of this email or any attachments. 

  _____  


  
  
  
From: martin.wojak at delwp.vic.gov.au <mailto:martin.wojak at delwp.vic.gov.au>  [ <mailto:martin.wojak at delwp.vic.gov.au> mailto:martin.wojak at delwp.vic.gov.au] 
Sent: Tuesday, 28 April 2015 4:02 PM
To: Brandon Dale
Cc: stef.coene at docum.org <mailto:stef.coene at docum.org> 
Subject: Xymon PS Client and External VBS scripts 
  
Hi Brandon, 

I'm trying to migrate our 300 VMs from bbwin to PS-client.  I love some of the new functionality of the PS client, that bbwin doesn't have (eg. dirtime, dirsize, restart failed service).  But I have 2 External VBS scripts that I would like to keep using. 

I had a look at converting our 2 VBS scripts that are currently called from BBwin, to be able to use xymonsend.ps1 (or some other way), to talk directly to our Xymon server.   I couldn't work out how to do it.  I'm just a SysAdmin, not a programmer or developer, so not very good with VB or PS. 

If you have time, and would be easy to do, can you work out how I can make these 2 scripts operate as Windows Scheduled tasks and send data directly to our Xymon server. 

Ta. 

Martin. 

Martin Wojak | Senior Infrastructure Support Officer (Fire) |Information Services Division 
Corporate Services | Department of Environment, Land, Water & Planning 
Level 9, 8 Nicholson St, East Melbourne, Victoria 3002 
T: 03 9637 8470 | M: 0421 445 529 | E:  <mailto:martin.wojak at delwp.vic.gov.au> martin.wojak at delwp.vic.gov.au 

----- Forwarded by Martin Wojak/DSE/VICGOV1 on 23/04/2015 02:00 PM ----- 

From:        Brandon Dale < <mailto:BDale at kitchengroup.com.au> BDale at kitchengroup.com.au> 
To:        Stef Coene < <mailto:stef.coene at docum.org> stef.coene at docum.org>, " <mailto:xymon at xymon.com> xymon at xymon.com" < <mailto:xymon at xymon.com> xymon at xymon.com>, 
Date:        08/04/2015 12:57 PM 
Subject:        Re: [Xymon] Xymon PS Client 
Sent by:        "Xymon" < <mailto:xymon-bounces at xymon.com> xymon-bounces at xymon.com> 

  _____  



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> 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 
 
 
-----Original Message-----
From: Xymon [ <mailto:xymon-bounces at xymon.com> mailto:xymon-bounces at xymon.com] On Behalf Of Stef Coene
Sent: Tuesday, 7 April 2015 11:47 PM
To:  <mailto:xymon at xymon.com> 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 
_______________________________________________ 
Xymon mailing list 
 <mailto:Xymon at xymon.com> Xymon at xymon.com 
 <http://lists.xymon.com/mailman/listinfo/xymon> http://lists.xymon.com/mailman/listinfo/xymon_______________________________________________
Xymon mailing list
 <mailto:Xymon at xymon.com> Xymon at xymon.com
 <http://lists.xymon.com/mailman/listinfo/xymon> http://lists.xymon.com/mailman/listinfo/xymon 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20150430/b2053c8d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1161 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20150430/b2053c8d/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6831 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20150430/b2053c8d/attachment.bin>


More information about the Xymon mailing list