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

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • The proliferation of cloud computing options has begun to change the way storage is thought about, procured, and used. IT managers and departments need to think through how cloud options might fit into and complement their onsite data infrastructures. This white paper explains cloud storage and backup, providing advice about the tools and best practices for its implementation and use. Read this white paper for some useful takeaways about how to take advantage of cloud storage for high availability, backup and …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds