Wednesday 8 April 2009

Configuring a monitoring system

At work I am working on software where the administrator have the possibility to build models using building blocks. These models can be used to build invoices. The way this is done can be used in other projects as well.
In my network monitoring system it should be possible to easily configure the network layout.

Definitions

The first thing I am thinking about is to make definitions of the building blocks for our system. So we get a definition for host, service, command and probably some others as well.
So we will have something like the following layout:

It is no really useful to have the definitions when it is not possible to tell the user which definitions are available. This can be solved by creating classes for the definition types. All these classes do is holding a static instance of themselves, hold the name of the type and create a new definition of that type. Since the definition type can not be changed by anyone and we need it to create the real definitions, it is not necessary to construct them our self, that's why we use the singleton pattern here. Another advantage is that we can use this instance to show it to the user as well.

Using the definitions

We can now make a user interface to make it easy to create the definitions and configure them. Therefore we need some extra patterns. Let's say our user interface will look like this:
The buttons at the top are used to select the type of definition. When ever a type is selected a new definition will be created. We use a Factory method for this. (factory method: a method that has the logic to create an object) The created definition will be added to the listview with definitions.
The window on the right is a property grid, which can be used to change the properties of an object, so whenever one clicks on an item in the listview, the property grid will show the properties which can be changed.
At this point we don't add the definitions to the repository, because
we want to be able to cancel the changes we made. When we push the Save
button, we register all changes to the Repository and the data will be persisted.

Conclusion

Using this method it is pretty easy to configure a whole network. (Why didn't I think of it sooner...) Using this configuration is also pretty simple. But I will leave that for another post :)

No comments:

Post a Comment

Note: only a member of this blog may post a comment.