[Xymon] XymonPSClient v2.27 for Windows

Stef Coene stef.coene at docum.org
Fri Dec 15 10:58:48 CET 2017


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"



More information about the Xymon mailing list