NRPE Customize configure

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Kevin.c
Posts: 37
Joined: Wed Mar 22, 2017 2:49 am

NRPE Customize configure

Post 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 !
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE Customize configure

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Kevin.c
Posts: 37
Joined: Wed Mar 22, 2017 2:49 am

Re: NRPE Customize configure

Post by Kevin.c »

$USER1$/check_nrpe -H $HOSTADDRESS$ -t 120 -c $ARG1$ $ARG2$
Kevin.c
Posts: 37
Joined: Wed Mar 22, 2017 2:49 am

Re: NRPE Customize configure

Post 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 !
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE Customize configure

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Kevin.c
Posts: 37
Joined: Wed Mar 22, 2017 2:49 am

Re: NRPE Customize configure

Post by Kevin.c »

thank you for fast reaction, I will do this as you guide !
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE Customize configure

Post by tgriep »

OK, if you have any other questions, let us know.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Kevin.c
Posts: 37
Joined: Wed Mar 22, 2017 2:49 am

Re: NRPE Customize configure

Post 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 !
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE Customize configure

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Kevin.c
Posts: 37
Joined: Wed Mar 22, 2017 2:49 am

Re: NRPE Customize configure

Post 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 !
Locked