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
Need to change the behavior for Nagios config operations
Need to change the behavior for Nagios config operations
You do not have the required permissions to view the files attached to this post.
Re: Need to change the behavior for Nagios config operations
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.
/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
Re: Need to change the behavior for Nagios config operations
That worked, please keep me about the other 2 areas.
Re: Need to change the behavior for Nagios config operations
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!
Re: Need to change the behavior for Nagios config operations
Thanks and i highly appreciate your update. Can you please let me know how to track those task (8268) which you created.
Re: Need to change the behavior for Nagios config operations
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.
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!
Re: Need to change the behavior for Nagios config operations
*** 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:
Around line 186, change this:
To this:
Make sure that you change this line to who you want to allow:
*** 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.jsCode: Select all
function doConfig(mode)
{
$('#type').val(mode);
$('#writeConfigForm').submit();
}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();
}Code: Select all
var allowed_admins = ['nagiosadmin', 'user1', 'user2'];