NRPE unable to read output when trying to monitor CIFS

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

NRPE unable to read output when trying to monitor CIFS

Post by dlukinski »

Hello XI support

We are having issues with monitoring cifs and java by NRPE (Unable to read output)
- works for same hosts when monitoring httpd and sshd

Please help

Thank you
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE unable to read output when trying to monitor CIFS

Post by rkennedy »

We will need more information then this. Can you show us the check_commands that your services are running?
Former Nagios Employee
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: NRPE unable to read output when trying to monitor CIFS

Post by dlukinski »

rkennedy wrote:We will need more information then this. Can you show us the check_commands that your services are running?
Here you go (screenshot attached)
- produces errors for the host where CIFS is running (accessible via SNMP). NRPE works for httpd from the same host
You do not have the required permissions to view the files attached to this post.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: NRPE unable to read output when trying to monitor CIFS

Post by WillemDH »

It is possible this means the nagios or nrpe user need sudo to check the service. Check your visudo.

You can test if it is the case by logging in as root, then su nagios and run the full command.
Nagios XI 5.8.1
https://outsideit.net
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE unable to read output when trying to monitor CIFS

Post by rkennedy »

Thanks @Willem!

@dlukinski - Willem is right, this is most likely related to permissions to execute the command in question. Can you run su nagios on the client machine, and try to execute the check_init_service plugin. Let us know the full input / output if it has issues.
Former Nagios Employee
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: NRPE unable to read output when trying to monitor CIFS

Post by dlukinski »

rkennedy wrote:Thanks @Willem!

@dlukinski - Willem is right, this is most likely related to permissions to execute the command in question. Can you run su nagios on the client machine, and try to execute the check_init_service plugin. Let us know the full input / output if it has issues.
Thank you, this is becoming tricky

- we really cannot count on monitoring account ever granted sudo permisisons / cannot even test this case for the same security reason.
- is there any workaround for not to use sudo OR list of plugins to use one with?

I am to install some test servers, where I would have root access to try similar checks with by adding nagios to sudoers
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE unable to read output when trying to monitor CIFS

Post by rkennedy »

- we really cannot count on monitoring account ever granted sudo permisisons / cannot even test this case for the same security reason.
- is there any workaround for not to use sudo OR list of plugins to use one with?
For what you're looking to monitor, a user will NEED permissions to see if the service is running or not. There really isn't a way around this. They do not need full sudo access, just for what you're looking to check.

Let us know how your testing goes, and if you have any further questions.
Former Nagios Employee
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: NRPE unable to read output when trying to monitor CIFS

Post by dlukinski »

rkennedy wrote:
- we really cannot count on monitoring account ever granted sudo permisisons / cannot even test this case for the same security reason.
- is there any workaround for not to use sudo OR list of plugins to use one with?
For what you're looking to monitor, a user will NEED permissions to see if the service is running or not. There really isn't a way around this. They do not need full sudo access, just for what you're looking to check.

Let us know how your testing goes, and if you have any further questions.

Which restricted commands check_init plugin uses (is there a list) ?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: NRPE unable to read output when trying to monitor CIFS

Post by hsmith »

check_init_service is a cleartext batch script:

Code: Select all

#!/bin/sh

PROGNAME=`basename $0`

print_usage() {
        echo "Usage: $PROGNAME"
}

print_help() {
        echo ""
        print_usage
        echo ""
        echo "This plugin checks the status of services normally started by the init process."
        echo ""
        support
        exit 0
}


case "$1" in
        --help)
                print_help
                exit 0
                ;;
        -h)
                print_help
                exit 0
                ;;
        *)

                if [ $# -eq 1 ]; then
                        /sbin/service $1 status
                        ret=$?
                        case "$ret" in
                             0)
                                exit $ret
                                ;;
                             *)
                                exit 2
                                ;;
                        esac
                else
                        echo "ERROR: No service name specified on command line"
                        exit 3
                fi
                ;;
esac



Looking at it, this should be the only thing your user needs access to:

Code: Select all

 /sbin/service
Former Nagios Employee.
me.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: NRPE unable to read output when trying to monitor CIFS

Post by dlukinski »

hsmith wrote:check_init_service is a cleartext batch script:

Code: Select all

#!/bin/sh

PROGNAME=`basename $0`

print_usage() {
        echo "Usage: $PROGNAME"
}

print_help() {
        echo ""
        print_usage
        echo ""
        echo "This plugin checks the status of services normally started by the init process."
        echo ""
        support
        exit 0
}


case "$1" in
        --help)
                print_help
                exit 0
                ;;
        -h)
                print_help
                exit 0
                ;;
        *)

                if [ $# -eq 1 ]; then
                        /sbin/service $1 status
                        ret=$?
                        case "$ret" in
                             0)
                                exit $ret
                                ;;
                             *)
                                exit 2
                                ;;
                        esac
                else
                        echo "ERROR: No service name specified on command line"
                        exit 3
                fi
                ;;
esac



Looking at it, this should be the only thing your user needs access to:

Code: Select all

 /sbin/service
Please close this thread

Thank you
Locked