Nagios xi 5.8.3 issue with Hostgroup commands

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Nagios xi 5.8.3 issue with Hostgroup commands

Post by hbouma »

In the past, we tried to hide the Enable/Disable notifications from hostgroups/servicegroups. We were able to use https://support.nagios.com/forum/viewto ... 95#p265982 in the past, but this is no longer working now that the commands are in a popup instead of on the same page.

I am hoping that there is a new workaround to hide these items as we have multiple end users that tend to disable notifications themselves without realizing that a disable never automatically re-enables.
2021-05-11 09_02_00-.png
You do not have the required permissions to view the files attached to this post.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Nagios xi 5.8.3 issue with Hostgroup commands

Post by benjaminsmith »

Hi Henry,

That modal is located in the following file.

Code: Select all

/usr/local/nagiosxi/html/includes/components/xicore/status.php
You can simply comment out the area for those commands. However, keep in mind any upgrades would overwrite the file again.

Code: Select all

<div class="xi-modal hide" id="hostgroup-commands" style="max-width: 400px;">
    <h2><?php echo _('Hostgroup Commands'); ?></h2>
    <div style="margin: 0 0 10px 0; font-size: 13px;"><b><span class="hg-name"></span></b></div>
    <div>
        <p><?php echo _('Submit a bulk command for all the hosts or services in the selected hostgroup.'); ?></p>
        <div style="margin: 10px 0;">
            <div><a class="cmdlink dt" data-cmd-type="84"><img src="<?php echo theme_image('time_add.png'); ?>"><?php echo _('Schedule downtime for all hosts'); ?></a></div>
            <div><a class="cmdlink dt" data-cmd-type="85"><img src="<?php echo theme_image('time_add.png'); ?>"><?php echo _('Schedule downtime for all services'); ?></a></div>
        </div>
        <!--
        <div style="margin-bottom: 10px;">
            <div><a class="cmdlink" data-cmd-type="65"><img src="<?php echo theme_image('notifications2.png'); ?>"><?php echo _('Enable notifications for all hosts'); ?></a></div>
            <div><a class="cmdlink" data-cmd-type="66"><img src="<?php echo theme_image('nonotifications.png'); ?>"><?php echo _('Disable notifications for all hosts'); ?></a></div>
        </div>
        <div style="margin-bottom: 10px;">
            <div><a class="cmdlink" data-cmd-type="63"><img src="<?php echo theme_image('notifications2.png'); ?>"><?php echo _('Enable notifications for all services'); ?></a></div>
            <div><a class="cmdlink" data-cmd-type="64"><img src="<?php echo theme_image('nonotifications.png'); ?>"><?php echo _('Disable notifications for all services '); ?></a></div>
        </div>
        -->
        <div><a class="cmdlink" data-cmd-type="67"><img src="<?php echo theme_image('enable_small.gif'); ?>"><?php echo _('Enable active checks of all services'); ?></a></div>
        <div><a class="cmdlink" data-cmd-type="68"><img src="<?php echo theme_image('cross.png'); ?>"><?php echo _('Disable active checks of all services'); ?></a></div>
    </div>
</div>
Otherwise, you could use some Javascript in the the Custom Includes component to modify the modal when loaded.

Hope that helps answer your question. Let us know if you need clarification on anything.

Regards,
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: Nagios xi 5.8.3 issue with Hostgroup commands

Post by hbouma »

Thank you.

We have tried using custom includes in the past, but at the time, the custom includes was broken. Now, I do not have enough knowledge myself to do this change, but I have written the following into our custom script that is run after each upgrade to customize these type of things.

Code: Select all

sed -i "/'Hostgroup Commands'/{n;d}" /usr/local/nagiosxi/html/includes/components/xicore/status.php
sed -i "/'Servicegroup Commands'/{n;d}" /usr/local/nagiosxi/html/includes/components/xicore/status.php
sed -i "/'Submit a bulk command for all the hosts or services in the selected hostgroup./{n;d}" /usr/local/nagiosxi/html/includes/components/xicore/status.php
sed -i "/'Submit a bulk command for all the hosts or services in the selected servicegroup./{n;d}" /usr/local/nagiosxi/html/includes/components/xicore/status.php
sed -i "/'Schedule downtime for all services'/{n;N;N;N;N;N;N;N;N;N;N;d}" /usr/local/nagiosxi/html/includes/components/xicore/status.php
Now, if anyone happens to know enough about the custom includes to write this up in a file, I will be happy to use that instead.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi 5.8.3 issue with Hostgroup commands

Post by ssax »

While not generally something we get involved in as it's a customization thing that really requires you to know css/js in order to use the custom includes functionality, here is an example:

Create file called base.css:

Code: Select all

#hostgroup-commands div:nth-child(3) div:nth-child(3) {
	display: none !important;
}

#hostgroup-commands > div:nth-child(3) > div:nth-child(4) {
	display: none !important;
}
Upload it in Admin > Custom Includes, check the box next to it, save it.

Clear your cache or try shift + clicking refresh and that should do it.