View previous topic :: View next topic |
Author |
Message |
jjohnso7
Joined: 24 Aug 2016 Posts: 5
|
Posted: Wed Aug 24, 2016 3:22 pm Post subject: Script Returns No Result |
|
|
I set up HostMonitor to run a shell script to get some data from a server. I have a Powershell script pasted into the HostMonitor script manager. The script runs and writes an output text file. However, HostMonitor complains when the script completes and says, Error: Script returns no results. I have tried varying the output of the Powershell script to produce various results, but it either says "Error: Invalid result" for multiple line output or "Error: Script returns no result" for a single line result. The script runs fine when it is run manually.
$z = Get-ActiveTCPConnections
Write-Output $z | Out-File "C:\MonitorServer\MonitorServerResources.txt"
$x = "1"
Write-Output $x |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Wed Aug 24, 2016 4:45 pm Post subject: |
|
|
Scripts used with Shell Script Test should return/echo reply in the following format:
ScriptRes:<Status>:<Reply text>
Several examples:
ScriptRes:Ok:10
ScriptRes:Bad:100 ms
ScriptRes:Unknown:Script requires 2 parameters
Your script can be modified the following way:
Code: | $statusOk = "ScriptRes:Ok:"
$statusBad = "ScriptRes:Bad:"
$statusUnknown = "ScriptRes:Unknown:"
$z = Get-ActiveTCPConnections
Write-Output $z | Out-File "C:\MonitorServer\MonitorServerResources.txt"
$x = "1"
Write-Output $statusOk$x |
|
|
Back to top |
|
|
jjohnso7
Joined: 24 Aug 2016 Posts: 5
|
Posted: Thu Aug 25, 2016 7:10 am Post subject: |
|
|
Your changes worked.
Thank you!
James |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Thu Aug 25, 2016 10:53 am Post subject: |
|
|
You are welcome! |
|
Back to top |
|
|
|