New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


SSH Scripting Error

Votes:

0

Your Vote:

Up

Down

Alright - I've been fighting with this for two days. It's time to ask for help.

I'm trying to set up a SSH sensor for a UNIX-based system to monitor the number of client application licenses we are using for a proprietary application. We have a script tool from the software vendor that returns the licenses in use and we were using another network monitoring software with this script to return an integer value that we monitored.

So, I've already gotten through that I need to update the output value to exitcode:value:message and we had to create a custom wrapper script to output values in this manner. The script is as follows:

print 0:$(/var/prtg/scripts/uvlictool |grep "license seats are in use" |cut -d " " -f 1):OK

When you run the script in the UNIX command line, it outputs exactly as the syntax requires. It also outputs the same if you pipe it into a file like output.txt. It will return output that looks exactly like so:

0:204:OK

The issue is though, whenever I run this script as a sensor in PRTG, I only get back an error code of "No valid input from SSH Shell". I'm at a loss here. Nothing in the logs to even begin pointing me to what I am doing wrong. I just got no data and a sensor in an alarm state. I've tried changing the output to print, printf, echo, different formatting changes... none of which has changed any of the above results.

shell ssh unix

Created on Feb 19, 2015 8:40:22 PM by  daustin (0) 1



3 Replies

Votes:

0

Your Vote:

Up

Down

Have you tried the following approach:

#!/bin/bash
COUNT="$(/var/prtg/scripts/uvlictool | grep 'license seats are in use' |cut -d ' ' -f 1)"
echo 0:${COUNT}:OK

Should work just fine :)

Created on Feb 20, 2015 8:01:52 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Unfortunately, that approach does not work. /bin/bash is not present on the system and cannot be used as an interpreter. So when I run a the same command using the UNIX shell, as follows:

COUNT="$(/var/prtg/scripts/uvlictool | grep 'license seats are in use' |cut -d ' ' -f 1)"
echo 0:${COUNT}:OK

I get output like this:

:OK4

When I output it to a text file, it comes out in the correct format though. Still, it does not make the PRTG SSH Shell monitor like it any more. I still get the same error. I have also tried with invoking the #!\bin\sh interpreter and the whole script just errors out.

Created on Feb 20, 2015 12:56:06 PM by  daustin (0) 1



Votes:

0

Your Vote:

Up

Down

Is it a typo or did you indeed use #!\bin\sh? Only asking because it should be #!/bin/sh?

Created on Feb 23, 2015 12:43:46 PM by  Stephan Linke [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.