This is the first of a two part article about Unbrowse SNMP scripting.
It is not uncommon for network administrators to deal with hundreds of devices scattered over a large geographical area. The device details are usually stored in a network management system such as HP Openview or CiscoWorks (both trademarks of their respective organizations). This article explains how you can use scripting to import SNMP agents into the Unbrowse database.
Unbrowse SNMP is a MIB Browser and Trap Receiver that is intended to be used as a powerful troubleshooting and an all around utility. Unbrowse keeps track of agents (devices) and stores information such as IP addresses, community strings, timeouts, SNMP versions, V3 usernames, auth and priv passwords, and so forth. This allows the administrator to quickly manage devices without having to enter these details each time. This will work as long as the number of devices are few, when you are dealing with hundreds of devices it is not feasible to enter them manually into a tool like Unbrowse. Dont worry, help is at hand. You can write simple scripts in VBScript or Ruby to add devices automatically into Unbrowse.
Part 1 : The Automation objects
In this section, we will look at the methods and properties of the automation interface.
The Agent Manager object
This object is createable via the “UnbrowseSNMP.AgentManager” id. To create this object in
VBScript
Set Mgr = CreateObject("UnbrowseSNMP.AgentManager")
Ruby
agentMgr = WIN32OLE.New("UnbrowseSNMP.AgentManager")
Â
Â
Name | Purpose |
Init | Initialize the manager (not necessary to call this) |
NewAgent | Create a new agent object. You can then set the properties of this object |
AddToRepository | Parameter: an agent object. Add this agent to the database |
RemoveFromRepository | Parameter: an agent object. Remove this agent |
FindAgent | Find an agent by name. Returns the agent object or null |
The SNMP Agent object
The following table show the supported properties on the object
Name | Purpose |
IPAddress | The IP Address of the SNMP agent (can be an IPv6 address) |
Name | Name of agent |
Name | Purpose |
SNMPVersion | Version used to communicate (0=v1, 1=v2c, 3=v3) |
ReadComm | The community used for reading from agent (v2 only) |
WriteComm | The community used for SET requests (v2 only) |
SecurityName | The v3 USM user name |
ContextName | The v3 context name |
SecurityLevel | The type of v3 security (0 = noAuthNoPriv, 1 = authNoPriv, 2= authPriv) |
AuthProtocol | v3 authentication protocol (0=MD5, 1=SHA) |
PrivProtocol | v3 privacy protocol (0=DES, 1=AES) |
Port | The UDP port to which requests are sent |
Timeout | Timeout in milliseconds |
Retries | Number of times to retry communication before declaring error |
Â
Thats all. You only have to now write scripts to manipulate these two objects. It is really easy. In the next part we will write a script in Ruby to import devices from a CiscoWorks DCR v3 file.
Â
[tags] MIB Browser, SNMP Agent, VBScript SNMP, Unbrowse, CiscoWorks, DCRv3 format, Ruby SNMP [/tags]