The UCD-DLMOD-MIB provides MIB entries for the module name, path, and status. By setting these MIB entries, you can cause the agent to load or unload the module without restarting the agent.
This procedure causes the module to be loaded only for the current session of the agent. If you want the module to be loaded each time the agent starts, you should add a dlmod line to the snmpd.conf file. The process of adding the line is described in Step 2 of the previous procedure. Do not restart the agent after adding the line.
View the UCD-DLMOD-MIB.txt file in /etc/sma/snmp/mibs.
Look for the DlmodEntry and dlmodStatus entries, which appear as follows:
DlmodEntry ::= SEQUENCE { dlmodIndex Integer32, dlmodName DisplayString, dlmodPath DisplayString, dlmodError DisplayString, dlmodStatus INTEGER } dlmodStatus OBJECT-TYPE SYNTAX INTEGER { loaded(1), unloaded(2), error(3), load(4), unload(5), create(6), delete(7) } MAX-ACCESS read-write STATUS current DESCRIPTION "The current status of the loaded module." ::= { dlmodEntry 5 }
DlmodEntry defines a row in a table of dynamically loaded modules. A table row describes an instance by defining an index, name, path, error code, and status code. You need to set the name, path, and status of the first empty row of the table.
Type the following command to check the first row of the table. The command can tell you whether an instance of a dynamically loaded module already exists in the table.
$ /usr/sfw/bin/snmpget -v 1 -c public localhost UCD-DLMOD-MIB::dlmodStatus.1 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: UCD-DLMOD-MIB::dlmodStatus.1 |
This response indicates that no other dynamic module is defined as instance 1. If you get back a positive response, examine dlmodStatus.2 with the same command.
Create an instance for your module in the table by typing the following command:
$ /usr/sfw/bin/snmpset -v 1 -c private localhost \ UCD-DLMOD-MIB::dlmodStatus.1 i create UCD-DLMOD-MIB::dlmodStatus.1 = INTEGER: create(6) |
Repeat the snmpget command to show the status of the first instance.
$ /usr/sfw/bin/snmpget -v 1 -c public localhost \ UCD-DLMOD-MIB::dlmodStatus.1 UCD-DLMOD-MIB::dlmodStatus.1 = INTEGER: unloaded(2) |
The instance now exists, but the module is unloaded currently.
Set the name and path to the module that you want to load. Type a command that is similar to the following:
$ /usr/sfw/bin/snmpset -v 1 -c private localhost \ UCD-DLMOD-MIB::dlmodName.1 s "testmodule" \ UCD-DLMOD-MIB::dlmodPath.1 s "/home/username/lib/testmodule.so" UCD-DLMOD-MIB::dlmodName.1 = STRING: testmodule UCD-DLMOD-MIB::dlmodPath.1 = STRING: /home/username/lib/testmodule.so |
testmodule is the name of your module.
Load the module by typing the following command:
$ /usr/sfw/bin/snmpset -v 1 -c private localhost \ UCD-DLMOD-MIB::dlmodStatus.1 i load UCD-DLMOD-MIB::dlmodStatus.1 = INTEGER: load(4) |
This command sets the dlmodStatus.1 variable to load.
Confirm that the module was loaded by typing the following command:
$ /usr/sfw/bin/snmpget -v 1 -c public localhost \ UCD-DLMOD-MIB::dlmodStatus.1 UCD-DLMOD-MIB::dlmodStatus.1 = INTEGER: loaded(1) |
The response indicates that the module is loaded.
(Optional) Unload the module by typing the following command:
$ /usr/sfw/bin/snmpset -v 1 -c private localhost \ UCD-DLMOD-MIB::dlmodStatus.1 i unload UCD-DLMOD-MIB::dlmodStatus.1 = INTEGER: unload(5) |
(Optional) Confirm that the module was unloaded by typing the following command:
$ /usr/sfw/bin/snmpget -v 1 -c public localhost \ UCD-DLMOD-MIB::dlmodStatus.1 Timeout: No Response from localhost. |
The lack of response from localhost indicates that the module is unloaded.