9.2.3 Using Dynamic HTML Pages

 


9.2.3.1 What are Dynamic HTML Pages?

9.2.3.2 Using Dynamic HTML Pages To View MBean Attributes

9.2.3.3 Performing Operations on MBeans

9.2.3.4 Customizing Dynamic HTML Pages

9.2.3.5 Restricting MBeans in a View

9.2.3.6 Registering MBeans at Run Time

9.2.3.7 Deregistering MBeans at Run Time


 

9.2.3.1 What are Dynamic HTML Pages?

 

The HTML Adaptor exposes agent information in the form of dynamic HTML pages. In the dynamic mode, the HTML adaptor collects the MBean information and generates the HTML page dynamically as and when a request is received. These pages are generated at run time by the HTML Adaptor using the Jmx_dynamic servlet.

 

9.2.3.2 Using Dynamic HTML Pages To View MBean Attributes

 

Information regarding all the MBeans registered with the MBean server of the Multi-Protocol agent can be viewed through the Dynamic HTML pages. Follow the steps below to view the MBean attributes:

  1. Ensure the agent is running at the required port.

  2. Enter the URL http://<agentHost>:<portnumber>/Jmx_dynamic in the HTML browser (use https if SSL is enabled).

  3. MBeans are grouped under different domains. Select a Domain name. MBeans in the selected domain are listed in a separate page.

  4. Select the MBean whose attribute you want to view.

In the URL agentHost denotes the machine where the agent is running. In case the query is being made from the same machine where the agent is running, localhost can be used as the machine name. Portnumber denotes the port at which the HTML Adaptor

is started. A sample URL: http://localhost:8030/Jmx_dynamic. If SSL support is enabled for the agent, then the URL to be used is : https://<agentHost>:<portnumber>. For more information regarding SSL, please refer to the topic "Using SSL for communication

through HTML Adaptor".

 

For a scalar MBean, the attributes of the selected MBean are listed in table format with the following information: Attribute name, Attribute type, Attribute access, Attribute value, and Description. Values of Read-Write attributes are presented in editable text field. Inorder to modify these values edit the values and press the Save Values button.

 

Attributes of tabular data type are displayed as a table format. New rows can be added using the New Row button at the bottom of the page. The Delete Row button can be used to delete a row from the table. To delete a row you must first select the row and then press the Delete Row   Modifications can be done by selecting the corresponding row, changing the values in the editable text box and pressing the Save Values button.

 

In case the attribute value is of type array, then a link is provided in the attribute value column and on clicking the link the values are listed in a separate page.

 

9.2.3.3 Performing Operations on MBeans

 

In addition to viewing MBean attributes, the Dynamic HTML pages also allow you to perform operations on MBeans. If operations can be performed on an MBean, then the Operations button is displayed at the right-top corner of the the MBean attribute page.

 

Pressing this button, presents a page with the list of operations. Selecting an operations hyperlink displays the following information pertaining to the MBean operation:  

 

You can perform an operation by pressing this button. Apart from these, SET operations are provided with text fields to specify the attribute values.

 

9.2.3.4 Customizing Dynamic HTML pages

 

The dynamic HTML pages are generated at run time by the HTML adaptor. The properties corresponding to these pages are read from the configuration file for each user HtmlAdaptor.<username> present in the <projectdir>/agent/bin/conf directory.

 

A new configuration file is created for each user when the user logs out at the end of the first session. This file is a copy of the default HtmlAdaptor.prp file present in the <Agent Toolkit Home>/conf directory. You can customize the Dynamic HTML pages either from the HTML client or by directly editing the configuration file.

 

9.2.3.4.1 From HTML Client (web browser)

 

Follow the steps given below to customize the dynamic HTML page from the HTML console:

  1. Ensure the agent is running at the required port.

  2. Enter the URL http://<agentHost>:<portnumber>/Jmx_dynamic in the HTML browser.

  3. In the HTML Browser Main Page select the Options link under the Home section.

  4. Select Page Properties link from the page displayed.

  5. A page with all the options is displayed. Configure the options by changing the default values.

  6. Press the Save Values button at the bottom of the page.

These values are updated in the user's configuration file when he logs out at the end of the session. A list of properties and description about each property is also given below:

 

Property

Description

isJavaScript *

This property allows you to enable or disable support for javascript. If this property is set "true", the alert box displaying the description will be enabled. This alert box is displayed only when the limitRestrict and maxDispChar are enabled.

limitRestrictFlag *

This property specifies whether the attribute descriptions displayed need to be restricted to the number of characters specified by maxDispChar. This will respond only when the isJavaScript property is also enabled.

maxDispChar *

This property specifies the maximum number of characters of the description message that should be displayed. When the description message is longer than the specified number of characters, the message display is restricted to the maxDispChar and a link is provided at the end. Clicking this link, an alert box containing the full message appears.  

Note: Both isJavaScript and limitRestrictFlag properties must also be enabled.

mailTo

This specifies the e-mail address to which mail has to be addressed when the Contact link is pressed.

isOperationsLink

Needed

This property when set "true" displays an Operations button at the top-right corner of the page if there are any operations related to the MBean. Pressing this button displays the operations related to the MBean.

indexfile

It specifies the name of the html file displayed as main page. Instead of the default dynamic_index.html file, you can use your own html file as the Index/main page. In that case you must specify the html file name in this option.

refreshtime

It specifies the time interval at which the Html Page is refreshed.  The default value is 60 sec. Changes will be reflected for all the html pages that have the meta tag: <meta HTTP-EQUIV="refresh" content= "60;URL=****">

servletname

It specifies the the java class filename which is used as a servlet to process the requests. The default is Jmx_dynamic.class. If you want your own java class file to be used as a servlet specify the filename here. The class file must be present in the class path of the agent.

Note: The new servlet specified must have the same functionality as the Jmx_dynamic servlet.

author

Specifies the Author name for the HTML pages. It is reflected only for those files that have the meta tag:<meta name="Author" content="JMX Agent"> The content value will be replaced by the new value specified.

isTextDecoration

If this property is set "true", all links in HTML pages will appear underlined. By default this is set "false".

bgcolor

Specifies the background color for the HTML pages. In case a background image is present, it will override the background color. The color can be specified in two formats:

1. The hexadecimal format #XXXXXX, where X is a valid hexadecimal number (0-9, A-F).

2. The name of the color (e.g. Blue, white).

bgimage

It specifies the image to be used as background image. The location of the image can be specified in two ways:

1. Relative to the working directory. <projectdir>/agent/bin/ssi is taken as the working directory.

2. The absolute path can be given if the image is not within the project directory.

vlinkColor

Color of links that have been visited.

alinkColor

Color of the links while being clicked.

tableHeaderColor *

Specifies the header color for all the tables.

tableRowColor *

Specifies the color to be used for all the rows in tables.

tabIndexColor *

Specifies the color with which the values in the index column of a table are displayed.

numrows *

Specifies the maximum number of rows to be displayed in a single page for a table. Default value is 10.

fontColor

Specifies the color of the font displayed. This can be specified either in Hexadecimal format or using the name of the color.

fontFace

This specifies the font style/ face.

fontSize

This specifies the size of the font displayed.

copyrightneeded

It specifies whether the footer message should be displayed at the end of the page. This is reflected in all the HTML pages.

footermsg

This specifies the message that appears at the end of the page. This message will be displayed only if the copyrightneeded property is set "true".

 

9.2.3.4.2 Using Configuration file

 

In case you want to change the default values, you can directly edit the default configuration file HtmlAdaptor.prp before starting the agent. Each user can also customize the dynamic HTML pages by editing their corresponding configuration files

HtmlAdaptor.<username>. The default property file present in the <projectdir>/agent/bin/conf directory is given below:

 

<HtmlAdaptorSettings>

<GeneralSettings name="isJavaScript" value="true" />

<GeneralSettings name="limitRestrictFlag" value="true" />

<GeneralSettings name="maxDispChar" value="30" />

<GeneralSettings name="mailTo" value="agent-support@webnms.com" />

<GeneralSettings name="isOperationsLinkNeeded" value="true" />

<GeneralSettings name="indexfile" value="dynamic_index.html" />

<GeneralSettings name="refreshtime" value="60" />

<GeneralSettings name="servletname" value="Jmx_dynamic" />

<GeneralSettings name="author" value="Multi-Protocol agent" />

<GeneralSettings name="isTextDecoration" value="false" />

<GeneralSettings name="bgcolor" value="#FFFFFF" />

<GeneralSettings name="bgimage" value="null" />

<GeneralSettings name="vlinkColor" value="#0000FF" />

<GeneralSettings name="alinkColor" value="#0000FF" />

<GeneralSettings name="linkColor" value="#0000FF" />

<GeneralSettings name="tableHeaderColor" value="#C0C0C0" />

<GeneralSettings name="tableRowColor" value="#E0E0E0" />

<GeneralSettings name="tabIndexColor" value="#0000FF" />

<GeneralSettings name="numrows" value="10" />

<GeneralSettings name="fontColor" value="#000000" />

<GeneralSettings name="fontFace" value="Arial, Helvetica" />

<GeneralSettings name="fontSize" value="3" />

<GeneralSettings name="copyrightneeded" value="true" />

<GeneralSettings name="footermsg" value="Copyright (c)1996-2002 AdventNet,Inc. All

Rights Reserved. " />

<TableHeaders>

<Attribute name="name" value="Attribute Name" />

<Attribute name="type" value="Attribute Type" />

