Update in: 28 October 2020
:
Status of any Linux service
This simple module checks if specified service exists and is active.
It returns strings based on presence in the system and service activity.
Apache2 example
module_begin module_name apache2_Status module_type generic_data_string module_exec (if test $(systemctl list-unit-files | grep apache2 | wc -l) -ne 0 ; then systemctl is-active --quiet apache2 && echo active || echo inactive; else echo not installed; fi) module_str_critical inactive module_group Application module_end
ANY SERVICE
module_begin module_name (service_name)_Status module_type generic_data_string module_exec (if test $(systemctl list-unit-files | grep (service_name) | wc -l) -ne 0 ; then systemctl is-active --quiet (service_name) && echo active || echo inactive; else echo not installed; fi) module_str_critical inactive module_group Application module_end
(Visited 795 times, 1 visits today)