[Xymon] custom scripts for windows servers
Robert Herron
robert.herron at gmail.com
Tue May 22 23:44:49 CEST 2018
Also, do you have an externals line in the bbwin section? Do you have
other external tests on this host that work?
On Fri, May 18, 2018, 8:26 AM Chris Pretorius <chrisp at lightstoneauto.co.za>
wrote:
> Hi
>
>
>
> Our dev decided to create a groovy script since the tests it needs to do
> is complex.
>
>
>
> He created a small test script which I copied to the ext folder:
>
> test.groovy
>
> def file1 = new File('C:/Program Files (x86)/BBWin/tmp/test.txt')
>
> file1.write 'Test message'
>
>
>
> Added to externals block:
>
>
>
> <externals>
>
> <setting name="timer" value="3m" />
>
> <setting name="logstimer" value="60s" />
>
> <load value="groovy test.groovy" timer="1m" />
>
> <!-- 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>
>
>
>
> I Also tried the full path to test.groovy.
>
> Restarted the client, I even set the log on as from Local system to
> Administrator.
>
>
>
> The file “test.txt” is not created.
>
> There’s no errors logged in the BBWin.log
>
>
>
> How can I be sure BBwin is executing the script?
>
> Groovy is installed. “C:\groovy-2.4.15\bin\groovy”
>
> I am able to run the script from command prompt and the test.txt file is
> created.
>
>
>
> Kind regards
>
> *From:* Beck, Zak <zak.beck at accenture.com>
> *Sent:* Friday, May 4, 2018 12:37 PM
> *To:* Chris Pretorius <chrisp at lightstoneauto.co.za>; xymon at xymon.com
> *Subject:* RE: custome scripts for windows servers
>
>
>
> Hi Chris
>
>
>
> BBWin or WinPSClient do not have a built in scripting language, they only
> support scripts that the OS already knows how to run. This will depend on
> what tools you have installed on your servers.
>
>
>
> By default, Windows servers will definitely run VBScript (VBS) and most
> newer versions (Windows Server 2008 onwards, Windows 7 onwards) will run
> Powershell.
>
>
>
> There are a number of script samples in BBWin in the externals folder and
> for WinPSClient, the documentation is fairly complete in this area.
>
>
>
> Both BBWin and WinPSClient can return data from any script if that script
> writes a text file to the tmp folder (which is a subfolder of BBWin or
> WinPSClient).
>
>
>
> Below is a Powershell example of testing DNS lookup for google.com – this
> is not necessarily the best way to test DNS, it is provided as a simple
> example of an external script.
>
>
>
> If this were saved as “google-dns.ps1”, and a SHA1 hash of the file
> generated, it can be used with the WinPSClient by adding a line like this
> to client-local.cfg – you do not need to replace the {script} with
> anything, the client will do that:
>
>
>
> external:everyscan:sync:http://<xymon
> server>/PS_Updates/google-dns.ps1|SHA1|<sha1
> value>|powershell.exe|-executionpolicy remotesigned -noprofile -file
> "{script}"
>
>
>
> Cheers
>
>
>
> Zak
>
>
>
> param(
>
> [string] $TestName = 'googledns'
>
> )
>
>
>
>
>
> $scriptdir = split-path -parent $MyInvocation.MyCommand.Definition
>
> $datadir = join-path $scriptdir '..\tmp' -Resolve
>
>
>
> $groupColour = 'green'
>
>
>
> try
>
> {
>
> $results = [System.Net.DNS]::GetHostAddresses('www.google.com')
>
> }
>
> catch
>
> {
>
> $groupColour = 'red'
>
> $message = "Error performing DNS query: $_"
>
> }
>
>
>
> if ($groupColour -eq 'green')
>
> {
>
> $ips = $results | foreach { $_.IPAddressToString }
>
> $message = "Result of DNS query:`r`n"
>
> $message += ($ips -join "`r`n")
>
> }
>
>
>
> $timeFormatted = Get-Date -Format 'dd-MMM-yyyy HH:mm'
>
> $output = `
>
> @"
>
> $($groupColour)+10m $TestName as at $timeFormatted (updated approx every 5
> minutes)
>
>
>
> DNS query for www.google.com
>
>
>
> $message
>
>
>
> <br><p>Information from $($Env:computername)</p>
>
>
>
> "@
>
>
>
> $dataFile = Join-Path $datadir $TestName
>
> $output | Set-Content $datafile
>
>
>
>
>
> *From:* Xymon [mailto:xymon-bounces at xymon.com <xymon-bounces at xymon.com>] *On
> Behalf Of *Chris Pretorius
> *Sent:* Friday, 4 May 2018 10:32
> *To:* xymon at xymon.com
> *Subject:* [External] [Xymon] custome scripts for windows servers
>
>
>
> Good day all
>
>
>
> Can someone please send links to example custom scripts for windows server.
>
>
>
> We are mostly a Linux shop but have a few Windows servers. They are
> monitored on xymon and it is currently a mix of BBwin and winpsclients.
>
>
>
> My google skills has let me down as I could not find examples except for
> bash script examples..
>
>
>
> Does BBwin or winpsclient support groovy script or can I only use VBscript?
>
>
>
> Kind regards
>
>
>
> [image: https://lsc-assets.scdn1.secure.raxcdn.com/lssig/AUTOlogoW.png]
>
>
>
> *Chris Pretorius*
>
> [image: https://lsc-assets.scdn1.secure.raxcdn.com/lssig/phone.png]
>
> 0872367740
>
> [image: https://lsc-assets.scdn1.secure.raxcdn.com/lssig/email.png]
>
> chrisp at lightstone.co.za
>
> [image: https://lsc-assets.scdn1.secure.raxcdn.com/lssig/web.png]
>
> www.signio.co.za
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.signio.co.za&d=DwMFAg&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=S-aLwpx-PHBTBMIG_c2JczRC0SfuZCmsiH9Iams25FI&m=pSAlFEj4hRKElAZwLvHsRfWzfQja9_NJ4QDJTay2kjA&s=r79tHecFmkZS4Rbtj5kLMAraNByFoS72NbMZKxd1RA0&e=>
>
> [image: https://lsc-assets.scdn1.secure.raxcdn.com/lssig/address.png]
>
> Centurion Square, 3rd Floor, cnr Heuwel and Gordon Hood rd, Centurion
>
>
> This communication is subject to Lightstone's email disclaimer
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.lightstone.co.za_portal_content_email-2Ddisclaimer.aspx&d=DwMFAg&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=S-aLwpx-PHBTBMIG_c2JczRC0SfuZCmsiH9Iams25FI&m=pSAlFEj4hRKElAZwLvHsRfWzfQja9_NJ4QDJTay2kjA&s=WjjJGAqyaTDuEZEXWKI9C5QN006jNlgDG-2MU9-IWoA&e=>
>
>
>
>
>
>
>
> ------------------------------
>
>
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise confidential information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the e-mail by you is prohibited. Where allowed
> by local law, electronic communications with Accenture and its affiliates,
> including e-mail and instant messaging (including content), may be scanned
> by our systems for the purposes of information security and assessment of
> internal compliance with Accenture policy. Your privacy is important to us.
> Accenture uses your personal data only in compliance with data protection
> laws. For further information on how Accenture processes your personal
> data, please see our privacy statement at
> https://www.accenture.com/us-en/privacy-policy.
>
> ______________________________________________________________________________________
>
> www.accenture.com
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20180522/802c2f21/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 574 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20180522/802c2f21/attachment.png>
More information about the Xymon
mailing list