Saturday, July 7, 2012

Change Nagios' Default Home Page

My last install of Nagios on CentOS went all fine except the home page of Nagios was not loading the main container with welcome page. It was blank. I had to change default home page to something meaningful. I changed it to "tactical overview" page.

In /usr/local/nagios/share/index.php or /usr/share/nagios/htdocs/index.php file, change this line
$corewindow="main.php";
to:
$corewindow="cgi-bin/tac.cgi";
If you do not find your index.php in above two locations, try using this command to locate it on your disc:
locate index.php | grep nagios

Here are a couple of paths that you may be interested in
"Tactical Summary": cgi-bin/tac.cgi
"Map"             : cgi-bin/statusmap.cgi?host=all
"Hosts"           : cgi-bin/status.cgi?hostgroup=all&style=hostdetail
"Services"        : cgi-bin/status.cgi?host=all
"Summary"         : cgi-bin/status.cgi?hostgroup=all&style=summary
"Problems"        : cgi-bin/status.cgi?host=all&servicestatustypes=28
"Availability"    : cgi-bin/avail.cgi
"Trends"          : cgi-bin/trends.cgi
"Summary"         : cgi-bin/summary.cgi

8 comments:

  1. This was a great hack in versions up to 4.0.5 or 4.0.6. Unfortunately, it no longer works in 4.0.7 :(
    $corewindow isn't defined anyhere in index.php or main.php. Sadness.

    ReplyDelete
    Replies
    1. Hi ! In Nagios 4.0.7 you have a $url variable at the top of your index.php.
      By default it is set as following: $url = 'main.php', but you can change it for others paths listed in the article above and the Hack will work for 4.0.7 ! ;)

      (And sorry if I made some mistakes, I'm a french Nagios user and I have to perfect my english speaking)

      Delete
  2. This hack doesn't work for Nagios 4.1.1: it seems that the new Apache configuration doesn't allow to touch the .cgi.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. For 4.1.1 :
    1 - Create a copy of main.php and call it main2.php
    2 - Edit main2.php and insert the following (Replace [IP] with Nagios server ip or hostname):
    Between php tags: header("Location: http://[IP]/nagios/cgi-bin/status.cgi?hostgroup=all&style=overview");

    3 - Edit index.php : $url = 'main2.php'

    Done :D

    ReplyDelete
  5. Hi VDamas,

    We are using Nagios Core 4.0.8 version & i want to put our company logo instead of Nagios logo & also i want to enable Tactical Overview as default. Can you please help me on this as well

    Thanks
    Partha

    ReplyDelete
  6. I have identified the cause & resolved it

    ReplyDelete
  7. hi,

    how i can set login and logout button in nagios core in different index.html/index.php file

    ReplyDelete