Nagios – Changing The Default Page

Nagios – Changing The Default Page

This article explains how to change the default page displayed in Nagios Core at logon and when refreshed.

To change the default page for Nagios Core perform the following steps:

  • Edit the file /usr/local/nagios/share/index.php by executing the command below:
vi /usr/local/nagios/share/index.php
  • At the top of the file their will be a line beginning with $url as line shown below:
$url = 'main.php';
  • Change it to the page you want the home page to be, for example changing the $url line to the text below will default Nagios to showing the Service Overview For All Host Groups page as default:
$url = 'cgi-bin/status.cgi?hostgroup=all&style=overview';
  • Save and exit the file
  • Restart Nagios by executing the following command:
systemctl restart nagios
  • Log on to the Nagios web page and confirm that the default page has been changed

Getting The URL For A Page

You can get the URL for the page which you would like to open as the default page by right-clicking on the link you would like for example, Host Groups and selecting “Open link in new tab”.  When the page opens it will show the URL which can then be entered in to the index.php page as shown above.

Below are the URL settings for the common pages on the Nagios menu:

Menu Link URL
Tactical Overview cgi-bin/tac.cgi
Map map.php?host=all
Hosts cgi-bin/status.cgi?hostgroup=all&style=hostdetail
Services cgi-bin/status.cgi?host=all
Host Groups cgi-bin/status.cgi?hostgroup=all&style=overview
Host Groups – Summary cgi-bin/status.cgi?hostgroup=all&style=summary
Host Groups – Grid cgi-bin/status.cgi?hostgroup=all&style=grid
Service Groups cgi-bin/status.cgi?servicegroup=all&style=overview
Service Groups – Summary cgi-bin/status.cgi?servicegroup=all&style=summary
Service Groups – Grid cgi-bin/status.cgi?servicegroup=all&style=overview
Problems – Services cgi-bin/status.cgi?host=all&servicestatustypes=28