Page 1 of 2
Need some help configuring a specific plugin
Posted: Fri Jul 18, 2014 6:55 pm
by logic_bomb421
Hi all!
So to begin, I'm trying to use this plugin:
http://exchange.nagios.org/directory/Pl ... ts/details
So far, I've installed the .ps1 script in the NSClient++/scripts directory, changed the AD execution policy, defined my command in the commands.cfg (following the example on the plugin page), and defined the service for the AD check.
When I try to restart the Nagios service, I get the error
Code: Select all
Error: Service check command 'check-ad-account -a LockedOut "ou=MYSPECIFICOU,dc=MYDOMAIN,dc=com" specified in service 'AD Service Accounts' for host 'DC01' not defined anywhere!
I can't figure out why this is happening. I've defined the command:
Code: Select all
define command{
command_name check-ad-account
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -n -c check-ad-account -a $ARG1$ "$ARG2$" $ARG3$ $ARG4$ $ARG5$
}
and the service:
Code: Select all
define service{
use generic-service
host_name DC01
service_description AD Service Accounts
check command check-ad-account -a LockedOut "ou=MYSPECIFICOU,dc=MYDOMAIN,dc=com"
}
I've probably missed something really obvious here. Seems like this should be simple, but the whole nrpe thing has me second guessing everything.
All help is greatly appreciated!
Re: Need some help configuring a specific plugin
Posted: Mon Jul 21, 2014 1:56 am
by Box293
Run this command and post the output:
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Re: Need some help configuring a specific plugin
Posted: Mon Jul 21, 2014 11:36 am
by logic_bomb421
Alright, this is what I get:
Code: Select all
Nagios Core 4.0.7
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 06-03-2014
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Error: Service check command 'check-ad-account -a LockedOut "ou=Service Accounts,dc=superiorexams,dc=com"' specified in service 'AD Service Accounts' for host 'DC01' not defined anywhere!
Checked 123 services.
Checked 30 hosts.
Checked 3 host groups.
Checked 4 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 32 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 30 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 1
***> One or more problems was encountered while running the pre-flight check...
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
Re: Need some help configuring a specific plugin
Posted: Mon Jul 21, 2014 11:55 am
by tmcdonald
Code: Select all
define command{
command_name check-ad-account
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -n -c check-ad-account -a $ARG1$ "$ARG2$" $ARG3$ $ARG4$ $ARG5$
}
and the service:
Code: Select all
define service{
use generic-service
host_name DC01
service_description AD Service Accounts
check command check-ad-account -a LockedOut "ou=MYSPECIFICOU,dc=MYDOMAIN,dc=com"
}
A few problems with this:
1.) "check command" needs to be "check_command"
2.) The check_command is defined improperly and should be:
Code: Select all
check command check-ad-account!LockedOut!"ou=MYSPECIFICOU,dc=MYDOMAIN,dc=com"!!!!
The exclamations are what separate out your $ARGX$ parameters. Essentially the way you have it now, this is the command you are running:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <ip> -n -c check-ad-account -a -a LockedOut "ou=MYSPECIFICOU,dc=MYDOMAIN,dc=com"
Re: Need some help configuring a specific plugin
Posted: Mon Jul 21, 2014 1:12 pm
by logic_bomb421
Hey thank you for the reply.
For your first point, I added the underscore. For your second point, I added the exclamation marks.
I'm still getting the "is not defined anywhere!" error.
One thing I should mention, this command seems to use nrpe. I'm not entirely sure what that is. I've been using check_nt with NSClient++ for everything so far. Maybe something isn't configured right with nrpe?
Thank you.
Re: Need some help configuring a specific plugin
Posted: Mon Jul 21, 2014 8:40 pm
by Box293
check_nt and check_nrpe are both supported by NSClient++, they just use different network ports (nrpe is newer).
Let's check to see if your windows server with NSClient++ has NRPE configured.
Code: Select all
./check_nrpe -H <ip if windows server>
What does that return?
Re: Need some help configuring a specific plugin
Posted: Tue Jul 22, 2014 11:20 am
by logic_bomb421
The above command returns:
Code: Select all
-bash: ./check_nrpe: No such file or directory
You said nrpe uses a different port? In the NSClient config file on each server I had to specify a port under the allowed hosts. I only supplied one port. Could that be a problem?
Re: Need some help configuring a specific plugin
Posted: Tue Jul 22, 2014 9:13 pm
by Box293
Sorry try this:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <ip if windows server>
NRPE uses port 5666 and check_nt uses port 12489
Re: Need some help configuring a specific plugin
Posted: Wed Jul 23, 2014 11:29 am
by logic_bomb421
It appears I somehow am missing the check_nrpe plugin. I get the same response as my previous post when I point it to the right folder.
One other thing, do I have to specify the nrpe port in each NSClient config file like I do for check_nt?
Thanks!
Edit: Found it. Somehow it ended up in /usr/lib/nagios/plugins/. When I ran it from the terminal, I got a response of
Code: Select all
I (*some numbers* *date*) seem to be doing fine...
Edit 2: Okay so after figuring out where the check_nrpe plugin was located, and after copying it to the /usr/local/nagios/libexec directory, I was able to get the command to run just fine. My only problem now is I get a result of "Unknown" with the message "CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages."
All the articles online for this error seem to want me to do something on another remote Linux machine. This is why NRPE has been confusing for me. I have one Linux machine running all my Nagios stuff connected to my servers via NSClient++. All the guides, etc. on NRPE mention that you're supposed to connect to another Linux server or something? I just don't understand that.
Re: Need some help configuring a specific plugin
Posted: Wed Jul 23, 2014 7:14 pm
by Box293
logic_bomb421 wrote:Found it. Somehow it ended up in /usr/lib/nagios/plugins/
There's no need to copy it, your commands can reference it from that location.
I (*some numbers* *date*) seem to be doing fine...
This is good, it means that the Windows host is listening to NRPE requests.
About the linux stuff, NRPE can be used across multiple platforms, so you're just seeing examples of a nagios host using NRPE to check a remote linux host. Your case is a nagios host using NRPE to check a remote Windows host.
So now that we know where it is, what happens when you run:
Code: Select all
/usr/lib/nagios/plugins/check_nrpe -H <ip if windows server> -n -c check-ad-account -a LockedOut "ou=MYSPECIFICOU,dc=MYDOMAIN,dc=com"