Description
Hi,
I have not clear where is the mistake on script check_service, because some running service return exit 0 (OK) and others also running return exit 2
Evidence of exit 2 with running service on linux
root@emonpi(rw):nagios# ./libexec/check_service -o linux -t "service emonhub status"
● emonhub.service - LSB: Start/stop emonHub
Loaded: loaded (/etc/init.d/emonhub)
Active: active (running) since Sun 2017-12-24 18:10:15 CET; 1 day 23h ago
Process: 31020 ExecStop=/etc/init.d/emonhub stop (code=exited, status=0/SUCCESS)
Process: 10504 ExecStart=/etc/init.d/emonhub start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/emonhub.service
└─10551 python /usr/share/emonhub/emonhub.py --config-file /home/pi/data/emonhub.conf --logfile /var/log/emonhub/emonhub.log
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
root@emonpi(rw):nagios# echo $?
2
Evidence of expected running
çroot@emonpi(rw):nagios# ./libexec/check_service -o linux -t "service mosquitto status"
● mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled)
Active: active (running) since Mon 2017-12-25 17:23:18 CET; 24h ago
Docs: man:mosquitto(8)
https://mosquitto.org/
Main PID: 25504 (mosquitto)
CGroup: /system.slice/mosquitto.service
└─25504 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Dec 25 17:23:18 emonpi systemd[1]: Started Mosquitto MQTT Broker.
root@emonpi(rw):nagios# echo $?
0