IT Management: Dipping into the Platform with C#
Every action you take when using technology can be thought of as a type of management. This applies for reading, writing, deleting, and forwarding email; backing up and restoring files; and so on. There are as many management actions as there are user interactions. One of the main goals of IT and network management is automation. By automating management actions, you reduce the need for human input and potentially reduce the scope for error. Automated actions typically get done more quickly and more cheaply than those involving humans. That’s the theory, anyway!
Organizations typically have adopted a divide-and-conquer approach to management, often using a multitude of software and systems. This strategy has tended to lead to the notion that automated management is a complex discipline requiring the services of highly skilled individuals.
You only have to look at the telecom industry to see the consequences of such a fragmented approach to management. In this industry, management software traditionally is added at the end of the product development cycle. Vendors generally use proprietary (or semi-proprietary) mechanisms as part of their management software. Then, when the end user tries to put the various packages together to form a solution, it becomes very difficult (if possible at all) to get an end-to-end view. Operational management becomes a laborious process of dipping into numerous management packages—one for each vendor.
Some progress has come in the form of standards such as Java Management Extensions (JMX) and Web Services Distributed Management (WSDM), and open source offerings such as MC4J. Even these technologies are difficult to install and use.
But it’s not all doom and gloom! Management technology is conceptually simple, and I’m using this series of articles to illustrate this principle.
Before you can attempt to automate any part of IT management, of course, the management system needs to know what elements lie within its scope. This discovery process is often an enormous task, in view of the massive proliferation of computing elements in modern business. What I want to look at in this article is a really simple idea—using C# code to dip into a given machine and pull out such important data. Along the way, you’ll learn how computers see the world a little differently from us.
Getting Started
As with my previous several C# articles, I continue to use the wonderful open source SharpDevelop integrated development environment (IDE) product. SharpDevelop is an unusual product in that ticks most of the boxes for what I consider excellent software:
- It’s easy to install.
- You can produce working software minutes after installation.
- It shields the user from huge swaths of complexity.
- The help system is comprehensive (sometimes too comprehensive).
These requirements aren’t just for fun or that I can’t be bothered to invest time in software tools. The growing emphasis on cost-cutting in IT and software development means that we all have to strive to become increasingly nimble—it’s no longer enough just to be a good developer. You have to be able to produce software quickly that works and is flexible, extensible, and resource-friendly. Tools such as SharpDevelop help in achieving these moving targets.
All the code for this article is available as a complete SharpDevelop project. You can just run the program by double-clicking the executable, or you can build it yourself, whichever you like. For this article, I’ll also discuss a few more features of SharpDevelop, to help you to round out your knowledge of this excellent product.
As usual, Listing 1 shows a sneak preview of the finished C# code, where I do the following:
- Create an object that acquires some platform data.
- Dump the platform data to standard output.
- Wait for user input before ending the program.
Listing 1 An excerpt from the finished C# code.
class MainClass { public static void Main(string[] args) { DumpPlatformData dumpPlatformData = new DumpPlatformData(); dumpPlatformData.DumpData(); Console.ReadLine(); } }
The platform referred to is my trusty Windows XP PC!
I also want to show you how to come to grips with the SharpDevelop debugger, an essential tool in the programmer’s toolkit.