Monitor linux services with check_mk or nagios plugins

Hi everyone,

I would like to moniotor some services (ufw, duplicati, …) on linux (debian 10) servers. I have both check_mk and nagios plugins intalled but I don’t know how to monitor a service like NT services with NSClient (by using option to tell what service I want to check). I juste want to know if the service is up or down. The check_service could be fine but there is no -H option so I don’t know how to use it remotely.

As far as I know, all check_mk/nagios plugins on linux are for a specific app/service. Correct me if I’m wrong.

What can I use to do so and if there is doc where can I find it?

King regards and thanks for your help

See my reply to this question: Checking the status of a process on Linux/Windows - #2 by JohnnyBBravo

Hi thanks!
It’s work great. Maybe few things: no need to put a clear password if you have done an ssh-copy-id with the monitored host before. And no need username if theire is a ssh_config file for librenms user. The script is more secure and shorter with this even if you have to do a bit of preconfiguration before :slight_smile:
And exit code WARNING and UNKNOWN are not used

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

# Nagios exit codes

# Arguments

if [[ -z $HOSTNAME ]];
    echo "Hostname is required"
    exit $WARNING
elif [[ -z $SERVICE ]];
    echo "Service is required"
    exit $WARNING

ssh -T -q -o ConnectTimeout=10 $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


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.