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

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Script Python in "SSH Script Sensor"

Votes:

0

Your Vote:

Up

Down

I wrote a script that return 0 or 1:

IF x print 1 else print 0

but in sensor I have this message: Received empty SSH response. Please check the sensor log.

python script ssh

Created on Jul 21, 2016 1:04:08 PM by  Rodrigofl (0) 1



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

Consulted a developer about it. SSH Script sensor does not support Python natively, but you can try using a bash wrapper like this:

#!/bin/bash
/path/to/python /var/prtg/script/script.py

Kind regards.

Created on Jul 26, 2016 8:55:32 AM by  Erhard Mikulik [Paessler Support]



5 Replies

Votes:

0

Your Vote:

Up

Down

Hi Rodrigo,

The returned response must look like this so that the sensor is able to make use of it: returncode:value:message

Value has to be a 64 bit integer or float and will be used as the resulting value for this sensor (e.g. bytes, milliseconds, etc.), message can be any string (maximum length: 2000 characters) and will be stored in the database.

For further details including the returncode, please check custom sensor documentation in PRTG located at Setup | PRTG API | Custom Sensors.

Kind regards.

Created on Jul 22, 2016 12:21:44 PM by  Erhard Mikulik [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi Erhard,

So, I did like you said. Just for test I did this script:

# coding=utf8
# -*- coding: utf8 -*-
import os

print "0:11:OK"

And prtg says: Received empty SSH response

This "print" isn't correct ?

Created on Jul 22, 2016 2:50:12 PM by  Rodrigofl (0) 1

Last change on Jul 25, 2016 8:53:33 AM by  Erhard Mikulik [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi Rodrigo,

Try echo instead of print.

Kind regards.

Created on Jul 25, 2016 8:54:09 AM by  Erhard Mikulik [Paessler Support]



Votes:

0

Your Vote:

Up

Down

It is "print" because this is a Python script. Python doesn't work in this sensor?

Created on Jul 25, 2016 12:43:24 PM by  Rodrigofl (0) 1



Accepted Answer

Votes:

0

Your Vote:

Up

Down

Consulted a developer about it. SSH Script sensor does not support Python natively, but you can try using a bash wrapper like this:

#!/bin/bash
/path/to/python /var/prtg/script/script.py

Kind regards.

Created on Jul 26, 2016 8:55:32 AM by  Erhard Mikulik [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.