Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
This is a nagios plug-in to check the output text or the exit status of a systemd service.
Current Version
1.0
Last Release Date
2026-01-05
Owner
Chad Columbus
License
GPL
Compatible With
Feel free to contact me for help, I have another pluigin that was very popular for init.d scripts this is the updated version for systemd.
Options: -s -s '/bin/systemctl status ' (required) This is the script to run, the script is designed to run scripts in the /bin/systemctl dir (but can run any script) and will call the script with a 'status' argument. So if you use another script make sure it will work with /path/script status, example: '/bin/systemctl status nagios4'
-e This is the "exitstaus" flag, it means check the exit status code instead of looking for a pattern in the output of the script.
-p 'REGEX' This is a pattern to look for in the output of the script to confirm it is running, default is 'active (running)', but not all /bin/systemctl scripts output (iptables), so you can specify an arbitrary pattern. All patterns are case insensitive.
-n This is the "NOT" flag, it means not the -p pattern, so if you want to make sure the output of the script does NOT contain -p 'REGEX'
-r This is the "ROOT" flag, it means run as root via sudo. You will need a line in your /etc/sudoers file like: nagios ALL=(root) NOPASSWD: /bin/systemctl status *
-o This is the "SUPPRESS OUTPUT" flag. Some programs have a long output (like iptables), this flag suppresses that output so it is not printed as a part of the nagios message.
Simply add this to your command file: define command { command_name check_exit_status command_line $USER1$/check_exit_status.pl -r -s $ARG1$ }
Here is a sample service definition: define service{ use local-service host_name (Host Name) service_description Postfix check_command check_systemd_status!postfix }
You must be logged in to submit a review.
To:
From:
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!