Page 1 of 1

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

Posted: Tue Jul 19, 2016 11:20 am
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 ?

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

Posted: Tue Jul 19, 2016 12:23 pm
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.

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

Posted: Tue Jul 19, 2016 1:46 pm
by nagmoto
Thanks for the detail procedure. Please close this thread.