Page 1 of 2

NRPE Customize configure

Posted: Wed May 03, 2017 3:46 am
by Kevin.c
Hi,
could you update me , how I can customize configure the threshold warning and critical set up in XI ?
I follow the document change the $ARG2$ -a 1 2 , but not working , and I also try to change the nrpe.cfg , also did not work, any other things I need to do , please guide me
thank you !

Re: NRPE Customize configure

Posted: Wed May 03, 2017 11:08 am
by lmiltchev
First off, how did you install the Linux agent (NRPE + Nagios plugins) on the client? Did you use our official installer?
https://assets.nagios.com/downloads/nag ... _Agent.pdf

Can you show us how your command is defined on the client (remote machine)?

Example:

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
Hint: The command may be defined in the nrpe.cfg or common.cfg (if exists), depending on how you installed NRPE. Please check both files.

Can you show us how your service is defined on the Nagios XI server?

Example:

Code: Select all

define service {
	host_name			CentOS6-NRPE
	service_description		Users
	use				xiwizard_nrpe_service
	check_command			check_nrpe!check_users!-a '-w 1 -c 2'
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			xi_timeperiod_24x7
	notification_interval		60
	notification_period		xi_timeperiod_24x7
	notifications_enabled		1
	contacts			nagiosadmin
	_xiwizard			linux-server
	register			1
	}
Can you test your command from the command line, and show the output?

Example:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.x.x -c check_users -a '-w 1 -c 2'
USERS OK - 1 users currently logged in |users=1;5;10;0

Re: NRPE Customize configure

Posted: Tue May 09, 2017 10:02 am
by Kevin.c
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 120 -c $ARG1$ $ARG2$

Re: NRPE Customize configure

Posted: Tue May 09, 2017 10:21 am
by Kevin.c
Please take a look this two config file , is that correct for to to configure ? please see the alert picture , how can I deal with it !


actually I want do this from nrpe

Check_users -> Check_users -w 150 -c 200
Check_total_procs -> check_procs -w 750 -c 850

A little experiment with filesystems:

Check_hda1 -> check_tmp -> check_disk -w 20% -c 10% /tmp

Check_devopn1 -> check_disk -w 20% -c 10% /devopn1

could you guide me to do this ?
thank u !

Re: NRPE Customize configure

Posted: Tue May 09, 2017 10:43 am
by tgriep
The copy of the NRPE Agent you have installed on that server has all of the arguments hard coded and they need to be changed to allow arguments to be passed to it.

You would have to comment out the following hard coded commands in the nrpe.cfg file

Code: Select all

command[check_users]=/usr/local/nagios/libexec/check_users -w 150 -c 200
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /tmp
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 750 -c 850 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 750 -c 850
command[check_hda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /devopn1
Then this option has to be changed from

Code: Select all

dont_blame_nrpe=0
to

Code: Select all

dont_blame_nrpe=1
This will enable the NRPE agent to receive arguments from the Nagios XI server.

Then add this section to the bottom to the nrpe.cfg file

Code: Select all

### GENERIC SERVICES ###
command[check_init_service]=sudo /usr/local/nagios/libexec/check_init_service $ARG1$
command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$

### MISC SYSTEM METRICS ###
command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$

### SYSTEM UPDATES ###
command[check_yum]=/usr/local/nagios/libexec/check_yum
command[check_apt]=/usr/local/nagios/libexec/check_apt

### DISK ###
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart $ARG1$

### PROCESSES ###
command[check_all_procs]=/usr/local/nagios/libexec/custom_check_procs
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$

### OPEN FILES ###
command[check_open_files]=/usr/local/nagios/libexec/check_open_files.pl $ARG1$

### NETWORK CONNECTIONS ###
command[check_netstat]=/usr/local/nagios/libexec/check_netstat.pl -p $ARG1$ $ARG2$
Save the nrpe.cfg file and restart the nrpe agent on your remote system.

The new commands are setup to receive the arguments from the XI server.

To fix the devopn1 folder error in XI, you will have to edit the "devopn1 folder" service and change $ARG1$ from

Code: Select all

check_hda2
to

Code: Select all

check_disk
Save and apply the config.

Hopefully that will fix the issues for you.

If you do not want to do all of the editing of the NRPE agent, you can uninstall it and use the Linux Agent installer at this link which will setup the server for you.
https://assets.nagios.com/downloads/nag ... _Agent.pdf

Re: NRPE Customize configure

Posted: Tue May 09, 2017 11:03 am
by Kevin.c
thank you for fast reaction, I will do this as you guide !

Re: NRPE Customize configure

Posted: Tue May 09, 2017 12:39 pm
by tgriep
OK, if you have any other questions, let us know.

Re: NRPE Customize configure

Posted: Wed May 10, 2017 7:43 pm
by Kevin.c
hi , looks there still have problem with the folder check

can you tell me how we can check the Linux folder with nrpe , is that right use

Code: Select all

check_disk
,but when I use it for different folder got same size, I think it is not correct . please guide me to fix this issue .

thank you !

Re: NRPE Customize configure

Posted: Thu May 11, 2017 9:41 am
by tgriep
The check_disk command is used for getting the free space for the whole drive. If those folder are on the same drive, then the output for the checks will show the came info.
What you are looking for is a check that only shows the used space in that folder, you would have to use a different plugin.
Take a look at the plugins below for some example plugins you can use
https://exchange.nagios.org/directory/P ... e)/details
https://exchange.nagios.org/directory/P ... ze/details

Re: NRPE Customize configure

Posted: Fri May 12, 2017 4:44 am
by Kevin.c
could you guide me how to use this plugin for monitoring a folder
do we need add something in nrpe.cfg , what is the command in nagios xi ?

thank you !