Checking the status of a process on Linux/Windows


is it possible in LibreNMS to check the status of a process which is either running on Linux or Windows. I set up services but it is quite what I am looking for, because I am limited to services like smtp, imap, ssh, mysql etc…

What I am looking for is to specifically check if a process is running or dead. For example I want to check if the NUT client, to shutdown the server if the UPS has less than 50% battery, is running on my windows machine.

I searched quite a bit but I couldn’t find anything regarding that topic. It usually all comes back to setting up services. Nagios offers process checks which are possible via SNMP. Process Checks

Also read on OpenNMS that is possible to check process status via SNMP. Process Monitoring with SNMP – The OpenNMS Group, Inc.

Any idea if that is possible in LibreNMS?

Thanks so much :slight_smile:

On Linux that’s not so difficult to do with a Nagios plugin.
I’ve written the script below that will use ssh to login to a machine and issue the “systemctl is-active” command followed by the name of the service you want to check.

I’m a total noob at bash scripting so the code might be crappy, but for me it works :slight_smile:


# Author: JP
# Check if service is running on remote machine using systemd

# Nagios exit codes

# Arguments

if [[ -z $HOSTNAME ]];
    echo "Hostname is required"
    exit $CRITICAL
if [[ -z $USERNAME ]];
    echo "Username is required"
    exit $CRITICAL
if [[ -z $PASSWD ]];
    echo "Password is required"
    exit $CRITICAL
if [[ -z $SERVICE ]];
    echo "Service is required"
    exit $CRITICAL

# Check if sshpass is installed, if not then exit with error message
command -v sshpass >/dev/null || { echo "Dependency sshpass not installed on the LibreNMS server"; exit $CRITICAL; }

sshpass -p "$PASSWD" ssh -T -q -o StrictHostKeyChecking=no -o ConnectTimeout=10 [email protected]$HOSTNAME "systemctl is-active $SERVICE"  > /dev/null

if [[ $exitstatus -eq 0 ]];
    echo "OK: Service $SERVICE is running."
    exit $OK
    echo "CRITICAL: Service $SERVICE is not running!"
    exit $CRITICAL

As you can see in the code it is required to have “sshpass” installed on your LibreNMS machine.
I have saved the script as “check_service” in the appropriate nagios plugin directory.

Then add the service to the host you’re monitoring with the username / password / service as the parameters.
PS. In the example I’m checking the “Chrony” service.

Don’t ask me how you can do this on a windows machine though, I don’t know anything about windows :wink:

Is there anyway to use SNMP instead of ssh?

Since it is possible to check the status of a service with SNMP.

OpenNMS offers such a solution that you can monitor the status of a process via SNMP.

Is it possible to access these informations in LibreNMS? Process Monitoring with SNMP – The OpenNMS Group, Inc.