Hi Team,
We have a server for which few file systems only have root access so by using the command check_disk we are not able to get data.
We are getting below error. Is there any way to check with root user,
Error Details: DISK CRITICAL - /hana/log/VWH/mnt00001 is not accessible: Permission denied
File System Details:
dfXXX:~ # df -hT | grep /hana/log/VWH/mnt00001
/dev/mapper/vg_log1_dp_11-lvol1 xfs 520G 6.3G 514G 2% /hana/log/VWH/mnt00001
dfwhana20:~ # su nagios
nagios@dfXXX:/root> df -hT | grep /hana/log/VWH/mnt00001
nagios@dfXXX:/root>
Accessing filesystem with root user
Accessing filesystem with root user
Regards,
Sk Abdul Goffar
Nagios Version:Nagios XI 5.4.8
OS:CentOS release 6.5
Sk Abdul Goffar
Nagios Version:Nagios XI 5.4.8
OS:CentOS release 6.5
Re: Accessing filesystem with root user
If you are using the Linux NRPE Agent to run the check_disk plugin on the remote server, you can do the following changes and the plugin should run as root.
First, add the following 2 lines to the /etc/sudoers file
Then edit the nrep.cfg file where the check_disk command is defined and add /usr/bin/sudo to the command like the example below.
Save the nrpe.cfg file and restart the NRPE agent so the changes will take effect.
Try that and see if it works for you.
First, add the following 2 lines to the /etc/sudoers file
Code: Select all
Defaults:nagios !requiretty
nagios ALL=(root) NOPASSWD: /usr/local/nagios/libexec/check_diskCode: Select all
command[check_disk]=/usr/bin/sudo /usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$Try that and see if it works for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Accessing filesystem with root user
Below two line needs to add on Target server or Nagios server /etc/sudoers file. We are using nagios agent to get the data.
Defaults:nagios !requiretty
nagios ALL=(root) NOPASSWD: /usr/local/nagios/libexec/check_disk
Also is nagios user needs to have sudo permission in target server right?
Defaults:nagios !requiretty
nagios ALL=(root) NOPASSWD: /usr/local/nagios/libexec/check_disk
Also is nagios user needs to have sudo permission in target server right?
Regards,
Sk Abdul Goffar
Nagios Version:Nagios XI 5.4.8
OS:CentOS release 6.5
Sk Abdul Goffar
Nagios Version:Nagios XI 5.4.8
OS:CentOS release 6.5
Re: Accessing filesystem with root user
Sorry that I wasn't clear but those changes have to be done on the target server.
Those changes should allow the nagios user to run that plugin as root on the target server.
Those changes should allow the nagios user to run that plugin as root on the target server.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Accessing filesystem with root user
NP, Thanks for the details.
On the same server on status check we are getting below error. Can you please help on this.
When i check the directory /usr/local/nagios/etc/nrpe the file is not present. But the KPI's are collecting data.
cd /usr/local/nagios/etc/nrpe
-bash: cd: /usr/local/nagios/etc/nrpe: No such file or directory
service xinetd status
xinetd.service - Xinetd A Powerful Replacement For Inetd
Loaded: loaded (/usr/lib/systemd/system/xinetd.service; disabled)
Active: active (running) since Thu 2017-04-13 13:36:32 UTC; 1h 37min ago
Main PID: 114244 (xinetd)
CGroup: /system.slice/xinetd.service
└─114244 /usr/sbin/xinetd -stayalive -dontfork
Apr 13 15:11:47 dfXXXXXXX xinetd[114244]: EXIT: nrpe status=0 duration=0(sec)
Apr 13 15:11:50 dfXXXXXXX xinetd[114244]: EXIT: nrpe status=0 duration=5(sec)
Apr 13 15:12:43 dfXXXXXXX xinetd[114244]: START: nrpe from=172.26.241.185
Apr 13 15:12:43 dfXXXXXXX nrpe[129502]: Could not open config directory '/usr/local/nagios/etc/nrpe' for reading.
Apr 13 15:12:43 dfXXXXXXX nrpe[129502]: Continuing with errors...
Apr 13 15:12:44 dfXXXXXXX xinetd[114244]: EXIT: nrpe status=0 duration=1(sec)
Apr 13 15:12:44 dfXXXXXXX xinetd[114244]: START: nrpe from=172.26.241.185
Apr 13 15:12:44 dfXXXXXXX nrpe[129506]: Could not open config directory '/usr/local/nagios/etc/nrpe' for reading.
Apr 13 15:12:44 dfXXXXXXX nrpe[129506]: Continuing with errors...
Apr 13 15:12:44 dfXXXXXXX xinetd[114244]: EXIT: nrpe status=0 duration=0(sec)
On the same server on status check we are getting below error. Can you please help on this.
When i check the directory /usr/local/nagios/etc/nrpe the file is not present. But the KPI's are collecting data.
cd /usr/local/nagios/etc/nrpe
-bash: cd: /usr/local/nagios/etc/nrpe: No such file or directory
service xinetd status
xinetd.service - Xinetd A Powerful Replacement For Inetd
Loaded: loaded (/usr/lib/systemd/system/xinetd.service; disabled)
Active: active (running) since Thu 2017-04-13 13:36:32 UTC; 1h 37min ago
Main PID: 114244 (xinetd)
CGroup: /system.slice/xinetd.service
└─114244 /usr/sbin/xinetd -stayalive -dontfork
Apr 13 15:11:47 dfXXXXXXX xinetd[114244]: EXIT: nrpe status=0 duration=0(sec)
Apr 13 15:11:50 dfXXXXXXX xinetd[114244]: EXIT: nrpe status=0 duration=5(sec)
Apr 13 15:12:43 dfXXXXXXX xinetd[114244]: START: nrpe from=172.26.241.185
Apr 13 15:12:43 dfXXXXXXX nrpe[129502]: Could not open config directory '/usr/local/nagios/etc/nrpe' for reading.
Apr 13 15:12:43 dfXXXXXXX nrpe[129502]: Continuing with errors...
Apr 13 15:12:44 dfXXXXXXX xinetd[114244]: EXIT: nrpe status=0 duration=1(sec)
Apr 13 15:12:44 dfXXXXXXX xinetd[114244]: START: nrpe from=172.26.241.185
Apr 13 15:12:44 dfXXXXXXX nrpe[129506]: Could not open config directory '/usr/local/nagios/etc/nrpe' for reading.
Apr 13 15:12:44 dfXXXXXXX nrpe[129506]: Continuing with errors...
Apr 13 15:12:44 dfXXXXXXX xinetd[114244]: EXIT: nrpe status=0 duration=0(sec)
Regards,
Sk Abdul Goffar
Nagios Version:Nagios XI 5.4.8
OS:CentOS release 6.5
Sk Abdul Goffar
Nagios Version:Nagios XI 5.4.8
OS:CentOS release 6.5
Re: Accessing filesystem with root user
In the /usr/local/nagios/etc folder, there should be a nrpe.cfg file, does it exist?
Can you login to the remote server, run the following and post the /tmp/ls.txt file>
Also, post the /etc/xinetd.d/nrpe file as well so we can view it settings.
Can you login to the remote server, run the following and post the /tmp/ls.txt file>
Code: Select all
ls -lR /usr/local/nagios >/tmp/ls.txt fileBe sure to check out our Knowledgebase for helpful articles and solutions!
Re: Accessing filesystem with root user
Please find below requested details:
/usr/local/nagios/etc # ls -lrt
total 8
-rw-r--r-- 1 nagios nagios 8187 Apr 12 09:23 nrpe.cfg
# cat /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = X.X.X.X Y.Y.Y.Y
/usr/local/nagios/etc # ls -lrt
total 8
-rw-r--r-- 1 nagios nagios 8187 Apr 12 09:23 nrpe.cfg
# cat /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = X.X.X.X Y.Y.Y.Y
Regards,
Sk Abdul Goffar
Nagios Version:Nagios XI 5.4.8
OS:CentOS release 6.5
Sk Abdul Goffar
Nagios Version:Nagios XI 5.4.8
OS:CentOS release 6.5
Re: Accessing filesystem with root user
Run this to create the folder and set the permissions.
In the nrpe.cfg file, there is an include_dir option and when the nrpe agent runs, it looks in that folder and if it finds a config file, it uses them as well.
Code: Select all
mkdir /usr/local/nagios/etc/nrpe
chown nagios.nagios /usr/local/nagios/etc/nrpe
chmod 775 /usr/local/nagios/etc/nrpeThat should fix the "Could not open config directory '/usr/local/nagios/etc/nrpe' for reading." error.include_dir=/usr/local/nagios/etc/nrpe
Be sure to check out our Knowledgebase for helpful articles and solutions!