Loading...
 

Greg`s Tech blog

A better nagios interface

Tuesday 03 of March, 2009
I'm always hacking at something. Today I turned my 3.0.3 Nagios interface into something more exciting. I converted it to the Nuvola style (cache) which I think looks great. Especially compared to the plain and aged Nagios interface.

While playing with the interface, I had the idea of adding a countdown timer until page refresh so I went looking for a way to do it.

First I found a javascript timer at hashemian.com (cache) (thanks Robert). I copied the countdown.js file to the root of my web server to save him bandwidth.

Nagios will include customer header or footer files if you create them in the right place and name them correctly. I created a file called status-footer.ssi in the nagios/ssi directory. The contents of the file are as follows:

<script language="JavaScript">
TargetDate = new Date();
TargetDate.setSeconds(TargetDate.getSeconds() + 90);

BackColor = "ltgray";
ForeColor = "dkgray";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "Status refresh in: %%M%% minute %%S%% seconds.";
FinishMessage = " Refresh!";
</script>
<div class='countdown'>
<script language="JavaScript" src="/countdown.js"></script>
</div>
</BODY>
</HTML>

This code is a modified version of what Robert posted to his blog. The first two lines set the countdown time to now plus 90 seconds which is the default refresh time for the pages.

I then