NT Performance Monitor Customizable COM Alerter


Home Page: http://www.OrbitDevelopment.com

Environment: Windows NT Server and Workstation 4.0

Problem

Companies do not have NT Monitorig systems to be able to determine, and notify engineering, when an NT Server resource gradually degrades, or become non-existing. There are tools available to do so, but they can become quite expensive.

If you are tired of your current monitoring system, like a phone call at 3:00am from your boss saying, "The server is down!", this tool is for you.

Goal

Find an easy low cost solution to resolve the problem. The solution must be cheap and effective, at the same time very customizable.

Solution

NT currently includes "NT Performance Monitor" (PerfMon). PerfMon allows users to see performance graphs on certain NT resources. It also allows users to set "Alerts" for the same NT resources that you can graphically monitor.

Adding an "Alert" allows you to "Run a Program on Alert". This is the basis for our solution. I have created a program called "PerfMonitorAlerter.exe". When setting an alert, you would use PerfMonitorAlerter as the program to run on any alert you set, for example:

PerfMonitorAlerter "Memory is running over 90 megabytes"

PerfMonitorAlerter process uses COM objects to process the alert message specified in its parameter text: "Memory is running over 90 megabytes".

Technology

When PerfMon triggers the alert, it will start PerfMonitorAlerter.exe program with the message ("Memory is running over 90 megabytes") as it fisrt parameter.

PerfMonitorAlerter.exe will check registry path store at

       HKEY_LOCAL_MACHINE\\SOFTWARE\\www.OrbitDevelopment.com\\PerfMonitorAlerter


for any COM CLSIDs that implement a common interface, IAlertInterface:

    import "oaidl.idl";
    import "ocidl.idl";
	[
		object,
		uuid(B6C11879-3003-11D3-9257-00104BF7F161),
	
		helpstring("IAlertInterface Interface"),
		pointer_default(unique)
	]
	interface IAlertInterface : IUnknown
	{
		[helpstring("method EmergencyAlert")] HRESULT EmergencyAlert([in] BSTR bAlertName);
	};

In this code example case, PerfMonitorAlerter.exe will:

  • Create an instance of object "{B6C1187A-3003-11D3-9257-00104BF7F161}".
  • Query Interface IAlertInterface
  • Call method pIAlertInterface ->EmergencyAlert("Memory is running over 90 megabytes" )
  • Release the object

        : : : : : : : : : : : : 
        : : : : : : : : : : : : 
		
        // Registry COM Iterator

        while ( TRUE )    
        {
            char  szSubkey[ 64 ];
            DWORD cbSubkeySize = 64;
            CLSID clsidAlerter;
            BSTR  bstrCLSIDFromReg = NULL;

            if ( ERROR_NO_MORE_ITEMS == ::RegEnumKeyEx( regKey, regEnumIndex++, szSubkey, &cbSubkeySize, 0, 0, 0, 0 ) )            
                break;

            // Convert to BSTR, the convert it CLSID
            bstrCLSIDFromReg = charToBstr(szSubkey);
            ::CLSIDFromString(bstrCLSIDFromReg, &clsidAlerter); 
            if (bstrCLSIDFromReg) ::SysFreeString(bstrCLSIDFromReg);

            // Create object to notify
            if ( (bstrServiceName != NULL) && S_OK == ::CoCreateInstance( clsidAlerter, NULL, CLSCTX_INPROC_SERVER, IID_IAlertInterface, (void**) &pIAlertInterface )) 
            {
                // Send Alert
                pIAlertInterface->EmergencyAlert(bstrServiceName);
            }

            // Cleanup/Release the object
            if (pIAlertInterface) pIAlertInterface->Release();
        }

        : : : : : : : : : : : : 
This architecture will allow create one, or many, COM object to be notified, without concern for implementation details. The COM objects implementing IAlertInterface may send emails, log entries, call a pager, etc..

Although this is not the answer to all NT monitoring problems, it is an easy, customizable and powerful approach using COM communication technology.

Documentation Note

For detailed documentation (Word document), please feel free to contact me

Downloads

Download PerfMonitorAlerter application - 14 kb
Download source - 8 Kb


Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • As mobile devices have pushed their way into the enterprise, they have brought cloud apps along with them. This app explosion means account passwords are multiplying, which exposes corporate data and leads to help desk calls from frustrated users. This paper will discover how IT can improve user productivity, gain visibility and control over SaaS and mobile apps, and stop password sprawl. Download this white paper to learn: How you can leverage your existing AD to manage app access. Key capabilities to …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds