Page 4 of 4

Re: How to config plugin check_newest_file_age

Posted: Wed May 15, 2019 9:30 am
by welbp00
Still got a problem....

On the commandline the command works fine, but if i execute the command from the Nagios gui, i see this error in the secure.log:

May 15 15:26:43 on7p0041 sudo: pam_unix(sudo:auth): conversation failed
May 15 15:26:43 on7p0041 sudo: pam_unix(sudo:auth): auth could not identify password for [nrpe]
May 15 15:26:43 on7p0041 sudo: pam_sss(sudo:auth): authentication failure; logname= uid=995 euid=0 tty= ruser=nrpe rhost= user=nrpe
May 15 15:26:43 on7p0041 sudo: pam_sss(sudo:auth): received for user nrpe: 10 (User not known to the underlying authentication module)
May 15 15:26:43 on7p0041 sudo: nrpe : command not allowed ; TTY=unknown ; PWD=/ ; USER=wasadmin ; COMMAND=/usr/lib64/nagios/plugins/check_dirsize

This is in the sudoers-file:

nrpe ALL = (wasadmin) NOPASSWD: /usr/bin/du
nrpe ALL = (wasadmin) NOPASSWD: /usr/lib64/nagios/plugins/check_dirsize -d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f

From the cli i can put in sudo -u wasadmin or witht the user nagios or nrpe, command works fine....

Any idea? Thnx

Re: How to config plugin check_newest_file_age

Posted: Wed May 15, 2019 9:54 am
by scottwilkerson
Your command might need to be just

Code: Select all

command[check_dirsize]=sudo /usr/lib64/nagios/plugins/check_dirsize $ARG1$

Re: How to config plugin check_newest_file_age

Posted: Wed May 15, 2019 10:08 am
by welbp00
Changed a few things, now ik works:

nrpe.cfg:

command[check_dirsize]=sudo -u wasadmin /usr/lib64/nagios/plugins/check_dirsize -d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f

/etc/sudoers:

nrpe ALL=(ALL) NOPASSWD: ALL

Not really what i wanted.... the directory is different in the dev environment then in the production environment....
Should be an variable...

How to fix that?

Re: How to config plugin check_newest_file_age

Posted: Wed May 15, 2019 10:30 am
by scottwilkerson
welbp00 wrote:Not really what i wanted.... the directory is different in the dev environment then in the production environment....
Should be an variable...

How to fix that?
If your command is set as this

Code: Select all

command[check_dirsize]=sudo -u wasadmin /usr/lib64/nagios/plugins/check_dirsize $ARG1$
You can pass it in an argument such as

Code: Select all

./check_nrpe -H linux-server -c check_dirsize -a '-d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f'

Re: How to config plugin check_newest_file_age

Posted: Thu May 16, 2019 6:51 am
by welbp00
scottwilkerson wrote:
welbp00 wrote:Not really what i wanted.... the directory is different in the dev environment then in the production environment....
Should be an variable...

How to fix that?
If your command is set as this

Code: Select all

command[check_dirsize]=sudo -u wasadmin /usr/lib64/nagios/plugins/check_dirsize $ARG1$
You can pass it in an argument such as

Code: Select all

./check_nrpe -H linux-server -c check_dirsize -a '-d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f'
Yes, got it to work.... however... just once.. Then i see in the nagios gui this error:
Critical: Service check timed out after 60.01 seconds

I have tried several time out values, but nothing worked....

Re: How to config plugin check_newest_file_age

Posted: Thu May 16, 2019 7:18 am
by scottwilkerson
That's a really long time for a check to process, how long does it take when you run it on the remote system?

I worry that you are going to cause serious performance issues on the remote system/drive if it takes that long to process and runs very frequently.

That said, to get it to work you likely will need to increase the service_check_timeout directive in your nagios.cfg to a timeframe over 60s

then restart nagios.

Re: How to config plugin check_newest_file_age

Posted: Thu May 16, 2019 8:56 am
by welbp00
scottwilkerson wrote:That's a really long time for a check to process, how long does it take when you run it on the remote system?

I worry that you are going to cause serious performance issues on the remote system/drive if it takes that long to process and runs very frequently.

That said, to get it to work you likely will need to increase the service_check_timeout directive in your nagios.cfg to a timeframe over 60s

then restart nagios.
Tested with several timeout settings... NOK.

Put this back into the nrpe.cfg :
command[check_dirsize]=sudo -u wasadmin /usr/lib64/nagios/plugins/check_dirsize -d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f

set the timeout back to 60 seconds as well, and it still works...

Set the timeperiod to run once a day. Sofar looks okay.

I think i leave it this way, and make a separate nrpe.cfg for the production environment. The path to the dir is different there.

Thnx sofar Scott.

Re: How to config plugin check_newest_file_age

Posted: Thu May 16, 2019 10:44 am
by scottwilkerson
welbp00 wrote:
scottwilkerson wrote:That's a really long time for a check to process, how long does it take when you run it on the remote system?

I worry that you are going to cause serious performance issues on the remote system/drive if it takes that long to process and runs very frequently.

That said, to get it to work you likely will need to increase the service_check_timeout directive in your nagios.cfg to a timeframe over 60s

then restart nagios.
Tested with several timeout settings... NOK.

Put this back into the nrpe.cfg :
command[check_dirsize]=sudo -u wasadmin /usr/lib64/nagios/plugins/check_dirsize -d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f

set the timeout back to 60 seconds as well, and it still works...

Set the timeperiod to run once a day. Sofar looks okay.

I think i leave it this way, and make a separate nrpe.cfg for the production environment. The path to the dir is different there.

Thnx sofar Scott.
sounds good!