How to config plugin check_newest_file_age

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Re: How to config plugin check_newest_file_age

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to config plugin check_newest_file_age

Post by scottwilkerson »

Your command might need to be just

Code: Select all

command[check_dirsize]=sudo /usr/lib64/nagios/plugins/check_dirsize $ARG1$
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Re: How to config plugin check_newest_file_age

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to config plugin check_newest_file_age

Post 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'
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Re: How to config plugin check_newest_file_age

Post 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....
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to config plugin check_newest_file_age

Post 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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Re: How to config plugin check_newest_file_age

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to config plugin check_newest_file_age

Post 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!
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked