ServersAlive ASP Template: Bar Graphs for Drive Space & Ping Times

To use this template:

  1. Download the zip file and extract it.
  2. Copy the ASPbars.htm file into your ServersAlive directory.
  3. Copy the ServersAlive.css file and the gif files into your web server’s directory, like c:inetpubwwwroot.
  4. Set up the template output in ServersAlive. Your template setup screen should look like this.
  5. Set up the remarks in your checks for the fancy features….

Disk Space Remark

Setting Up Your Checks

For each disk space check you have in ServersAlive, put the total drive size in megabytes in curly brackets, in the Remark field. If you have a 72 gigabyte drive, you would enter “{72000}”. It doesn’t have to be exact – we just need a rough number to base the graphs on.

How It Works

On the ServersAlive mailing list, Mark Seniow asked if you could visually represent drive space on the status page. That set me to thinking, because I’ve done it before in ASP, so he and I cranked out the code to do it for ServersAlive. The objective is to end up with a red & green bar graph, where if you see a lot of red space, you’re looking at an impending problem.

First, a note about building bar graphs in ASP. The trick is to use a 1-pixel wide red gif, and a 1-pixel wide green gif, and dynamically size them to the right width to represent the numbers we want. If the check is 75% good (free drive space) and 25% bad (used drive space), you would see a 75-pixel wide green gif, and a 25-pixel wide red gif:

<img src=”red.gif” width=”25″ height=”20″>
<img src=”green.gif” width=”75″ height=”20″>

Pictures are worth a thousand words:

75% OK:

50% OK:

25% OK:

These all use the same 1×1 pixel red and green gifs, but just force the size to whatever width we want using ASP code.

So now we have to know at least 2 of the numbers involved: the good part, the bad part, and the total number. For drive space, that’s free space, used space, and total space. We can get free space easily by using the <sa_checkresponse> tag, which ServersAlive populates with the free bytes.

Disk Space RemarkIt’s a little tougher to get the used or total space. What we’re doing here is putting the total space in the check’s Remark, in megabytes inside curly brackets, like this screen shot which shows a 72 gigabyte drive with a remark of {72000}. Make sure you put it inside those curly brackets, because that’s what our code looks for.

More Server Monitoring Tips and Tricks

5 Responses to ServersAlive ASP Template: Bar Graphs for Drive Space & Ping Times
  1. Travis
    November 12, 2009 | 5:48 PM

    The link under step 4 is broken. Sure would be helpful to have it.

    Set up the template output in ServersAlive. Your template setup screen should look like this.

    • Brent Ozar
      November 12, 2009 | 6:23 PM

      Doh – sorry about that! It’s fixed now.

  2. Barry
    January 13, 2011 | 6:29 AM

    Hi Brent,

    The aspbars.zip is not linked in step one. Is it still available?

    Thanks!!!

    • Joe
      September 20, 2011 | 7:02 AM

      Hi @all,
      I searched all over but can’t find any download place for that told file. Are they still available?
      cheers Joe

  3. David
    December 7, 2011 | 6:45 AM

    Hi, I know this is old, but the link is broken. Just getting in to servers alive, and keen to have a much nicer status page. If there’s any templates and so on you have knocking around, please feel free to send them. Cheers
    David

Leave a Reply

Wanting to leave an <em>phasis on your comment?

Notify me of followup comments via e-mail. You can also subscribe without commenting.