Automatically Refreshing the Perf View in the MOM console
spotted on: http://blogs.technet.com/momteam/archive/2005/07/03/407231.aspx Automatically Refreshing the Perf View in the MOM console
Quite a few customers have asked ‘Why doesn’t the performance view automatically refresh like the other views in the operator console?” This is a great question. There are basically two reasons for this:
1. The performance view takes quite a bit of processing power on the database to generate. Having the performance view open and refreshing every 30 seconds (default view refresh rate) would be a pretty heavy load on the database.
2. More important – MOM only collects a performance counter sample every 15 minutes or so for each performance counter. The frequency depends on the rule but most of the rules shipped in the Management Packs for Microsoft products sample every 15 minutes. So – if you had the performance view open looking at CPU utilization on a particular computer. It would refresh every 30 seconds but the view would remain unchanged for 15 minutes until you had a new sample come into the database.
For those, reasons we disabled the automatic view refresh in the MOM 2005 operator console. However, there are definitely some scenarios where you do want to have automatic refresh. You may collect performance samples frequently enough for a particular counter that it would make sense to automatically refresh the view. Or, you may want to project some statistics on a large screen in your data center.
Whatever the case, people have asked me how to do it. You can’t do it using the console itself. But you can use a send key script to refresh the console “automatically” by simulating pushing F5 (“Refresh”).
Here is a basic example of the script:
Set WshShell = WScript.CreateObject(“WScript.Shell”)
Do While 1=1
WScript.Sleep 5000
WshShell.SendKeys “{F5}”
Loop
Explanation of code:
Do While 1=1 sets up an infinite loop. This loop will run until you terminate the process. WScript.Sleep is a pause command. It will pause for 5000 milliseconds (5 seconds). You can change this number to whatever interval you want. The SendKeys method will send whatever key stroke combination you want. For a full list of commands you can send see the SendKeys Method section of the MSDN library.
To use this code do the following:
1) Open Notepad
2) Copy the code into the notepad window
3) Save the file as ‘Refresh.vbs’ on your desktop or somewhere else
4) Launch the operator console and navigate to the performance view that you want to automatically refresh
5) Execute the Refresh.vbs file
6) Make the MOM console the active window
This will only work for situations where you are not actually using the computer because it will send a F5 keystroke to whatever the active window is. To stop the script you need to open Task Manager and select the wscript.exe process and click the End Process button.
If you want to make the script a little more sophisticated and cycle through a bunch of Windows you can make a script like this:
Set WshShell = WScript.CreateObject(“WScript.Shell”)
Do While 1=1
WScript.Sleep 5000
WshShell.SendKeys “%{TAB 3}”
WScript.Sleep 500
WshShell.SendKeys “{F5}”
Loop
Replace the number after ‘TAB’ with the number of windows you want to cycle between minus one.
Another frequent question I get is how to refresh the web console. The web console does not refresh automatically by default. Fortunately, it is trivial to make it refresh automatically.
Add the following code to the default.aspx page inside the <Head> tags:
<Head>
<meta HTTP-EQUIV=”Refresh” CONTENT=”360″ />
</Head>