In this video Chris Pels will show how to implement health monitoring to get detailed run-time information for an ASP.NET application. Learn the powerful and flexible configuration options for health monitoring including health monitoring events, aka web events, providers for storing data, rules for mapping events to providers, profiles for commonly used settings, and buffermode to optimize health monitoring for best performance. Then see a sample web application in action with health monitoring enabled writing events to the Windows event log.
The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video
Minute 0
Tie this Chris tells in his video would you learn how to implement ASP net health monitoring health monitoring is where ASP net raises what are called Web health monitoring events also noticeable at events at various times during the course of an ASP net application these of events range from things like problems with the inbound requests the security failures problems with view state or general webpage of an error is when these events are raised by ASP net then there are Oracle providers which listen for the events and then take the information associated with the event and recorded them out to a specific source such as a database and log file or the Windows event log such it started recruiting new website where will implement some health monitoring A
Minute 1
based ethernet website and let s call this website VB and we ll put it in a DB sample code folder list is sorted by configuring health monitoring which is done in the web config file to open that up and the health monitoring is done in a section under system Web which is cold and health monitoring in the first element inside of health monitoring their with a look at it is called the event mappings in UAE health lottery system works is when is the dead net loser beats the web config file and makes a list of all of the event mappings that are in place and then when a Web event or a health monitoring event occurs during the course of days today that application refers to the event mappings here and health monitoring element and if there is a mapping then
Minute 2
He would call the associate provider for that event and recorded as the first threat to do here in the event mappings is to indicate which of the standard is taken at health monitoring events we want map tour used in the application and as I said there s a number of standard events and to help you out in the sample code when you download and take a look at where minute do is paste here in the web config file a comment that lists all of the standard health monitoring events in religious format that a little bit when we just indent this a little so it s a little more readable than it looks as though better you can find this information in on MSDN or in the help file but it s outpacing it would help you for a quick reference for at sample code and you can see there is quite a range of events in the monitors here in the health
Minute 3
Frank system everything from standard Web failures here are related to security to a offense related to a syndication as well as I recall that the application lifetime event such as starting and stopping the application to set a world in a given event mappings element is to nap friendly names to some of the standard Web event classes by default there is onto the net are configured in a topic of the documentation leading pace than in here about the event mappings element so you ll have them to refer to in your sample code so for all the standard events were not required to add mappings have been batting subelements but if we work at one of me copy and paste one in from the documentation as well seek see what one would look like silly hats here for
Minute 4
Each is there nothing that we do is see a friendly name rituals where we use them in just a moment the fully qualified type for the correspondent will event in this case the web application lifetime event and I should mention that all of these are in the system Web management namespace that we have both the start and the ending range for the potential of bank codes associated with this event swear these event mappings become particularly useful outside of the standard events that are implemented or event mappings or implement it by default or when you create a custom health monitoring event which is the subject of a related video senatorial are look at it for the event mappings element is the provider s element and the providers are what we might call the listeners
Minute 5
For the events they listen for particular events and then write them out to a particular source such as the Windows log file database etc not get default event mappings we also have several default providers are automatically configured in net framework 2 0 have copied them from the documentation money pays him is as a comment about the provider s element so you can see what they are and their three of them one is the provider that writes to the event log
Minute 6
Are for the different providers Sophie wanted to change the value of one of the attributes of these default providers or add an additional provider is one of the provider classes that comes with the net framework for example Thursday SMTP mail provider which will route information on health monitoring events to an e mail address that can be very useful than if we wanted one of those or even if we had created a custom health monitoring provider we ve need to add it to the provider elements here such a show you how you would do that let s just take this SQL event provider and we ll pasted down into the provider section and let s say that our connection string name we have called SQL health monitoring and also if this is the only provider that we want more we would meet
Minute 7
Do is to put a clear element here as well and unique but that before we add the new one because obviously if it was after the edit would clear up what we have just added to know we have events defined in the event mappings element and we have providers or listeners defined in a providers element so the next thing that we need to to find here is the rules and the rules are what map the event to the particular providers slightly so with the providers in the event mappings are several or I should say to rules that are defined by default in net framework 2 0 I copied them from the documentation and let me pace than he and here is a comment so you can see that they are notorious for the kiss of the detail the rules and ribs is one more set of information I wanted to put here in the web config file for you in the sample code in
Minute 8
To do with the providers equipped here in above the providers I is that the default providers and what one putting here are a list of the built in providers that are available in the net framework 2 0 so there we go we had the event log provider would talk about the sequel there is it that you and my mail provider and a trace provider and you can look up the details on how each of those works in page 1 implement them such the back down to the rules section now and take a look at what this has put a city schools does is it maps to a particular event by the friendly name for example of the event name all areas comes from up here where we did the event mappings and all events are on site all eras is the web based vendor and is defined as the default event mapping and then the other at main aspect of the rule
Minute 9
Is where it maps to a particular provider using a providers friendly name in this case event log provider and that was created up here and as we saw the event log provider is one of the default providers that comes with the framework so down here in the rule and not the event is a provider and then you have something called a profile which is set to default in this case will come back and look at what that is in just a minute and then there s a very important attributes that are set for each of the rule in the first attitude I will look at his cold minimum instances are many instances in this case it s set to one and what named instances is it indicates the minimum number of instances of the event before the provider is notified soon as cases in this one instance of the event occurs if the corresponding provider would be notified and end
Minute 10
Axa Ltd is the upper limit in terms of how many maximum number of times a provider would be notified for a particular event and in this case it is said to infinite meaning that it would continue to provide event notifications matter how many times the event occurred in the third XView do want to point out is called an integral and this is the minimum interval of time between when between two health monitoring events of that means is that the creator of this value the longer appeared of time before the health monitoring system reports that a particular event occurs and this can have an impact on performance because if you set this value very low to a very short period of time than you can have a tremendous benefit activity on particular health monitoring events potentially that would tie up
Minute 11
System resources and since this is intended to be used at least in one situation as a live monitoring system on and happen up and running application then you want to try to think about her you said some of these attributes a unified minimize the potential effect on performance the application written in the custom attribute is something that is used to find you can set that whatever value you want if you are sort particular piece of information with a particular rule say can see of this works let s quit for rules and assisted by default it to rules above are set so let s clear all the rules out and then let s go up at in one of these default rules but will change some of some of the parameters to copy the old air is the fault will pay set in and now let s see what vinegar down and say that it have to be that these 10
Minute 12
Instances before an event at a health monitoring event is sent to the provider and let s say it has to be a let s consider the value of one must make the minimum interval for some of the other things to point out appear is in these two default rules one thing that s happening you should see that both of them are being mapped to the event log provider so you can add multiple events to the same provider you can also map one event to multiple providers so for example down here in the all arrows we could map that not only to the event log provider but we could map it to the SQL provider as well connected on over to look at for configuration is called profiles let s go ahead and add one of those elements here in our web config and what profiles do as the name in
Minute 13
Eyes as it sets up a profile that can define the specifics of a rule so you don t have to specify that individual information every time you add a particular rule and then you can just change than one place that would automatically be reflected in each of the rules let s go ahead and add a new profile and will call this default and the parameters or attributes that we can put into a profile or essentially these three attributes up here so we can do is on a copy and paste those down in poor profile and then I can remove them from the rule and now the rule has the same parameters minimum instances max limit and minimum interval that it had before been so we could have multiple rules defined up here each using the default probe
Minute 14
File that if we went down here and change the minimum number of instances let s say to fly that would automatically be applied to all the rules that are using the profile to get set up multiple profiles down here that reflect the common parameters that you use in your rules and then apply them accordingly when you define a rules in the last element that we have to look at for configuring health monitoring is called buffer modes and what promotes does the success of various parameters related to offering with the provider if we looked up here at the provider element which we d did a few minutes ago as it is a buffer mode attribute here and it s set to notification currently the buffering is false for this provider if the buffer attribute is set to Q then you must have a proper mode attribute which specifies the mode of buffering
Minute 15
For that provider lets take a look at how this notification buffer mode is set up in what the various settings are that you can do down here in the proper mode element like we saw with several of the other elements there is some predefined buffer modes that come out of the box so to speak and I ve gotten them from the documentation on MSDN and Lenny Payson and hereabouts up both the bar for both elements seek and see what they are such may recall this moment only looked at the provider up above it had a bar for mode called notification and here is that a promoted to close at the edit so you wouldn t have to add it again but if you wanted to change some of the attributes of the notification buffer mode you would have to remove it or clear the buffer modes altogether and then at this notification buffer mode and change whatever parameters you wanted to close the ahead and take the notification buffer mode
Minute 16
And will copy and pasted down here into the about promotes attribute and change a few parameters and see how this works and the first thing we wanted to do is we want to remove name equals notification because otherwise he would give us an era that it s already at it so will remove the current one the default one and organa change some of the parameters such quickly go through the attributes that are available in a buffer mode in this case notification the first one is Max buffer size sets the maximum number of events that can be buffered
Minute 17
Or so for example the regular flush interval attribute says he now flushed events from buffer at this regular interval and let s make that five whereas we have also these two attributes which pertain to urgent flushed thresholds and what prices should say urgent flushes of the buffer and what this means is that whenever the buffer size gets to this threshold it s considered urgent and then the buffer must be flushed at the corresponding urgent flush interval lets say when every gets to five that would be considered an urgent threshold and then we would flush the buffer every one minute guarantor of our compared to five in the regular interval in the last that beauty is the number of says a nice luscious event maximum number of threads that can be used for the
Minute 18
Flushing process sets keep uppermost element which has is that essentially allows you to set up some parameters that buffer the health monitoring events in memory and then controls windows are flushed out to the corresponding providers and this can help in performance in the health monitoring system so the last thing that we need to look at is back up in the root element health monitoring and in health monitoring door a couple attributes that you can sit here one important one is enabled and as it applies this either turns on or turns off health monitoring symbol tarted on and the next act attribute we want to look at is called heartbeat interval and this is a time interval in seconds so for example if we put a set of five here that would mean
Minute 19
That he was called the Web heartbeat event which is down here he is in line 3200 precinct on about the different types of built in events and what this does not appear in this attribute is if we set this to five minutes for what happens every five minutes this Web heartbeat event would be automatically fired by the health monitoring system and it contains are range of information about the current functioning of your ASP net application so if you don t put this attribute in the health monitoring element within the heartbeat is not fired automatically at any predefined intervals if you want it to be fired at giving an indication of what s going on in the overall application at a regular interval than you would need to put this at the end one more quick last correction I realized is that the heartbeat interval is just in seconds I was thinking that it will
Minute 20
Minute 21
But I did is set up a rule called the heartbeat default it s back to the heartbeats event up above and a race to the Windows event log and I set the profile equal to critical which can see down here is one of the default profiles and that will essentially read out the event every time it s fired Swiss go ahead in sort of the website and we ll get our default aspx page which is to settle just be a blank page now all that s running they are let me flip over to the event log for the ash and will look at the application event log on me at the refresh button here and you see that were getting these Web offense every 10 seconds that the application is running the last one years at 1345 and let me refresh you can now have another one years or
Minute 22
Team 4559 and so on so these are showing up in our event log based upon the health monitoring system being configured and every flip back over to Visual Studio lets shut down the webpage and it s very quickly review the different sections that we ve covered here in this video first is we look at these as standard events that come with the health monitoring system of us that here in the web config file in the sample code and then we looked at a event mapping essentially how you add an event in this case for adding and removing anyone a standard events just to show you how it works then next we look at the different providers remember providers are classes that write out the event information to the specific source and out of the box you have several length event log which we just saw with heartbeat and then you have a sequel
Minute 23
That UMI mail and trace providers next we had down your rules rules essentially connect the event to a specific provider using a specified profile now we could have put the specific criteria in the rule puts profile abstracts that out and down here we have altered the default profile and assisted other boxers to profiles the fault and critical and then the last thing we look at is buffer mode switch control the offering of event information to help performance so this is an extremely powerful system that allows you to configure all kinds of information to monitoring the health of a live application and encourage you to download the sample source code take a look at it in more detail as well as refer to the MSDN
Minute 24
Temptation to get a better idea of the details of how you can implement health monitoring for your own system this is Chris Pelz thanks for watching this video on implementing health monitoring in an ASP net application
Click here to go to original video page
Sunday, August 31, 2008
Video: How Do I: Implement Health Monitoring for an ASP.NET Application?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment