For this example I am going to create an alert that will fire if notepad.exe is using more than 1.2 Mb of memory. Please Note: if you are testing this pack you will need to open notepad before importing this rule – if OpsMgr cannot resolve the performance counter at the time of the workflow initialization the workflow will be unloaded. The reason for choosing notepad is simple, it ships with every version of windows and we can easily change the amount of memory that it uses by opening a big text file.
Under general give the rule a name, description and target it at the Microsoft.Windows.Server.Computerlass (or any other class that you want).
Click on the Modules Tab and create a new data source.
Select the System.Performance.DataProvider module, give it an ID and click OK.
Under the Data Source Module section select the module you just added and click Edit, on the screen that appears click Configure in the bottom left corner. The performance counter selection wizard appears. Select your counter (in this case its Process \ Working Set \ notepad). Use the picker below to choose the frequency to run this alert, finally click OK twice to return to the Modules Tab.
Now that we have our counter, the next thing we need to do is decide if an alert should be generated. Since the counter could potentially be below our threshold we will need to compare the value to decide if an alert should be created. In order to do this we will need to add a Condition Detection module to our alert, under the Condition Detection section click Create.
Select the System.Performance.SimpleThresholdCondition module and click OK.
Once added, click the Edit button for the new module. There is no configuring wizard so you will have to either edit the module through notepad or use the dialog box on screen. As you can see there are 2 options that can be changed, they are Threshold and Operator these are pretty self-explanatory so I am going to go ahead and enter in 1258291 and Greater respectively.
Click OK twice to close the current window and return to the Modules Tab.
Once complete your alerts screen should look something like this.
Click OK twice to get back to the Modules Tab.
Right, let’s test this rule.
This means that the rule is working. I close notepad and wait for 5 min to see if I get any more alerts coming through (to ensure that the logic is working correctly). As mentioned earlier if I the performance counter cannot be found the workflow will be unloaded from the OpsMgr agent. Like clockwork 1 min later I get the following alert in the agents event log.
Log Name: Operations Manager
Source: Health Service Modules
Date: 12/15/2010 11:24:38 AM
Event ID: 10103
Task Category: None
Level: Warning
Keywords: Classic
User: N/A
Computer: SQL.home.net
Description:
In PerfDataSource, could not find counter Process, Working Set, notepad in Snapshot. Unable to submit Performance
value. Module will not be unloaded.
One or more workflows were affected by this.
Workflow name: CustomAlerts.AlertOnNotepadMemoryUsage
Instance name: SQL.home.net
Instance ID: {1A5EB665-A107-EEC5-7394-60D9B5EF8882}
Management group: HOME
Event Xml:
CustomAlerts.AlertOnNotepadMemoryUsage
SQL.home.net
{1A5EB665-A107-EEC5-7394-60D9B5EF8882}
Process
Working Set
notepad
Comparing the 2 alerts side by side I see that the memory usage reflects that the 500kb file has been opened.
That’s all there is to creating a custom alert in OpsMgr based on the memory usage of an application. Although this particular example will not be useful in production, this example should enable you to create an alert of any performance data easily.
what is the unit of value in threshhold? Is it bytes or kb? what value shoudl i use if i want to monitor process consuming 85 MB?
ReplyDeleteI just could not depart your web site before suggesting that I really loved the usual
ReplyDeleteinformation a person provide on your visitors? Is gonna be again continuously
in order to inspect new posts
Feel free to surf to my web page Click This Link
The pictures aren't showing up, can you fix it?
ReplyDelete