Menu

Write test on settings directory (config/): failed : Nagios core

Pratap
2019-07-05
2020-11-02
  • Pratap

    Pratap - 2019-07-05

    Hello,
    I have installed the nagios and now I trying to install the nagiosql but It gives me an error message,
    "Write test on settings directory (config/): failed"
    Details:
    my nagios path is : /usr/local/nagios
    nagiosql path is : /usr/local/nagios/share/nagiosql
    Nagiosql directory permissin:
    drwxrwxr-x. 2 apache apache 4096 Apr 26 23:52 admin
    -rwxrwxr-x. 1 apache apache 1860 Apr 26 23:52 admin.php
    drwxrwxr-x. 3 apache apache 76 Apr 26 23:52 config
    drwxrwxr-x. 2 apache apache 103 Apr 26 23:52 doc
    -rwxrwxr-x. 1 apache apache 1150 Apr 26 23:52 favicon.ico
    drwxrwxr-x. 4 apache apache 4096 Apr 26 23:52 functions
    drwxrwxr-x. 2 apache apache 4096 Apr 26 23:52 images
    -rwxrwxr-x. 1 apache apache 2403 Apr 26 23:52 index.php
    drwxrwxr-x. 7 apache apache 163 Apr 26 23:52 install
    drwxrwxr-x. 3 apache apache 18 Apr 26 23:52 libraries
    -rwxrwxr-x. 1 apache apache 35059 Apr 26 23:52 LICENSE
    drwxrwxr-x. 2 apache apache 27 Apr 26 23:52 scripts
    drwxrwxr-x. 4 apache apache 73 Apr 26 23:52 templates

    I have tried almost all the options but non of them work for me. I would really appreciate if you can help me on this.
    Thank you.

     
  • Martin

    Martin - 2019-07-05

    Please share the permissions of:
    /usr
    /usr/local
    /usr/local/nagios
    /usr/local/nagios/share
    /usr/local/nagios/share/nagiosql

     

    Last edit: Martin 2019-07-05
  • Pratap

    Pratap - 2019-07-05

    Thank you so much for quick response.
    Please find the below permission,

    /usr
    drwxr-xr-x. 13 root root 155 Jul 3 09:27 .
    dr-xr-xr-x. 17 root root 224 Jul 3 09:41 ..
    dr-xr-xr-x. 2 root root 57344 Jul 5 19:09 bin
    drwxr-xr-x. 2 root root 6 Apr 11 2018 etc
    drwxr-xr-x. 2 root root 6 Apr 11 2018 games
    drwxr-xr-x. 63 root root 12288 Jul 5 19:04 include
    dr-xr-xr-x. 45 root root 4096 Jul 5 14:26 lib
    dr-xr-xr-x. 157 root root 94208 Jul 5 19:07 lib64
    drwxr-xr-x. 50 root root 12288 Jul 5 15:36 libexec
    drwxr-xr-x. 13 root root 145 Jul 5 13:57 local
    dr-xr-xr-x. 2 root root 20480 Jul 5 19:07 sbin
    drwxr-xr-x. 262 root root 8192 Jul 5 19:07 share
    drwxr-xr-x. 4 root root 34 Jul 3 09:27 src
    lrwxrwxrwx. 1 root root 10 Jul 3 09:27 tmp -> ../var/tmp
    /usr/local
    drwxr-xr-x. 13 root root 145 Jul 5 13:57 .
    drwxr-xr-x. 13 root root 155 Jul 3 09:27 ..
    drwxr-xr-x. 2 root root 6 Apr 11 2018 bin
    drwxr-xr-x. 2 root root 6 Apr 11 2018 etc
    drwxr-xr-x. 2 root root 6 Apr 11 2018 games
    drwxr-xr-x. 2 root root 6 Apr 11 2018 include
    drwxr-xr-x. 2 root root 6 Apr 11 2018 lib
    drwxr-xr-x. 2 root root 6 Apr 11 2018 lib64
    drwxr-xr-x. 2 root root 6 Apr 11 2018 libexec
    drwxrwxrwx. 9 nagios nagios 94 Jul 5 14:08 nagios
    drwxr-xr-x. 2 root root 6 Apr 11 2018 sbin
    drwxr-xr-x. 5 root root 49 Jul 3 09:27 share
    drwxr-xr-x. 2 root root 6 Apr 11 2018 src
    /usr/local/nagios
    drwxrwxrwx. 9 nagios nagios 94 Jul 5 14:08 .
    drwxr-xr-x. 13 root root 145 Jul 5 13:57 ..
    drwxrwxr-x. 2 nagios nagios 38 Jul 5 13:57 bin
    drwxrwxr-x. 3 nagios nagios 96 Jul 5 13:59 etc
    drwxr-xr-x. 2 root root 6 Jul 5 14:08 include
    drwxrwxr-x. 2 nagios nagios 4096 Jul 5 14:08 libexec
    drwxrwxr-x. 2 nagios nagios 4096 Jul 5 13:57 sbin
    drwxrwxr-x. 16 apache apache 4096 Jul 5 19:40 share
    drwxrwxr-x. 5 nagios nagios 123 Jul 5 22:07 var
    /usr/local/nagios/share (webadmin is nagiosql)
    drwxrwxr-x. 16 apache apache 4096 Jul 5 19:40 .
    drwxrwxrwx. 9 nagios nagios 94 Jul 5 14:08 ..
    drwxrwxr-x. 4 apache apache 88 Jul 5 13:57 angularjs
    drwxrwxr-x. 3 apache apache 17 Jul 5 13:57 bootstrap-3.3.7
    -rwxrwxr-x. 1 apache apache 576 Jul 5 13:57 config.inc.php
    drwxrwxr-x. 2 apache apache 4096 Jul 5 13:57 contexthelp
    drwxrwxr-x. 2 apache apache 23 Jul 5 13:57 d3
    drwxrwxr-x. 3 apache apache 20 Jul 5 13:57 docs
    -rwxrwxr-x. 1 apache apache 879 Jul 5 13:57 graph-header.html
    -rwxrwxr-x. 1 apache apache 4135 Jul 5 13:57 histogram-form.html
    -rwxrwxr-x. 1 apache apache 5579 Jul 5 13:57 histogram-graph.html
    -rwxrwxr-x. 1 apache apache 2854 Jul 5 13:57 histogram.html
    -rwxrwxr-x. 1 apache apache 2370 Jul 5 13:57 histogram-links.html
    drwxrwxr-x. 3 apache apache 4096 Jul 5 13:57 images
    drwxrwxr-x. 2 apache apache 27 Jul 5 13:57 includes
    -rwxrwxr-x. 1 apache apache 1933 Jul 5 13:57 index.php
    -rwxrwxr-x. 1 apache apache 1660 Jul 5 13:57 infobox.html
    drwxrwxr-x. 2 apache apache 4096 Jul 5 13:57 js
    -rwxrwxr-x. 1 apache apache 1180 Jul 5 13:57 jsonquery.html
    drwxrwxr-x. 4 apache apache 26 Jul 5 14:08 locale
    -rwxrwxr-x. 1 apache apache 9284 Jul 5 13:57 main.php
    -rwxrwxr-x. 1 apache apache 2015 Jul 5 13:57 map-directive.html
    -rwxrwxr-x. 1 apache apache 3838 Jul 5 13:57 map-form.html
    -rwxrwxr-x. 1 apache apache 623 Jul 5 13:57 map-links.html
    -rwxrwxr-x. 1 apache apache 4365 Jul 5 13:57 map.php
    -rwxrwxr-x. 1 apache apache 1723 Jul 5 13:57 map-popup.html
    drwxrwxr-x. 2 apache apache 6 Jul 5 13:57 media
    -rwxrwxr-x. 1 apache apache 26 Jul 5 13:57 robots.txt
    -rwxrwxr-x. 1 apache apache 6193 Jul 5 13:57 side.php
    drwxrwxr-x. 2 apache apache 25 Jul 5 13:57 spin
    drwxrwxr-x. 2 apache apache 6 Jul 5 13:57 ssi
    drwxrwxr-x. 2 apache apache 4096 Jul 5 13:57 stylesheets
    -rwxrwxr-x. 1 apache apache 4245 Jul 5 13:57 trends-form.html
    -rwxrwxr-x. 1 apache apache 4256 Jul 5 13:57 trends-graph.html
    -rwxrwxr-x. 1 apache apache 852 Jul 5 13:57 trends-host-yaxis.html
    -rwxrwxr-x. 1 apache apache 2990 Jul 5 13:57 trends.html
    -rwxrwxr-x. 1 apache apache 3586 Jul 5 13:57 trends-links.html
    -rwxrwxr-x. 1 apache apache 1065 Jul 5 13:57 trends-service-yaxis.html
    drwxrwxr-x. 11 apache apache 207 Apr 26 23:52 webadmin
    /usr/local/nagios/share/webadmin
    rwxrwxr-x. 11 apache apache 207 Apr 26 23:52 .
    drwxrwxr-x. 16 apache apache 4096 Jul 5 19:40 ..
    drwxrwxr-x. 2 apache apache 4096 Apr 26 23:52 admin
    -rwxrwxr-x. 1 apache apache 1860 Apr 26 23:52 admin.php
    drwxrwxr-x. 3 apache apache 76 Jul 5 21:06 config
    drwxrwxr-x. 2 apache apache 103 Apr 26 23:52 doc
    -rwxrwxr-x. 1 apache apache 1150 Apr 26 23:52 favicon.ico
    drwxrwxr-x. 4 apache apache 4096 Apr 26 23:52 functions
    drwxrwxr-x. 2 apache apache 4096 Apr 26 23:52 images
    -rwxrwxr-x. 1 apache apache 2403 Apr 26 23:52 index.php
    drwxrwxr-x. 7 apache apache 163 Apr 26 23:52 install
    drwxrwxr-x. 3 apache apache 18 Apr 26 23:52 libraries
    -rwxrwxr-x. 1 apache apache 35059 Apr 26 23:52 LICENSE
    drwxrwxr-x. 2 apache apache 27 Apr 26 23:52 scripts
    drwxrwxr-x. 4 apache apache 73 Apr 26 23:52 templates

    Thank you.
    Pratap

     

    Last edit: Pratap 2019-07-05
  • Martin

    Martin - 2019-07-05

    The easier readable way is:
    ls -ald /usr
    But it's ok.

    What type of os do you use?
    Are you using SELinux?

    Simulate the command with:
    su -c 'touch /usr/local/nagios/share/webadmin/config/test' - apache -s /bin/bash
    Is there a file "test" in /usr/local/nagios/share/webadmin/config/ with user "apache"?

     
  • Pratap

    Pratap - 2019-07-06

    OS CentOS Linux release 7.6.1810 (Core)

    Yes SELinux is enabled

    Afetr runing above command text file is generated with user apache
    su -c 'touch /usr/local/nagios/share/webadmin/config/test' - apache -s /bin/bash
    drwxrwxr-x. 3 apache apache 88 Jul 6 07:57 .
    drwxrwxr-x. 11 apache apache 207 Apr 26 23:52 ..
    -rwxrwxr-x. 1 apache apache 9332 Apr 26 23:52 content.css
    -rwxrwxr-x. 1 apache apache 28447 Apr 26 23:52 fieldvars.php
    drwxrwxr-x. 15 apache apache 175 Apr 26 23:52 locale
    -rwxrwxr-x. 1 apache apache 4216 Apr 26 23:52 main.css
    -rw-r--r--. 1 apache apache 0 Jul 6 07:57 test

    Thank you.
    Pratap

     
  • Martin

    Martin - 2019-07-06

    In this case, I think that SELinux prevents Apache daemon from writing to the directory.

    Can you disable SELinux to check it? Or is there a SELinux logfile that logs the failed access? You will probably need to adjust the SELinux configuration and add the directory to the list of allowed targets.

     
  • Pratap

    Pratap - 2019-07-06

    Wow Thanks a lot man !!! It was SELinux causing the problem
    Current SELinux mode is : " enforcing" and I changed it to "permissive" and now error is gone.

    I really do appreciate your afford on analysis.

    Thanks :)

     

    Last edit: Pratap 2019-07-06
  • Duane Purtell

    Duane Purtell - 2020-11-02

    I think my issue is related, what is the selinux command to allow Apache daemon to write to the directory? I need to have enforcing mode enabled, but getting this error: running the Tools/Nagios control/Check configuration files button returns this error Error: Unable to write to check_result_path ('/usr/local/nagios/var/spool/checkresults') - Permission denied

     

Log in to post a comment.