KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Script Returns No Result

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
jjohnso7



Joined: 24 Aug 2016
Posts: 5

PostPosted: Wed Aug 24, 2016 3:22 pm    Post subject: Script Returns No Result Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Wed Aug 24, 2016 4:45 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
jjohnso7



Joined: 24 Aug 2016
Posts: 5

PostPosted: Thu Aug 25, 2016 7:10 am    Post subject: Reply with quote

Your changes worked.

Thank you!

James
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Thu Aug 25, 2016 10:53 am    Post subject: Reply with quote

You are welcome!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index