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 »

Hi Scott,
meanwhile in the bat cave... ;-), working on another plugin..... check_dirsize.

Works fine on the commandline, but not trough nrpe ...

Commandline on the remote server:

./check_dirsize -d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f
1698 MB - ok|'size'=1698MB;2000;2048

On the nagios-server commandline:

./check_nrpe -H linux-host -c check_dirsize -a '-d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f'
Error: invalid option -- 'w' /usr/bin/du

nrpe.cfg:
command[check_dirsize]=/usr/lib64/nagios/plugins/check_dirsize -d '$ARG1$' -w '$ARG2$' -c '$ARG3$' -f

Tried several options in the nrpe.cfg, but did not get it to work....
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 »

change this

Code: Select all

command[check_dirsize]=/usr/lib64/nagios/plugins/check_dirsize -d '$ARG1$' -w '$ARG2$' -c '$ARG3$' -f
to this

Code: Select all

command[check_dirsize]=/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 »

scottwilkerson wrote:
welbp00 wrote:Yes, i did.
Hmm, it may have to be set on the first time it is loaded.

I can only suggest not sending a passive result setting the status to OK
Hi Scott,
in the nagios web interface, you can force execute the check. After done that, the state Pending was not showing anymore.
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:change this

Code: Select all

command[check_dirsize]=/usr/lib64/nagios/plugins/check_dirsize -d '$ARG1$' -w '$ARG2$' -c '$ARG3$' -f
to this

Code: Select all

command[check_dirsize]=/usr/lib64/nagios/plugins/check_dirsize $ARG1$
Hi Scott,
i made the adjustment. I am getting an other message now:

-bash-4.2# ./check_nrpe -H linux-server sudo su - -c check_dirsize -a '-d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f'
Error: Permission denied

The check trough the commandline on the linux-server works fine..

-bash-4.2# ./check_dirsize -d /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES -w 2000 -c 2048 -f
1698 MB - ok|'size'=1698MB;2000;2048

Do i have to do something with sudo...?

Regards, Paul.
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 »

Can you show the permissions of these

Code: Select all

ls -l /usr/lib64/nagios/plugins/check_dirsize
ls -ld /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES
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:Can you show the permissions of these

Code: Select all

ls -l /usr/lib64/nagios/plugins/check_dirsize
ls -ld /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES
-bash-4.2# ls -l /usr/lib64/nagios/plugins/check_dirsize
-rwxr-xr-x 1 root root 4338 May 9 10:55 /usr/lib64/nagios/plugins/check_dirsize

-bash-4.2# ls -ld /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES
drwxr-x--- 2 wasadmin wasadmin 16384 May 9 10:14 /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES
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 »

In order to allow the nagios user to read from that directory you either need to make it readable to others

Code: Select all

chmod o+r /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES
or add nagios to the wasadmin group
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:In order to allow the nagios user to read from that directory you either need to make it readable to others

Code: Select all

chmod o+r /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES
or add nagios to the wasadmin group
I have done chmod o+r, the error message changed to Error: permission denied /usr/bin/du
welbp00
Posts: 50
Joined: Fri Mar 08, 2019 5:48 am

Re: How to config plugin check_newest_file_age

Post by welbp00 »

welbp00 wrote:
scottwilkerson wrote:In order to allow the nagios user to read from that directory you either need to make it readable to others

Code: Select all

chmod o+r /ConnectionsContentStoreLink/blogs/upload/f/b/c/fbc40af7-f364-4114-bd59-6cdddd04f6d0/BLOGS_UPLOADED_IMAGES
or add nagios to the wasadmin group
I have done chmod o+r, the error message changed to Error: permission denied /usr/bin/du
I have got it to work; added this to /etc/sudoers.d/ 040_nrpe_dmgr

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

nrpe.cfg:

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

Is this the correct way to do it?

Regards,

Paul.
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: Is this the correct way to do it?
sure, that would work too.

Glad to hear you got it working
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked