Cool, looks good.  I'll take a look at the details later - have to run a put
out a customer fire.
Thanks for the links.  

- Mark

> -----Original Message-----
> From: Brent G. Ozar [mailto:brento@;brentozar.com] 
> Sent: Thursday, October 24, 2002 7:54 AM
> To: [EMAIL PROTECTED]
> Subject: [SA-list] Bar graphs for disk space
> 
> 
> OK, Mark, here's the full answer, assuming your web server 
> (that's serving up the SA report template) can handle 
> VBscript ASP.  You'll want to name the output file with an 
> .asp extension, like default.asp, so that the web server 
> knows to process the logic.
> 
> The objective here 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. How you do it is you use a 1-pixel wide 
> red gif, and a 1-pixel wide green gif, and you dynamically 
> size them to the right width to represent the numbers you 
> want. It's important to keep the total width equal for all 
> checks, so I'm doing 100 pixels wide total. If the check is 
> 74% good, you would see a 74-pixel wide green gif, and a 
> 26-pixel wide red gif. Pictures are worth a thousand words, 
> and you can see examples at: http://www.unifocus.com/salive/ 
> http://www.brentozar.com/salive/
> 
> Here's the code for the bar graph, and you would just put it 
> wherever you want the graph to show in your template.  (If 
> this doesn't make sense, I can send you my entire template.)
> 
> <%
> intStart = inStr(1,"<sa_prettyname>","{")
> intEnd = inStr(1,"<sa_prettyname>","}")
> If isNumeric("<sa_checkresponse>") then
>    intResponse = cdbl("<sa_checkresponse>")
> Else
>    intResponse = 0
> End If
> If intStart > 0 AND intEnd > 0 then 
>    intFullSize =
> cdbl(Mid("<sa_prettyname>",intStart+1,(intEnd-intStart-1)))
>    intGreen = Round(intResponse / intFullSize * 100,0)
>    intRed = 100 - intGreen
>    Response.Write("<img src=""red.gif"" height=""20"" 
> width=""" & intRed & """>")
>    Response.Write("<img src=""green.gif"" height=""20"" 
> width=""" & intGreen & """>") End If %>
> 
> In order to do the bar graph, you 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.  Make sure that you're writing out the full 
> number in the check, and not using abbreviations like "5 gb", 
> because that won't get you a number.  (If there's enough 
> demand, I can write code to extract the abbreviations into 
> full numbers.)
> 
> It'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 
> pretty name, like this: Oscar Free Space {5000000000}. Make 
> sure you put it inside those curly brackets, because that's 
> what our code looks for.
> 
> The code checks to make sure that both brackets are in the 
> pretty name (positions intStart and intEnd > 0), because 
> that's how we know to draw a bar graph for this check. Then, 
> it grabs the full size from between the brackets, compares 
> the full size to <sa_checkresponse>, and uses those 
> percentages to figure out the widths of the bar graph 
> (intGreen and intRed).
> 
> This will break if you have check responses that return 
> multi-line text answers, like a POP3 check to MS Exchange or 
> an FTP check to MS IIS. I've had to hide those checks on my 
> web pages in order for these bar graphs to work.  You have 
> problems because the asp code looks like this after SA does its work:
> 
> If isNumeric("Microsoft's Big Multi-Line Answer
> ") then
>    intResponse = cdbl("<sa_checkresponse>")
> 
> See how the first line wraps around?  That makes VBscript wig 
> out, because it doesn't like the unclosed quotes and parenthesis.
> 
> Any questions, let me know!
> Brent
> 
> 
> --------------------------------
> Brent Ozar - UniFocus
> --------------------------------
> "Don't wear rollerskates to a tug-of-war."
>        Larry Wall
> -----Original Message-----
> From: Mark Seniow [mailto:mseniow@;smsolutions.com] 
> Sent: Wednesday, October 23, 2002 3:36 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [SA-list] v4 request
> 
> OK, here's part of my wish list .... (unless it's already possible)
> 
> It would be nice to be able to evaluate simple mathematical 
> expressions in the html template files when generating the 
> html data file.  
> 
> When my colleague saw me monitoring diskspace he quickly 
> asked why I could not create a 'visual' representation of 
> %disk space used (or free) of total disk space.  Now you 
> could do this, I suppose, with two nested tables but you 
> would have to be able to calculate the percentage.  Or is 
> there an easier way of doing this?
> 
> Thanks.
> 
> 
> - Mark
> 
> Mark Seniow - [EMAIL PROTECTED]
> S.M. Internet Solutions Inc.
> Richmond Hill, ON     905-770-4481 
> 
> To unsubscribe from a list, send a mail message to 
> [EMAIL PROTECTED] With the following in the body of the message:
>    unsubscribe SAlive
> To unsubscribe from a list, send a mail message to 
> [EMAIL PROTECTED] With the following in the body of the message:
>    unsubscribe SAlive
> 
To unsubscribe from a list, send a mail message to [EMAIL PROTECTED]
With the following in the body of the message:
   unsubscribe SAlive

Reply via email to