Creating your own AdministrationProvider

Introduction

As you might remember from one of our previous webcasts, we provide a set of pages that provide a number of useful administration and monitoring tools for Adam, such as clearing translation or watermark caches, enabling auto-translations or viewing statistics. This set of pages is handled by the Admin Handler.

What few of you will know is that this handler is also designed with the well known Adam Provider Model in mind. Therefore, you can plug-in your own handler in this page and add additional monitoring tools.

In this blog post, I'll create my own handler that checks the state of the different servers participating in my Adam server environment.

Prerequisites

The code presumes that you've created an XML setting called "AdamServerList" that contains a list of all servers you want to monitor. For this example, I've used the following value:

XML
1
2
3
4
5
6
7
8
<servers>
  <add name="ADAMS01" type="Database Server" />
  <add name="ADAMS02" type="Fileserver" />
  <add name="ADAMS03" type="Maintenance Server" />
  <add name="ADAMS04" type="Indexing Server" />
  <add name="ADAMS05" type="Web Server" />
  <add name="ADAMS06" type="Workflow Server" />
</servers>

The code

The only thing you'll need to do is create a class that inherits theĀ  Adam.Web.Administration.Providers.AdministrationProvider that can be found in the Adam.Web.dll.

To implement this abstract class, you will need to develop the following methods and properties:

  • CreateControlHierarchy: this is your hook to add controls to the page. In this method you can create a table, panel, ... basically any webcontrol and add it to the control hierarchy by calling this.Controls.Add().
  • GetMasterResetItems: this method needs to provide the calls that can be invoked when a user clicks the "Master Reset"-link in the Administration page. The calls that are chosen are then passed to the Reset method that can also be overridden.
  • Title: the title of the page
  • Description: the description that will be displayed below the title
  • VendorName: your name. This will also appear at the bottom of the provider page.
  • VendorUrl: the url to your website. This will appear at the bottom of the provider page.
Once implemented, you can plugin your provider by adding the following configuration section to the web.config file of your Adam site:

XML
1
2
3
4
5
6
7
8
9
10
11
12
13
<configSections>
  ...
  <section name="Adam.Web" type="Adam.Web.Configuration.AdamWebSection, Adam.Web" />
  ...
</configSections>
...
<Adam.Web>
  <administration>
    <providers>
      <add type="Monitoring.ServerStatusAdministrationHandler, Monitoring"/>
    </providers>
  </administration>
</Adam.Web>

The result

If everything is configured correctly, you should be able to navigate to the AdamAdmin.axd page and view a link to the new provider at the left hand side of the page. Clicking on it, will give you a view of the basic connectivity status of your Adam servers:


The full source code for this sample can be found at the bottom of this post.

Note

Please note that this code is simplified for purposes of example. In a production environment, you should add

  • additional code for checking input parameters of all methods
  • additional code for trapping all errors that can be generated by the ping command
  • an XSD Schema for the XML setting that contains the server list
  • ...

Using the ping command presumes that the network connecting the different servers allows sending the necessary ICMP packets. The ping command also doesn't tell you anything about health parameters of the servers such as disk space, memory consumption,...

That's it! Have fun with this! Looking forward to seeing your work!

Sample Code

The article contains sample code project(s).
You must be logged in to view or download sample code.
Sign in now

Comments

Leave a comment
You must be logged in to post comments.
Sign in now
 
 
CATEGORIES
AnnouncementsDocMaker StudioEngineSharePoint ConnectorWeb DevelopmentWebinarsWorkflow Studio
rss feed