JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris System Management Agent Developer's Guide
search filter icon
search icon

Document Information

Preface

1.  Introduction to the System Management Agent

2.  Creating Modules

3.  Data Modeling

init_module Routine

Scalar Objects

demo_module_1 Code Example for Scalar Objects

Modifications for Scalar Data Retrieval

Simple Tables

demo_module_2 Code Example for Simple Tables

Modifications for Simple Table Data Retrieval

Data Retrieval From Large Simple Tables

Multiple SET Processing in demo_module_2

General Tables

demo_module_3 Code Example for General Tables

4.  Storing Module Data

5.  Implementing Alarms

6.  Deploying Modules

7.  Multiple Instance Modules

8.  Long-Running Data Collection

9.  Entity MIB

10.  Migration of Solstice Enterprise Agents to the System Management Agent

A.  SMA Resources

B.  MIBs Implemented in SMA

Glossary

Index

General Tables

A general table differs from a simple table in at least one of the following ways:

The command that you use to generate code templates for general tables is the same command used for simple tables:

mib2c -c mib2c.iterate.conf mibnode1 mibnode2 ...

The demo_module_3 code example shows how modify the templates appropriately to retrieve data from general tables.

demo_module_3 Code Example for General Tables

The demo_module_3 code example is provided to help you understand how to modify the code generated by the mib2c command to perform a data retrieval in a general table. The table example provides information for monitoring a list of files. The demo_module_3 code example is located by default in the directory /usr/demo/sma_snmp/demo_module_3.

The README_demo_module_3 file contains instructions that describe how to perform the following tasks:

The demo_module_3 is set up to allow you to generate code templates me1ContactInfoTable.c and me1ContactInfoTable.h. You can then compare the generated files to the files demo_module_3.c and demo_module_3.h.

The me1ContactInfoTable.c and me1ContactInfoTable.h have been modified appropriately to retrieve data from general tables. You can use these files as a model for learning how to work with general tables in your own module. The instructions then explain how to compile the modified source files to create a functioning module.

The demo_module_3 code was generated by using mib2c with the -c mib2c.iterate.conf option. Some functions have been added to implement a link list to provide the test data.

The example uses some dummy data to perform data retrieval for a two-index table. The code is similar to the demo_module_2.c with one extra index. The following code sets up the table with two indexes:

netsnmp_table_helper_add_indexes(table_info,
ASN_INTEGER, /* index: me1FloorNumber */
ASN_INTEGER, /* index: me1RoomNumber */
0);

Use care in returning the “NEXT” data when function me1ContactInfoTable_get_next_data_point() is called. For instance, the data in this table is presorted so the next data is conveniently pointed by the pNext pointer in this example code:

me1ContactEntry* nextNode = (me1ContactEntry*) *my_loop_context;
          nextNode = nextNode->pNext;

If your implementation is more complicated, make sure the OIDs are increased incrementally, (xxx.1.1, xxx.1.2, ).

The input MIB file contains the specification of tables and scalars. When you run mib2c -c mib2c.iterate.conf on a general table node, template code is generated only for the general table in the MIB.