Unable to write to check_result_path

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Unable to write to check_result_path

Post by pratik.patel »

Error: Unable to write to check_result_path ('/usr/local/nagios/var/spool/checkresults') - Permission denied

I think permission looks good, refer below output:

[root@xxxxxxx etc]# ls -ll /usr/local/nagios/var/spool
total 12
drwxrwsrwx. 2 nagios nagios 4096 May 9 13:15 checkresults
drwxr-xr-x. 2 nagios nagios 4096 May 9 13:23 perfdata
drwxr-xr-x. 2 nagios nagios 4096 May 9 13:23 xidpe
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: Unable to write to check_result_path

Post by pratik.patel »

This error appears only when I try to verify files and restart nagios core from GUI.
I am also able to apply configuration without any error.

when I verify files on CLI, there are no errors.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Unable to write to check_result_path

Post by tgriep »

There could be an issue with the nagios user / group account that is causing the issue you are seeing.
It may be expired, or locked, etc. but to check the account, can you run the following commands as root and post the output?

Code: Select all

chage -l nagios
grep nag /etc/group
ls -al /usr/local/nagios/var
Thanks
Be sure to check out our Knowledgebase for helpful articles and solutions!
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: Unable to write to check_result_path

Post by pratik.patel »

[root@xxxxxxx etc]# chage -l nagios
Last password change : Jan 04, 2017
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 28
[root@xxxxxxx etc]#
[root@xxxxxxx etc]# grep nag /etc/group
nagios:x:992:nagios,apache
nagcmd:x:32793:nagios,apache
[root@xxxxxxx etc]#
[root@xxxxxxx etc]# ls -al /usr/local/nagios/var
total 24040
drwxrwxr-x. 6 nagios nagios 4096 May 9 21:41 .
drwxr-xr-x. 9 root root 4096 May 5 17:00 ..
drwxrwxr-x. 2 nagios nagios 4096 May 8 23:59 archives
-rw-r--r--. 1 nagios nagios 3921 May 9 21:41 host-perfdata
-rw-r--r--. 1 nagios nagios 34 May 9 17:09 nagios.configtest
-rw-r-----. 1 nagios nagios 6 May 9 14:34 nagios.lock
-rw-r-----. 1 nagios nagios 735668 May 9 21:38 nagios.log
-rw-r--r--. 1 nagios nagios 5 May 9 09:00 ndo2db.lock
-rw-r--r--. 1 nagios nagios 0 May 9 14:34 ndomod.tmp
srwxr-xr-x. 1 nagios nagios 0 May 9 09:00 ndo.sock
-rw-r--r--. 1 nagios nagios 3368 May 9 09:00 npcd.log
-rw-r--r--. 1 nagios nagios 4807341 May 9 14:34 objects.cache
-rw-r--r--. 1 nagios nagios 4807341 May 9 17:09 objects.precache
-rw-------. 1 nagios nagios 7131728 May 9 21:34 retention.dat
drwxrwsr-x. 2 nagios nagcmd 4096 May 9 14:34 rw
-rw-r--r--. 1 nagios nagios 0 May 9 21:41 service-perfdata
drwxr-xr-x. 5 nagios nagios 4096 May 5 16:59 spool
drwxr-xr-x. 2 nagios nagios 4096 May 9 21:40 stats
-rw-rw-r--. 1 nagios nagios 7080355 May 9 21:41 status.dat
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: Unable to write to check_result_path

Post by tacolover101 »

i think you need to add the nagios user to the apache group which it's running under.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Unable to write to check_result_path

Post by tgriep »

Those settings look good so thanks for posting the info.
It may be a setting in the sudoers file so can you post the /etc/sudoers file so we can check it for any configuration issues?
Be sure to check out our Knowledgebase for helpful articles and solutions!
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: Unable to write to check_result_path

Post by pratik.patel »

Cmnd_Alias SU = /bin/su
Cmnd_Alias SHELLS = /bin/sh, /bin/bash, /bin/csh, /bin/ksh
Cmnd_Alias VISUDO = /usr/sbin/visudo
Cmnd_Alias SU_XXXXXXXXXXXX = /bin/su - XXXXXXXXXXXX*

VK_ROOT ALL = NOPASSWD: ALL, !SU, !SHELLS, !VISUDO

SU_ROOT ALL = NOPASSWD: ALL, !SHELLS, !VISUDO

# full access for root and ansible
root ALL = (ALL) ALL


nagios ALL=(root) NOPASSWD: /sbin/service httpd configtest, /usr/sbin/apachectl -S, /opt/continuent/tungsten/cluster-home/bin/check_tungsten_services, /opt/continuent/tungsten/cluster-home/bin/check_tungsten_online, /opt/continuent/tungsten/cluster-home/bin/check_tungsten_latency, /opt/continuent/tungsten/cluster-home/bin/check_tungsten_latency_mod, /opt/continuent/tungsten/cluster-home/bin/check_tungsten_progress

apache ALL=(root) NOPASSWD: /usr/bin/virsh list


User_Alias NAGIOSXI=nagios
User_Alias NAGIOSXIWEB=apache
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios checkconfig
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd status
NAGIOSXI ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/html/includes/components/profile/getprofile.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/upgrade_to_latest.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/change_timezone.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/reset_config_perms.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/backup_xi.sh *
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/messages
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/httpd/error_log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/mysqld.log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/html/includes/components/profile/getprofile.sh
NAGIOSXIWEB ALL = NOPASSWD:/etc/init.d/snmptt restart
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/repair_databases.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Unable to write to check_result_path

Post by tgriep »

Lets check to see if the Apache user account is expired and the list of daemons running on the system, can you run the following and post the output?

Code: Select all

chage -l apache
ps -ef --cols=300
Then, run this command as root

Code: Select all

tail -f /var/log/httpd/*_log
Then login to the XI GUI, generate the error and post the output from the tail command.
Thanks.
Be sure to check out our Knowledgebase for helpful articles and solutions!
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: Unable to write to check_result_path

Post by pratik.patel »

I have send you PM.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Unable to write to check_result_path

Post by tgriep »

Thanks for the files, they were received and shared with the other techs.

The nagcmd group has to be set on that folder so the nagios user account can access that folder, run this as root to fix the issue.
chown nagios.nagcmd /usr/local/nagios/var/spool/checkresults
chmod 775 /usr/local/nagios/var/spool/checkresults
chmod g+s /usr/local/nagios/var/spool/checkresults

Try that and let up know if this fixes the issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked