[Xymon] [External] Re: XymonPSClient v2.27 for Windows

Beck, Zak zak.beck at accenture.com
Fri Dec 15 11:59:04 CET 2017


Hi Stef

Usermsg - fine, I can merge this change in the next release.

Special handling for powershell scripts - I guess you could do that, but we use the method in the documentation and it works fine:

external:SCHEDULE:METHOD:SCRIPT|HASH|HASHVALUE|PROCESS|ARGUMENTS

external:everyscan:sync:http://server1/XymonPS/script.ps1|MD5|536476abc234c3c1|powershell.exe|-executionpolicy remotesigned –file "{script}"

(i.e. set PROCESS = powershell.exe)

That way we don’t need special handling in the client for various types of script (ps1, vbs, whatever), we can just adjust the parameters supplied in client-local.cfg.

Thanks

Zak

-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Stef Coene
Sent: 15 December 2017 09:59
To: xymon at xymon.com
Subject: [External] Re: [Xymon] XymonPSClient v2.27 for Windows

Hi,

I changed the XymonPSClient so it understand messages for the user channel. If a file is found in the externaldata location and it begins with 'usermg', the file is transmitted over the user channel. Of course you also need a parser on the server for the data.
We use this to forward inventory information from the client to the server.

An other patch is for .ps1 external scripts.
We had some troubles getting them running. If the external script ends with .ps1, the powershell is executed and the script is supplied as parameter.


Stef

--- xymonclient-2.27.ps1        2017-12-15 09:29:56.190932061 +0100
+++ xymonclient-2.27-mine.ps1   2017-12-15 10:44:28.964192943 +0100
@@ -2628,6 +2628,13 @@
                          WriteLog "Sending Xymon message for file
$($f.Name) - test $($testName), host $($hostName): $msg"
                          XymonSend $msg $script:XymonSettings.serversList
                      }
+                    elseif ($statusFileContent -match '^usermsg ')
+                    {
+
+                        $msg = $statusFileContent
+                        WriteLog "Sending Xymon usermsg: $msg"
+                        XymonSend $msg $script:XymonSettings.serversList
+                    }
                      else
                      {
                          WriteLog "External File: $($f.Name) - format not recognised"
@@ -3581,6 +3588,14 @@
                          -WorkingDirectory $script:XymonSettings.externalscriptlocation `
                          $process $arguments
                  }
+                         elseif  ( $process -match '.ps1')
+                {
+                    WriteLog "Executing powershell -argument $process
with no arguments"
+                    $extpid = Start-Process -PassThru `
+                        -WindowStyle Hidden `
+                        -WorkingDirectory
$script:XymonSettings.externalscriptlocation `
+                        powershell -argument "$process"
+                }
                  else
                  {
                      WriteLog "Executing $process with no arguments"
_______________________________________________
Xymon mailing list
Xymon at xymon.com
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.xymon.com_mailman_listinfo_xymon&d=DwIGaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=S-aLwpx-PHBTBMIG_c2JczRC0SfuZCmsiH9Iams25FI&m=2k21sXPQr448263txJlhIt_teyQAI9JrnSKQcynK0bI&s=vF2k56kskxNm5JhEovHxho2qy7JQcSs9-odjoqhZblM&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.
______________________________________________________________________________________

www.accenture.com


More information about the Xymon mailing list