New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.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


Monitor process status using SSH sensor

Votes:

0

Your Vote:

Up

Down

Hi,

Can I monitor if a service is running or not, on a Linux machine, without installing an agent, or SNMP or anything? Just by using an SSH sensor?

Thanks

process-monitoring sensor ssh

Created on May 4, 2015 2:20:53 PM by  aristosv (0) 1



5 Replies

Votes:

0

Your Vote:

Up

Down

Dear aristosv

Yes – as long as you can put the according shell script to check the status of that service on the machine you wish to monitor.

The script must be located in /var/prtg/scripts

Now that script can be run using the SSH Script sensor.

Created on May 5, 2015 11:00:59 AM by  Arne Seifert [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I found 3 scripts on this thread, and i tried all of them but no luck.

http://kb.paessler.com/en/topic/39513-is-there-a-shell-script-example-for-prtg-s-ssh-script-sensor

The difference is that I am not trying to monitor a service, but a running process. (i made a mistake on the title of this thread)

So none of the commands for processes work.

Is there something for monitoring processes, rather than services?

Thanks

Created on May 13, 2015 6:40:22 PM by  aristosv (0) 1



Votes:

0

Your Vote:

Up

Down

Dear aristosv

I am not aware of a ready-to-use script in our knowledge base.

On many Unix-like systems you get a process list with ps. Using command options like ps -aux provides a more detailed list. Using grep or other string filter commands you can check if a particular process is running. If you can create a script which works, please post it into this KB thread for others to use.

Created on May 14, 2015 9:14:28 AM by  Arne Seifert [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I'm new to PRTG but did get this going with a bit of help from Andrew Jones post on https://kb.paessler.com/en/topic/39513-is-there-a-shell-script-example-for-prtg-s-ssh-script-sensor ,

As per above. Create the folder /var/prtg/scripts Make a new script file eg. vi query_process.sh Add the lines below;

#!/bin/sh

pgrep $1  2>&1 1>/dev/null

if [ $? -ne 0 ]; then \rn 
  echo "1:$?:$1 Down"
else
  echo "0:$?:OK"
fi

Save the file and make it executable with: chmod +x query_process.sh If not executable, the sensor wont allow you add the script by name when adding the sensor.

Add the ssh script sensor in PRTG to the device (make sure your SSH Credentials have been set correctly) Set the parameter field of the sensor to the process name -eg. ntpd

ps -e

will give you a list of available processes to query.

Cheers

Created on Aug 11, 2016 3:02:50 AM by  Filet-o-fish (0)



Votes:

0

Your Vote:

Up

Down

Thanks for sharing! :)

Created on Aug 11, 2016 8:15:53 AM 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.