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

  • Learn How A Global Entertainment Company Saw a 448% ROI Every business today uses software to manage systems, deliver products, and empower employees to do their jobs. But software inevitably breaks, and when it does, businesses lose money -- in the form of dissatisfied customers, missed SLAs or lost productivity. PagerDuty, an operations performance platform, solves this problem by helping operations engineers and developers more effectively manage and resolve incidents across a company's global operations. …

  • Live Event Date: December 18, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT The Internet of Things (IoT) incorporates physical devices into business processes using predictive analytics. While it relies heavily on existing Internet technologies, it differs by including physical devices, specialized protocols, physical analytics, and a unique partner network. To capture the real business value of IoT, the industry must move beyond customized projects to general patterns and platforms. Check out this upcoming webcast …

Most Popular Programming Stories

More for Developers

RSS Feeds