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

Monitoring processes in Linux

Votes:

-1

How can I monitor running processes on my Linux machine?

linux paetemplate process-monitoring snmp

Created on Dec 13, 2011 1:33:53 PM by  Konstantin Wolff [Paessler Support]

Last change on Aug 10, 2017 8:23:43 AM by  Luciano Lingnau [Paessler]



29 Replies

Accepted Answer

Votes:

1

This article applies to PRTG Network Monitor 9 or later

Monitoring Running Processes in Linux

Prerequisites

  • Installed and configured NET-SNMP

In some cases it might be useful to monitor if (and how often) a process on a Linux system is running at the moment. This can be done via SNMP, but therefore you need to apply some modification to your system's SNMP configuration.

SNMP Configuration (on device)

  • Open your "snmpd.conf" file in a text editor and navigate to the end of the file.
  • Add the following:proc <process name>
    • Replace <process name> with the name of the desired process
    • IMPORTANT: It has to be exact the same name as in your process list. It might be necessary to use the process name as given in the sbin or bin directory.
    • Run the command /bin/ps -e to get the process name to use.
  • Restart your SNMP service to make the changes take effect.

Automatic Sensor creation with Device Template

This device template will poll the following:

  • Process
    • Status (prErrorFlag)
    • Count

It will use the status for alerting by default. You can however define additional limits for the "Process Count" channel. The usage of the device templates makes the deployment of sensors easier, especially if there are several devices or processes that you would like to monitor.

Resulting Sensor(s)

Device template deployment and Usage

  1. Download the required zip archive here.
  2. Extract the archive to your PRTG program directory. By default, this is %Program Files (x86)%\PRTG Network Monitor\.
  3. In PRTG, restart the core server: open Setup | System Administration | Administrative Tools | Restart Core Server and click Go!. This ensures that the MIB and lookups are loaded before you run the auto-discovery.
  4. Create a new device in PRTG with the address (IP or FQDN) of the device that you want to monitor and configure the SNMP credentials accordingly.
  5. Right-click your new device, select Run Auto Discovery with Template, and select the Custom UCD-SNMP Linux Process v0.x from the list.
    Note: Using the auto-discovery with a dedicated device template is convenient here because it automates the creation of the custom sensors in an organized fashion.
  6. The sensors are deployed after a couple of seconds.
  7. You can adjust the channel limits or lookups to your needs later.
Template Version History
0.1Initial Release
0.2Fixed the snmp_prTable check

Manual Sensor creation

You can also deploy the sensor's manually if you don't want to use the auto-discovery. Please proceed as follows:

  • Open the PRTG web interface
  • Add the device you want to monitor
  • Add a new SNMP Library sensor, then choose Basic Linux Library
  • The process, from the step above, will be shown somehow like this:
MIB ModuleCategoryName
Basic Linux Library (UCD-SNMP-MIB)Processes: 1Processes Index
Basic Linux Library (UCD-SNMP-MIB)Processes: 1Processes Count
Basic Linux Library (UCD-SNMP-MIB)Processes: 1Processes Error Flag

Select the value you want to monitor (Example: "Processes Count" shows how often the process is running) and click on Continue

  • Go to sensor's Settings tab and rename the sensor to match your process

If you want to add another process just follow the steps above, the new process will be in category "Processes: 2", and so on.

Basically this is how to monitor your processes on a Linux machine.

This has been tested on Ubuntu, but should also work for every other distribution using NET-SNMP.

Note: This is also possible using our Custom Table Sensor, and it will allow for better naming of sensors and improved Auto-Discovery support. Tip: The Table's OID is 1.3.6.1.4.1.2021.2.

See Also

Created on Dec 13, 2011 1:55:24 PM by  Konstantin Wolff [Paessler Support]

Last change on Nov 2, 2022 2:48:58 PM by  Timo Dambach [Paessler Support]



Votes:

0

Hey guys,

I am going monitoring Linux process by snmpd.conf above the article. But, i have a doubt. i added a sensor, in my case 'process:1' process count -> 'actually its httpd'

  • In this moment its stopped, so my sensor mak 0 in process count, ok. But its green. How to configure for when count ==0 sensor stay red?

tks a lot!

Created on Jun 10, 2012 1:59:24 AM



Votes:

0

Hi,
in the overview of the affected sensor, please switch to the "Channels" tab. There please choose the correct channel and enable the limits for this channel. There you may set your lower error limits.
Best regards

Created on Jun 11, 2012 9:08:20 AM by  Konstantin Wolff [Paessler Support]



Votes:

0

this is not what was asked:

how can i monitor running processes on linux? the number of running processes, i.e. MIB 1.3.6.1.2.1.25.1.6.0

this is working on one host and not on another. both running same OS both using exactly the same snmpd.conf

Created on Sep 9, 2014 2:03:52 PM



Votes:

0

@amirtal: May you please elaborate on the precise issue? What exactly is not working? Do you get any error messages?

Created on Sep 11, 2014 9:06:22 AM by  Konstantin Wolff [Paessler Support]



Votes:

0

When creating a sensor to monitor a Linux Process I select SNMP Library. I then select the Basic Linux Library (ucd-snmp-mib).oidlib library file. After selecting Basic Linux Library (ucd-snmp-mib).oidlib I do not get Category "Processes: 1" nor do I get anything with "Process Count" in the name list.

The only Categories that are available to select from are Memory, System Stats, and CPU Load.

I can monitor the system with other Linux SNMP Sensors.

I have modified snmpd.conf file with proc sshd as the last line in a very basic conf file.

snmpd.conf file

#ASM SNMPD Config
rocommunity public
syslocation "Alpharetta, GA"

