![]() ![]() ![]() |
19.1 Overview
19.2 Storage Types for Scalars and Tables
19.3 Configuring the Storage Type
This section deals with the storage type options provided by Agent Toolkit for Scalars and Tables.
19.2 Storage Types for Scalars and Tables
The supported storage types for a Table include : -
Text File
This is a flat file, which stores the data of a Table in the following format (Sample entry).
1|1|column3 not initialized|1| |
This file created under <Agent Toolkit Home>/snmpprojects/projectname/agent/bin/textFiles directory is read on Agent startup. To add a new row entry to this Table a similar entry has to be included to the text file with the values that you require. For scalars, all the scalar variables under a scalar group will be listed as given in the sample entry differentiated with the pipe symbol. Please note that the Agent has to be restarted for the changes to take effect. When this storage option is chosen, the Agent reads the values from text files only.
XML Files
This is an XML-formatted file that stores the data of a Table as given below (Sample entry).
<?xml version="1.0" encoding="UTF-8"?> <table> <row> <column name="column1" value="1" ></column> <column name="column2" value="1" ></column> <column name="column3" value="column3 not initialized" ></column> <column name="column4" value="1" ></column> </row> </table> |
This file created under <Agent Toolkit Home>/snmpprojects/projectname/agent/bin/xmlFiles directory is read on Agent startup. To add a new entry to this Table, a similar entry (starting from <row> to </row>) has to be included to the XML file with the values that you require . Please note that the Agent has to be restarted for the changes to take effect. When this storage option is chosen, the Agent reads the values from XML files only.
Database
In some cases, the application databases have the potential to be extremely large and dynamic. Storing these information in the AgentTableModel (default storage model for Tables) would occupy considerable memory space and would result in wastage of resources. This problem gets resolved when storing the information in a database. With this model, there will be no problems on memory hogging. As and when required, the values are retrieved by specifying the URL.
Agent Toolkit supports database access for any SNMP request. The Agent API establishes the connection between the Agent and the Database before Agent startup.
Runtime Memory
Runtime Memory does not store the details in a text file, XML file, or a database. Instead it stores the data in Agent memory. Entries can be added to the Table during run time from the Manager when Runtime Memory option is chosen. But these data get lost once the Agent is stopped
The supported storage type for a Scalar includes RAM and Text file alone.
19.3 Configuring the Storage Type
Now that you know the different storage type options, it is required to know how to configure the Agent for availing these storage options. Configurations can be done using MIB Compiler UI or using API Calls
To configure the settings using MIB Compiler UI, follow the steps given below:
Create a Project and load a MIB.
Select Project -> Settings from the menu bar of MIB Compiler UI.
Select Storage Model from the Source Generation panel.
You can select the storage type for the Tables in a MIB from the combo box given across Table.
You can select the storage type for the Scalars in a MIB from the combo box given across Scalar.
To customize the storage type for a particular table or a scalar node, use the Node Storage Type. Select the node and choose the storage option.
Configuring Database is dealt with as a separate section. Refer to the same to know how to configure for database storage.
19.3.1 Configuring Database
If the Storage Type is Database for all or any of the Tables in a MIB, the Database parameters have to be provided to access the database. To configure the database, using MIB Compiler UI options follow the steps given below:
Using MIB Compiler UI
Select Project -> Settings menu from the menu bar of MIB Compiler UI.
Select Storage Model from the Source Generation panel.
Click Configure - Database and give the following inputs : -
Database Name - Name for the Database.
URL - URL from which the Database is to be located.
Driver - Name of the Driver.
User name - An User name.
Password - A Password for the User.
For example, assume that you have to provide storage in Database for the adiskTable of the AGENT-SAMPLE-MIB. In order to proceed with this, do the following :
Add the database file (from an application which provides a ODBC driver) to the ODBC Data Source Administrator. Provide a unique name for the file as "DatabaseTest"
Once this is done, you have to associate this data source to the adiskTable object in the MIB file. In this case, the DATABASE-URL should be "jdbc:odbc:DatabaseTest"
Specify the Database driver name as "sun.jdbc.odbc.JdbcOdbcDriver".
Specify a User Name and Password. For Example, the User Name can be "ZohoCorp" and the Password can be "ZohoCorp".
|
Note: The Database Name, URL, Driver, UserName, and Password must be the same for all the Tables, which provide database storage. |
![]() ![]() ![]() |