Thruk Config tool - object settings

This forum was archived to /woltlab and is now in read-only mode. Please register a new account on our new community platform.

You can create a thread on the new site and link to an archived thread. This archive is available as knowledge base, safe and secured.

More details here.
  • Hi all,
    I'm a new Thruk user. I've installed it along with Nagios 4.08 on Debian Jessie.


    I'm trying to figure ho to make the object settings (under Config Tool menu) work. At the moment I'm stuck and i could use a little help...
    I've enabled the Object settings via /etc/thruk/thruk_local.conf:


    It seems to work, but after I have made any changes to the config files, whenever I press the "Check configuration changes" button,
    I'm presented the error:

    Code
    1. "Background Job Failed
    2. background job failed, look at your logfile for details" .


    /var/log/thruk/thruk.log shows there is a "permission denied" error:

    Code
    1. [2015/03/04 15:54:52][ERROR][Thruk.Utils.External] Can't exec "/usr/local/nagios/bin/nagios": Permission denied at lib/Thruk/Utils/IO.pm line 265.
    2. [2015/03/04 15:54:52][ERROR][Thruk.Controller.error] Background Job Failed
    3. [2015/03/04 15:54:52][ERROR][Thruk.Controller.error] on page: http://10.1.1.10/thruk/cgi-bin/job.cgi?job=38a30


    But it's not clear why the permission to execute the command is denied...
    nagios process is owned by nagios:


    Code
    1. ls -la /usr/local/nagios/bin/nagios
    2. -rwxrwxr-- 1 nagios nagios 690744 Oct 30 17:12 /usr/local/nagios/bin/nagios


    I'm a bit confused...

  • Hi sni, thank you for the help.
    I think I might not have been clear, though: I have the problem when issuing the check config command from inside Thruk. It's like if Thruk had not the permission to execute the nagios check command (as declared in the thruk_local.conf), but just when performed from the Site Config Tool page...

  • But the www-data user is already in the nagcmd group...
    I have a test setup on another machine where I have installed naemon+thruk and everything is working with similar users/groups as in my Nagios server... The only difference is naemon+thruk has been installed via consol-labs repository while the nagios+thruk has not.
    Could you elaborate a bit more on your solution?

  • You are being quite cryptic :)




    And


    Code
    1. :~# groups www-data
    2. www-data : www-data nagios nagcmd


    According to this, www-data should be correctly setup, or not?
    Obviously there is something wrong, otherwise it would work.
    I honestly did not understand your explanation...

  • According to this, www-data should be correctly setup, or not?
    Obviously there is something wrong, otherwise it would work.
    I honestly did not understand your explanation...


    Never mind, the configuration is actually correct. It just needed a couple of restarts of nagios/thruk/apache, because restarting just once didn't made the trick.

  • Hi,
    I'm facing the exact same problem, only in my situation restart won't do the trick... To make things worse, I'm quite novice in this field, so I really need detailed description what to do in order to solve this. Hope someone will have enough patience  :) 
    My configuration is CentOS 6.7 + Nagios 4.1.1 + check_mk 1.2.6p14 + Thruk 2.04
    My /etc/thruk/thruk_local.conf looks like this:


    and my /etc/thruk/cgi.cfg file looks like this:

    Code
    1. default_user_name=nagiosadmin
    2. authorized_for_system_information=nagiosadmin
    3. authorized_for_configuration_information=nagiosadmin
    4. authorized_for_system_commands=nagiosadmin
    5. authorized_for_all_services=nagiosadmin
    6. authorized_for_all_hosts=nagiosadmin
    7. authorized_for_all_service_commands=nagiosadmin
    8. authorized_for_all_host_commands=nagiosadmin


    and in thruk.conf is set

    Code
    1. AuthUserFile /usr/local/nagios/etc/htpasswd.users


    So, the problem is very similar, when I press the "Check configuration changes" button in "Object Settings -> Apply Configuration Changes" I'm presented with "Background Job Failed" message.
    And /var/log/thruk/thruk.log shows there is a "permission denied" error:

    Code
    1. [2015/12/09 10:53:42][xxx.xxx.net][ERROR][Thruk] Can't exec "/usr/local/nagios/bin/nagios": Permission denied at /usr/share/thruk/lib/Thruk/Utils/IO.pm line 287.
    2. [2015/12/09 10:53:42][xxx.xxx.net][ERROR][Thruk] Background Job Failed
    3. [2015/12/09 10:53:42][xxx.xxx.net][ERROR][Thruk] on page: http://192.168.1.220/thruk/cgi-bin/job.cgi?job=fdcf4


    thx

  • OK, for the record here is what I did to solve this problem
    /etc/thruk/thruk_local.conf

    Code
    1. <configtool>
    2. core_conf = /usr/local/nagios/etc/nagios.cfg
    3. obj_check_cmd = sudo -u root /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
    4. obj_reload_cmd = sudo -u root /etc/init.d/nagios reload
    5. </configtool>


    Add this to /etc/sudoers if your Thruk is running under apache account:

    Code
    1. # Needed for Thruk
    2. Defaults:apache !requiretty
    3. apache ALL = (root) NOPASSWD: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
    4. apache ALL = (root) NOPASSWD: /etc/init.d/nagios reload