Page 3 of 4
Re: How to config plugin check_newest_file_age
Posted: Thu May 09, 2019 8:44 am
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....
Re: How to config plugin check_newest_file_age
Posted: Thu May 09, 2019 9:04 am
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$
Re: How to config plugin check_newest_file_age
Posted: Fri May 10, 2019 7:30 am
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.
Re: How to config plugin check_newest_file_age
Posted: Fri May 10, 2019 7:35 am
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.
Re: How to config plugin check_newest_file_age
Posted: Fri May 10, 2019 8:31 am
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
Re: How to config plugin check_newest_file_age
Posted: Fri May 10, 2019 1:47 pm
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
Re: How to config plugin check_newest_file_age
Posted: Fri May 10, 2019 1:50 pm
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
Re: How to config plugin check_newest_file_age
Posted: Sat May 11, 2019 2:17 pm
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
Re: How to config plugin check_newest_file_age
Posted: Mon May 13, 2019 9:13 am
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.
Re: How to config plugin check_newest_file_age
Posted: Mon May 13, 2019 9:50 am
by scottwilkerson
welbp00 wrote:
Is this the correct way to do it?
sure, that would work too.
Glad to hear you got it working