<Attribute name="access" value="Attribute Access" />

<Attribute name="value" value="Attribute Value" />

<Attribute name="description" value="Attribute Description" />

</TableHeaders>

</HtmlAdaptorSettings>

 

9.2.3.5 Restricting MBeans in a View

 

The HTML Adaptor exposes all the MBeans registered with the MBean server. If the number of MBeans is very large, you may want to view only a selected number of MBeans. To restrict the MBeans that are viewed by a user, different Customized Views can be created. Follow the steps given below to create a Customized view:

  1. In the HTML Browser Main Page select the Options link under the Home section.

  2. Select Customize Views link from the page displayed.

  3. Select Create View option, the corresponding CreateNewView page is displayed.

  4. Specify a unique View Name. The view name may contain any character except plus sign (+) and quotes(").

  5. Select the domains you want to include in the view.

  6. Press the ListMBeans button.

  7. Select the MBeans to include in the view. At least one MBean must be selected otherwise an error message is displayed.

  8. Press the Save View button.

A new section called Customize is created in the HTML Browser main page and the view that you created is displayed in this section. Any number of views can be created by following the same procedure.

 

Note:  A valid view name must be specified otherwise an error message is displayed and the view is not created. If an already existing view name is specified while creating a view, the previous view settings are replaced by the new settings. All the customized views are lost once the agent is re-started.

 

9.2.3.6 Registering MBeans at Run Time

 

Dynamic HTML pages also allow you to create and register MBeans at agent run time.  This feature can be used to add new management interfaces to the Multi-Protocol agent without having to restart the agent. Follow the steps given to create and register MBeans:

  1. Ensure the agent is running at the required port.

  2. Enter the URL http://<agentHost>:<portnumber>/Jmx_dynamic in the HTML browser (use https if SSL is enabled).

  3. Log in as a user with access type Admin (This step is applicable only if authentication is enabled).

  4. Select Register MBean option under the Admin section from the Main page. 

  5. Enter the following details:

  6. Press Submit button at the bottom of the page.

Note: If authentication is enabled for HTML Adaptor, access to registering MBeans is available only for Admin users.

 

Domain Name: This is the Domain under which the MBean has to be registered. Here, you may specify a Domain under which MBeans are already registered or a new Domain. For example, JMImplementation, Adaptors, and Services are some Domain names.

 

Keys: Each MBean is uniquely identified by its Object name comprised of two parts namely: Domain name and Key/Value pair. Here, the word "Keys" denotes the Key/Value pair of the MBean that has to be registered. Some Examples of Key/Value pairs are:

type=xxx, table=rooidtable. An example for Object name is MyDomain:table=rooidtable.

 

Class Name: For registering an MBean the corresponding class file name along with its package name has to be specified here. The MBean is registered only if the specified class file is present in the Class path of the Agent. In case you want to register an MBean which is not in the class path of the MBean Server, you have to use the Class Loader option.

 

XML File Name:  This is an optional field and is required only to register a Model MBean. The xml file name with the absolute path has to specified in this field. XML file contains the meta data required to initialize the default values of the Model MBean.

 

Class Loader:  This field is optional. When this field is empty, the default class loader is used to load the MBean class file. The default class loader searches for the class file only in directories specified in the CLASSPATH environment variable. If the class file is not present in the class path, the MBean is not registered.  If you want to register an MBean whose class file is located in some other place, for example from a network, you have to specify the Class Loader which can load the class file from its location.

 

Now, the MBean is registered with the MBean server of the Multi-Protocol agent. Its attributes and operations are also exposed by the HTML Adaptor and they can be accessed using the HTML Client (Web browser).

 

9.2.3.7 Deregistering an MBean at Run Time

 

Similar to the Register MBean option explained in the previous section, MBeans that are registered with the MBean server of the Multi-Protocol agent can be deregistered at run time from the HTML client (Web browser). To deregister an MBean  that is registered with the MBean server of the Multi-Protocol agent, follow the steps given below:

  1. Select UnRegister MBean option under the Admin section in the Main page. 

  2. Specify the following details:

  3. Press the Submit button.

Domain Name: This is the Domain under which the MBean is registered in the MBean server of the Multi-Protocol agent. For example, Agent_Sample_Mib, Adaptors, and Services are some Domain names.

 

Keys: Each MBean is uniquely identified by its Object name comprised of two parts namely: Domain name and Key/Value pair. Here, the word "Keys" denotes the Key/Value pair of the MBean that has to be registered. Some Examples of Key/Value pairs are: type=xxx, table=rooidtable. An example for Object name is MyDomain:table=rooidtable.

 

This option deregisters the MBean with the Object name specified from the MBean server of the Multi-Protocol agent.  

 

Note: The MBeanServerDelegate registered under the domain name JMImplementation cannot be deregistered.