Need to change the behavior for Nagios config operations

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Need to change the behavior for Nagios config operations

Post by bosecorp »

Hi Team,

This topic needs immediate attention.

If you go to the NagiosXI Core config manager >> Write config File page

You can see 4 different options like "Write Configs to file", Verify.., Delete all hosts... Restart Nagios.

I have noticed that even if you click on the these text, the button gets highlighted automatically and then if you just click on the "text" the option gets activated.

Example: Please see the attached screenshot. So if you click on the highlighted (red) text the option gets triggered.
If you click on the text "Files" which is just above the "Delete" option, it directly gets activated and then we get a message "All the hosts/services are deleted successfully"

This is something which is really scary, so below is what we are expecting
1) Is it possible to change this behavior which i just explained?
2) Can we have a confirmation after we hit on "Delete" option ?
3) Can we restrict the "Delete" option to only specific Nagios admins?

Thanks
You do not have the required permissions to view the files attached to this post.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Need to change the behavior for Nagios config operations

Post by tmcdonald »

Edit the following:

/usr/local/nagiosxi/html/includes/components/ccm/includes/applyconfig.inc.php

And change lines like these:

<label for='writeConfig'>"._("Write Configs To File")."</label><br />

to this:

<label>"._("Write Configs To File")."</label><br />

and save. There should be 4, one for each button. Basically we are just removing the for='something' parts.

Regarding points 2 and 3, I would need a dev to take a closer look.
Former Nagios employee
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: Need to change the behavior for Nagios config operations

Post by bosecorp »

That worked, please keep me about the other 2 areas.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Need to change the behavior for Nagios config operations

Post by lmiltchev »

I posted an internal feature request for 2) and 3) - (TASK ID 8268). Thank you!
Be sure to check out our Knowledgebase for helpful articles and solutions!
bosecorp
Posts: 929
Joined: Thu Jun 26, 2014 1:00 pm

Re: Need to change the behavior for Nagios config operations

Post by bosecorp »

Thanks and i highly appreciate your update. Can you please let me know how to track those task (8268) which you created.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Need to change the behavior for Nagios config operations

Post by lmiltchev »

The internal tasks are not publicly available, but if you asked us (on the forum) about a specific task (providing the TASK ID), we would give you an update.
Another option would be to post a feature request on our public tracker, where you can monitor the progress.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Need to change the behavior for Nagios config operations

Post by ssax »

*** Note: This will get reverted if you upgrade and will need to be reimplemented.
*** Make sure that you have known-good backups/vm snapshots before making any modifications

For 2 and 3, edit this file:

Code: Select all

/usr/local/nagiosxi/html/includes/components/ccm/javascript/main_js.js
Around line 186, change this:

Code: Select all

function doConfig(mode)
{
    $('#type').val(mode);
    $('#writeConfigForm').submit();
}
To this:

Code: Select all

function doConfig(mode)
{
    if (mode = 'delete') {
        var name = '<%= session.getAttribute("username") %>';
        var allowed_admins = ['nagiosadmin', 'user1', 'user2'];

        if (!jQuery.inArray(name, allowed_admins)) {
            alert('Sorry, you are not authorized.');
            return;
        }

        if (!confirm("Are you sure you want to delete all config files?")) {
            return;
        }
    }

    $('#type').val(mode);
    $('#writeConfigForm').submit();
}
Make sure that you change this line to who you want to allow:

Code: Select all

var allowed_admins = ['nagiosadmin', 'user1', 'user2'];
Locked