nagios-plugins icon indicating copy to clipboard operation
nagios-plugins copied to clipboard

Check_service not working as expected

Open Tangogr opened this issue 7 years ago • 1 comments

When exec i got:

[root@server plugins]# ./check_service.sh -o linux -s sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since vie 2017-12-29 16:55:07 CET; 2 weeks 5 days ago
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 1132 (sshd)
   CGroup: /system.slice/sshd.service
           └─1132 /usr/sbin/sshd -D

ene 18 00:02:01 Server sshd[7445]: Accepted publickey for root from 66.66.66.66 port 6666 ssh2: RSA SHA256:87fWB8mk
[root@server plugins]# 

Tangogr avatar Jan 17 '18 23:01 Tangogr

Hello @Tangogr,

Not an issue (I 've the same output). Your system is using systemd.

I 've managed this by changing line 250 from this :

[ $TRUST_EXIT_CODE -eq 1 ] && [ $EXIT_CODE -eq 0 ] && echo "$STATUS_MSG" && exit $OK

to

[ $TRUST_EXIT_CODE -eq 1 ] && [ $EXIT_CODE -eq 0 ] && echo "$SERVICE daemon is running" && exit $OK

You can easily adapt line 246 too.

JoNicolas avatar Jan 29 '18 12:01 JoNicolas