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
Script Returns No Result
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
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:
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: Select all
$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
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact: