What is SNMP? how to use SNMP?

This is a brief documentation on using the google-provided MIBs for GSA (Google Search Appliance). This can also be used as a reference to monitor any SNMP enabled device.

SNMP: SNMP stands for Simple Network Management Protocol and consists of three key components: managed devices, agents, and network-management systems (NMSs). A managed device is a node that has an SNMP agent and resides on a managed network. These devices can be routers and access server, switches and bridges, hubs, computer hosts, or printers. An agent is a software module residing within a device. This agent translates information into a compatible format with SNMP. An NMS runs monitoring applications. They provide the bulk of processing and memory resources required for network management.

MIB: MIB stands for Management Information Base and is a collection of information organized hierarchically. These are accessed using a protocol such as SNMP. There are two types of MIBs: scalar and tabular. Scalar objects define a single object instance whereas tabular objects define multiple related object instances grouped in MIB tables.

OID: OIDs or Object Identifiers uniquely identify manged objects in a MIB hierarchy. This can be depicted as a tree, the levels of which are assigned by different organizations. Top level MIB object IDs (OIDs) belong to different standard organizations. Vendors define private branches including managed objects for their own products.

Tools required:
In order to get more information on the OID, or to get list of all available params/OID from a device, or to get OID from MIB or vice-versa, it would help if we have access to a linux box with snmp-utils installed. This can be checked using:
$ rpm -qa |grep -i snmp

And if not available, installed from yum. You need to copy the vendor provided MIB file to you home directory under:

For example:
[jayesh@MY_SERVER mibs]# pwd
[jayesh@MY_SERVER mibs]# ls -la
total 24
drwxr-xr-x  2 jayesh jayesh 4096 Oct 28 18:04 .
drwxr-xr-x  3 jayesh jayesh 4096 Oct 28 18:03 ..
-rw-r–r–  1 jayesh jayesh 702 Oct 28 17:56 GOOGLE-MIB.txt
-rw-r–r–  1 jayesh jayesh 5032 Oct 28 17:56 GSA-MIB.txt

Setting up the monitor:
Your monitoring tool (sitescope) is normally capable of monitoring the usual/standard metrics from an SNMP capable device. The more famous and widely used the device is, the better support. (Cisco, Linux etc).

In case the OIDs are not available to the monitoring system, they can always be imported from the manufacturer provided MIBs.

Monitor can be setup using the MIB or OID for that particular system. In case of GSA, the MIBs that we need to monitor are:

Or (in terms of complete MIBs)

Now, we can use the MIB directly to use for our monitoring or we can use the corresponding OID.

In order to get the list of OIDs corresponding to the MIBs, we can use the tools provided by the net-snmp-utils package.

Command:snmptranslate -m GSA-MIB -Ts
Function: to get the list of MIB trees

Command:snmptranslate -m GSA-MIB -To
Function: to get the list of OID

Using both the commands for GSA, we can get the following information:

OID                MIB
.1.3                .iso.org
.1.3.6                .iso.org.dod
.            .iso.org.dod.internet
.            .iso.org.dod.internet.directory
.            .iso.org.dod.internet.mgmt
.            .iso.org.dod.internet.mgmt.mib-2
.            .iso.org.dod.internet.experimental
.            .iso.org.dod.internet.private
.            .iso.org.dod.internet.private.enterprises
.            .iso.org.dod.internet.security
.            .iso.org.dod.internet.snmpV2
.            .iso.org.dod.internet.snmpV2.snmpDomains
.            .iso.org.dod.internet.snmpV2.snmpProxys
.            .iso.org.dod.internet.snmpV2.snmpModules
.0.0                .ccitt.zeroDotZero

Now, we can use this information, to setup the monitor for the system. (we would need the IP address of the device, the community string, and of course, access to SNMP-readonly)

I would guess, SiteScope needs the OID, community string, and the IP address of the device to monitor.

Here is an example shell script, that uses snmp-utils (snmpget) and the GSA

#set -o xtrace
MIBS=”system.temperature.temperatureHealth.0 system.gsaDisk.diskHealth.0 system.machine.machineHealth.0″
# GSA-MIB::diskHealth.0 = INTEGER: green(0) for MIB in ${MIBS} do

RESULT=`snmpget -m GSA-MIB -v 2c -c public -t 5 ${DEVICE} ${MIB}| cut -f4 -d”:” | grep -E -o “[0-9]”`

case ${RESULT} in
0) STATUS=”Good”;;
1) STATUS=”Warning”;;
2) STATUS=”Critical”;;
*) STATUS=”Unreachable/Unknown”;;

if [ ${STATUS} != “Good” ]
PARAM=`echo ${MIB}|cut -f3 -d”.”`
echo “Subject: [GSA] ${PARAM} ${STATUS}”
echo “GSA Device ${DEVICE} is in ${STATUS} state for ${PARAM}. Please investigate.”
)| sendmail -t

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.