Remove "Disable active check of this host/service" from menu

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
nagmoto
Posts: 195
Joined: Fri Jan 09, 2015 8:05 am

Remove "Disable active check of this host/service" from menu

Post by nagmoto »

Hi

I am interested to remove "Disable active check of this host/service" from host commands right menu.

Please advise how can I do that ?
Attachments
hosts-command.PNG
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Remove "Disable active check of this host/service" from

Post by ssax »

The only way you can do that is to modify the source code and recompile it.

*** 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

Let's use Core 4.1.1 as an example.

Code: Select all

cd /tmp
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
tar zxf nagios-4.1.1.tar.gz
cd nagios-4.1.1
Edit this file:

Code: Select all

/tmp/nagios-4.1.1/cgi/extinfo.c
Delete this code (around line 1109):

Code: Select all

                if(temp_hoststatus->checks_enabled == TRUE) {
                        printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Disable Active Checks Of This Host' TITLE='Disable Active Checks Of This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Disable active checks of this host</a></td></tr>\n", url_images_path, DISABLED_ICON, COMMAND_CGI, CMD_DISABLE_HOST_CHECK, url_encode(host_name));
                        }
                else
                        printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Active Checks Of This Host' TITLE='Enable Active Checks Of This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable active checks of this host</a></td></tr>\n", url_images_path, ENABLED_ICON, COMMAND_CGI, CMD_ENABLE_HOST_CHECK, url_encode(host_name));
                printf("<tr CLASS='data'><td><img src='%s%s' border=0 ALT='Re-schedule Next Host Check' TITLE='Re-schedule Next Host Check'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s%s'>Re-schedule the next check of this host</a></td></tr>\n", url_images_path, DELAY_ICON, COMMAND_CGI, CMD_SCHEDULE_HOST_CHECK, url_encode(host_name), (temp_hoststatus->checks_enabled == TRUE) ? "&force_check" : "");
Then:

Code: Select all

cd /tmp/nagios-4.1.1
./configure
make all
cp /tmp/nagios-4.1.1/cgi/extinfo.cgi /usr/local/nagios/sbin/extinfo.cgi
That should do it.
nagmoto
Posts: 195
Joined: Fri Jan 09, 2015 8:05 am

Re: Remove "Disable active check of this host/service" from

Post by nagmoto »

Thanks for the detail procedure. Please close this thread.
Locked