Nagios check_service.sh error redis-server unrecognized service

nagios

I have an issue withe Nagios Monitoring. I have following configuration:

in commands.cfg

define command{
        command_name    check_service.sh
        command_line    /usr/lib64/nagios/plugins/check_service.sh -o $ARG1$ -t $ARG2$ 
}

in Service definition

define service {
        use                             generic-service
        host_name                       ARGPLUS_REDIS_SLV
        service_description             Redis Service
        check_command                   check_service.sh!linux!"service redis-server status"
        notifications_enabled           0
        }

I get following error:

Current Status: UNKNOWN (for 0d 0h 0m 17s)
Status Information: Unknown status: redis-server: unrecognized service
Is there a typo in the command or service configuration?: redis-server: unrecognized service

But with the same configuration just changing the process name gives me correct output

define service {
        use                             generic-service
        host_name                       ARGPLUS_REDIS_SLV
        service_description             Redis Service
        check_command                   check_service.sh!linux!"service nrpe status"
        notifications_enabled           0
        }

Output
Service State Information
Current Status: OK (for 0d 0h 24m 20s)
Status Information: nrpe (pid 16124) is running…

I think the minus sign in the process name redis-server is making the issue.

Best Answer

I think the redis service can also run with name redis. So it could be.

define service {
        use                             generic-service
        host_name                       ARGPLUS_REDIS_SLV
        service_description             Redis Service
        check_command                   check_service.sh!linux!"service redis status"
        notifications_enabled           0
        }

To confirm run a manual check

 $ ./check_service.sh -o linux -t "service redis status"