What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

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

Monitor process status using SSH sensor

Votes:

0

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



8 Replies

Votes:

0

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

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

https://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



Votes:

0

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:

3

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

Last change on Feb 15, 2021 2:27:50 PM by  Florian Lesage [Paessler Support]



Votes:

0

Thanks for sharing! :)

Created on Aug 11, 2016 8:15:53 AM by  Stephan Linke [Paessler Support]



Votes:

0

One more, thanks for sharing, this is what worked best to monitor linux processes in PRTG. One note, I was trying to monitor if Node-Red was running, but using "node-red" as parameter for the process name didn't work. It happens that for some reason under "ps -e" Node-Red shows as "node".

Created on Feb 2, 2021 1:10:13 PM



Votes:

0

Hello Tales,

After a short verification, on Ubuntu the service is indeed called node-red. How do you have installed Node-Red ? On which OS ? How do you run it ? With which command ?

Regards.

Created on Feb 3, 2021 11:40:48 AM by  Florian Lesage [Paessler Support]



Votes:

0

Hi there,

Replying, better late than never: I'm running NR on an Ubuntu machine, and I installed it using the script built for the Raspberry Pi that can be found here:

https://nodered.org/docs/getting-started/raspberrypi

The install script makes available a series of scripts to handle the application, like node-red-start, node-red-stop and so on. In my case I run node-red as a system service.

The original server was running node-red v1.x. Yesterday I deployed an updated server and installed node-red v3. Now the service name is node-red as one would expect.

Created on Jan 5, 2024 11:26:33 AM




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.