proc sshd

What might I be missing when attempting to create a sensor to monitor a Linux Process? Are the Process Categories still available to chose from? Is the right Linux MIB File installed on the PRTG Server?

Created on Dec 9, 2015 3:30:18 PM

Last change on Dec 9, 2015 3:48:56 PM by  Torsten Lindner [Paessler Support]



Votes:

0

@jessev: Could you please run

ps -e |grep sshd

What results do you get? EDIT: Are you able to add other SNMP Sensors (e.g. Uptime)?

Created on Dec 9, 2015 8:20:36 PM by  Konstantin Wolff [Paessler Support]

Last change on Dec 9, 2015 8:21:20 PM by  Konstantin Wolff [Paessler Support]



Votes:

0

Hi I have the same problem! when monitor a process and it not running the sensor stay Green and not send notification !

please update us

Created on Feb 22, 2016 12:15:02 PM



Votes:

0

@chikosan: The sensor above by default reads a value. It does not 'know' if this value is good or bad. So, to get a notification, please set a lower warning limit for the channel value in the Sensor Channel Settings of the Processes Count. The sensor should then go to an error state when the number drops to 0.

Created on Feb 25, 2016 11:02:06 AM by  Konstantin Wolff [Paessler Support]



Votes:

0

After following this article I had the same issue. I went to the sensor channel and in the lower error limit I entered 0 but the sensor will still show OK and stay green although the service on the box was stopped. What I did for it to work is instead of entering 0 in the lower error limit I entered .1 that seemed to fix the issue. PRTG is now showing error when the service is stopped and Green when it is started. Hopes this helps.

Created on Jun 7, 2016 4:07:42 PM



Votes:

0

very useful article. thanks

Created on Jun 7, 2016 4:58:06 PM



Votes:

0

It´s possible to monitor more then twelve processes? In the SNMP Lib there are only twelve process sensor, but I´ve thriteen processes on my linux system.

Created on Jul 28, 2016 8:56:26 AM



Votes:

0

@Marc Boettcher: This seems to be a limitation of NET-SNMP itself. So monitoring 13 processes is not possible then. Sorry.

Created on Jul 28, 2016 12:59:08 PM by  Konstantin Wolff [Paessler Support]



Votes:

0

will this handle processes with spaces in them? like "bash /bin/something"?

If so, does it require quotes around it?

Created on Oct 10, 2017 1:39:04 PM



Votes:

0

@chlsmith thank you for your inquiry. I'm unable to confirm that, the net-snmp documentation page does not mention/specify that:

I encourage you to give it a try.

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Oct 11, 2017 9:01:57 AM by  Luciano Lingnau [Paessler]

Last change on Oct 11, 2017 9:02:04 AM by  Luciano Lingnau [Paessler]



Votes:

0

Это мониторинг процессов, а необходимо именно именно служб. Как это сделать в версии 17.3?

This is the monitoring of processes, and it is the services that are needed. How to do this in version 17.3?

Created on Feb 2, 2019 6:30:52 AM



Votes:

0

Hi there,

The above guide still applies to the most recent version and your version as well.

Best regards.

Created on Feb 4, 2019 8:59:18 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Process and service are different things.

Example: ps -e | grep postfix

Returns nothing

Example: service postfix status

Returns

  • postfix is running

Created on Feb 5, 2019 11:44:18 AM



Votes:

0

Hi there,

Is it possible that the postfix has a different process name? Could you try the following command instead?

ps | grep [p]ostfix

Best regards.

Created on Feb 5, 2019 12:34:58 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

# ps | grep p
58568 pts/3    00:00:00 sudo
58641 pts/3    00:00:00 su
58642 pts/3    00:00:00 bash
58755 pts/3    00:00:00 ps
58756 pts/3    00:00:00 grep

Nothing like this

Created on Feb 6, 2019 9:22:47 AM

Last change on Feb 6, 2019 11:45:18 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Hi there,

As what user are you logged in? Is it possible that the postfix service runs a different user and you are not able to get the "ps"-output of other user accounts?

Best regards.

Created on Feb 6, 2019 11:45:59 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Full root rights

Created on Feb 6, 2019 1:35:26 PM



Votes:

0

Hi there,

Might be worth to check what process listens on port 25:

 # sudo lsof -i :25   
 COMMAND  PID USER   FD   TYPE DEVICE SIZE NODE NAME
 master  5664 root   12u  IPv4  13732       TCP *:smtp (LISTEN)

Afterwards check the returned PID like this:

 # ps p 5664
 PID TTY      STAT   TIME COMMAND
 5664 ?        Ss     0:12 /usr/lib/postfix/master

Best regards.

Created on Feb 6, 2019 3:00:40 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Example, I need to monitor exactly whether the services are running: amavis, clamav, mysql, postfix

Created on Feb 7, 2019 6:58:17 AM



Votes:

0

Hi there,

This is clear. But the above procedure only applies to processes. So a process can have an entirely different name from the actual service.

Best regards.

Created on Feb 7, 2019 9:33:01 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Please specify the link where the service monitoring method is specified.

Created on Feb 8, 2019 6:29:39 AM



Votes:

0

Hi there,

There is no guide or documented way to do this. The only way is documented above, by monitoring the process behind the service.

Best regards.

Created on Feb 8, 2019 9:43:12 AM by  Dariusz Gorka [Paessler Support]




Votes:

0

Hi,

Sure, using a custom sensor via SSH is an option - but this is not an already in PRTG implemented option. If the script above helps you, great! :)

Best regards.

Created on Feb 13, 2019 3:07:35 PM by  Dariusz Gorka [Paessler Support]




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.