Demo Webservice

A while ago I wrote a little PHP-application for demostrating webmonitors in System Center Operations Manager 2007.
It will probably work for any monitoring solution that catches http errorcodes or textstrings on a page.

Free to use, so give it a try. :-)

You can find it at: https://snowland.se/demo/


SCOM Demo script

OK, so I did some more research and scripting last evning…

Here is a script that puts out some random perfomance data between the parameters to the script.

In the perfomance mapper, set Value to $Data/Property[@Name='Perfdata']$, and don’t forget the parameters.

'-------------------------------------------------------------------------------------
' Script to write random perf-data
'
'                                         Rikard Rönnkvist / snowland.se / 2007-10-24
'-------------------------------------------------------------------------------------
' --- Set up variables and objects
Option Explicit
Dim iMinRnd, iMaxRnd, perfData
Dim oArgs, oAPI, oBag

' --- Get parameters
Set oArgs = WScript.Arguments
iMinRnd = Int(oArgs.Item(0))
iMaxRnd = Int(oArgs.Item(1))
Set oArgs = Nothing

' --- Generate random number
Randomize
perfData = Int((iMaxRnd - iMinRnd + 1) * Rnd + iMinRnd)

' --- Create properies in SCOM
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

oBag.AddValue "minValue", iMinRnd
oBag.AddValue "maxValue", iMaxRnd
oBag.AddValue "Perfdata", perfData
oAPI.AddItem(oBag)
oAPI.ReturnItems

Set oAPI = Nothing
Set oBag = Nothing

I did use “500 1000″ as a paramreter and got this nice demo-view of performance:
Demodata

Now, its time to play with alerts and baselining that data…


Demo web-app v2

Version 2 of demo-webb-app



i räknar från 0 till 250.

Om i är mer än <%= Application("rnd") %> så kommer det upp

en "felaktig" text…


<%

Randomize
if int(Application("rnd")) = 0 then
Application("rnd") = 150 + Int((100 – 1 + 1) * Rnd + 1)
end if

Application("i") = Int(Application("i")) + 1

Response.Write "i = " & Application("i") & "

"

if Application("i") < Application("rnd") then
Response.Write "Fungerar finfint"
else
Response.Write "Nu fungerar det INTE det minsta"
end if

if Application("i") = 250 then
Application("i") = 0
Application("rnd") = 150 + Int((100 – 1 + 1) * Rnd + 1)
end if

%>


Gives you a bit niceer health-report…

070509_WebHealth.jpg
(This one contains planed downtime …)


Demo web-app

Okej… nästan lite väl simpel, men den fungerar i alla fall.

Spara den som något bra med .asp i slutet (se till att ASP är igång på IIS’en också), sen kan man peka ut ett monitor-program (exempelvis OpsMgr) att monitorera den sidan. Om texten “INTE” är med så kan man skicka ett larm.




i räknar från 0 till 100.

Om i är mer än 75 så kommer det upp

en "felaktig" text…


<%
Application("i") = Int(Application("i")) + 1
Response.Write "i = " & Application("i") & "

"

if Application("i") < 75 then
Response.Write "Fungerar finfint"
else
Response.Write "Nu fungerar det INTE det minsta"
end if

if Application("i") = 101 then
Application("i") = 0
end if
%>