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.

Terminologies:
—————
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
net-snmp-5.1.2-13.el4
net-snmp-libs-5.1.2-13.el4
net-snmp-utils-5.1.2-13.el4

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

For example:
[jayesh@MY_SERVER mibs]# pwd
/home/ram/.snmp/mibs
[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:
system.temperature.temperatureHealth.0
system.gsaDisk.diskHealth.0
system.machine.machineHealth.0

Or (in terms of complete MIBs)
.iso.org.dod.internet.private.enterprises.google.gsa.system.temperature.temp
eratureHealth
.iso.org.dod.internet.private.enterprises.google.gsa.system.gsaDisk.diskHeal
th
.iso.org.dod.internet.private.enterprises.google.gsa.system.machine.machineH
ealth

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
.1.3.6.1            .iso.org.dod.internet
.1.3.6.1.1            .iso.org.dod.internet.directory
.1.3.6.1.2            .iso.org.dod.internet.mgmt
.1.3.6.1.2.1            .iso.org.dod.internet.mgmt.mib-2
.1.3.6.1.2.1.10
.iso.org.dod.internet.mgmt.mib-2.transmission
.1.3.6.1.3            .iso.org.dod.internet.experimental
.1.3.6.1.4            .iso.org.dod.internet.private
.1.3.6.1.4.1            .iso.org.dod.internet.private.enterprises
.1.3.6.1.4.1.11129
.iso.org.dod.internet.private.enterprises.google
.1.3.6.1.4.1.11129.1
.iso.org.dod.internet.private.enterprises.google.gsa
.1.3.6.1.4.1.11129.1.1
.iso.org.dod.internet.private.enterprises.google.gsa.crawl
.1.3.6.1.4.1.11129.1.1.1
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.crawlRunning
.1.3.6.1.4.1.11129.1.1.2
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status
.1.3.6.1.4.1.11129.1.1.2.1
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.docsServed
.1.3.6.1.4.1.11129.1.1.2.2
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.crawlingRa
te
.1.3.6.1.4.1.11129.1.1.2.3
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.docBytes
.1.3.6.1.4.1.11129.1.1.2.4
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.todayDocsC
rawled
.1.3.6.1.4.1.11129.1.1.2.5
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.docErrors
.1.3.6.1.4.1.11129.1.1.2.6
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.docsFound
.1.3.6.1.4.1.11129.1.1.2.7
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.batchCrawl
Running
.1.3.6.1.4.1.11129.1.1.2.8
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.batchCrawl
StartTime
.1.3.6.1.4.1.11129.1.1.2.9
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.batchCrawl
EndTime
.1.3.6.1.4.1.11129.1.1.2.10
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.status.batchCrawl
EndReason
.1.3.6.1.4.1.11129.1.1.3
.iso.org.dod.internet.private.enterprises.google.gsa.crawl.diagnostics
.1.3.6.1.4.1.11129.1.2
.iso.org.dod.internet.private.enterprises.google.gsa.serving
.1.3.6.1.4.1.11129.1.2.1
.iso.org.dod.internet.private.enterprises.google.gsa.serving.qpm
.1.3.6.1.4.1.11129.1.3
.iso.org.dod.internet.private.enterprises.google.gsa.system
.1.3.6.1.4.1.11129.1.3.1
.iso.org.dod.internet.private.enterprises.google.gsa.system.gsaDisk
.1.3.6.1.4.1.11129.1.3.1.1
.iso.org.dod.internet.private.enterprises.google.gsa.system.gsaDisk.diskHeal
th
.1.3.6.1.4.1.11129.1.3.1.2
.iso.org.dod.internet.private.enterprises.google.gsa.system.gsaDisk.diskErro
rs
.1.3.6.1.4.1.11129.1.3.2
.iso.org.dod.internet.private.enterprises.google.gsa.system.temperature
.1.3.6.1.4.1.11129.1.3.2.1
.iso.org.dod.internet.private.enterprises.google.gsa.system.temperature.temp
eratureHealth
.1.3.6.1.4.1.11129.1.3.2.2
.iso.org.dod.internet.private.enterprises.google.gsa.system.temperature.temp
eratureErrors
.1.3.6.1.4.1.11129.1.3.3
.iso.org.dod.internet.private.enterprises.google.gsa.system.machine
.1.3.6.1.4.1.11129.1.3.3.1
.iso.org.dod.internet.private.enterprises.google.gsa.system.machine.machineH
ealth
.1.3.6.1.4.1.11129.1.3.3.2
.iso.org.dod.internet.private.enterprises.google.gsa.system.machine.machineE
rrors
.1.3.6.1.4.1.11129.1.4
.iso.org.dod.internet.private.enterprises.google.gsa.search
.1.3.6.1.4.1.11129.1.4.1
.iso.org.dod.internet.private.enterprises.google.gsa.search.reports
.1.3.6.1.4.1.11129.1.4.2
.iso.org.dod.internet.private.enterprises.google.gsa.search.logs
.1.3.6.1.4.1.11129.1.5
.iso.org.dod.internet.private.enterprises.google.gsa.eventLogs
.1.3.6.1.5            .iso.org.dod.internet.security
.1.3.6.1.6            .iso.org.dod.internet.snmpV2
.1.3.6.1.6.1            .iso.org.dod.internet.snmpV2.snmpDomains
.1.3.6.1.6.2            .iso.org.dod.internet.snmpV2.snmpProxys
.1.3.6.1.6.3            .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
MIBS:

#!/bin/bash
#set -o xtrace
DEVICE=”Yur_IP_HERE”
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”;;
esac

if [ ${STATUS} != “Good” ]
then
(
PARAM=`echo ${MIB}|cut -f3 -d”.”`
echo “From: MY_EMAIL_FROM@DOMAIN.COM”
echo “To: MY_EMAIL@DOMAIN.COM”
echo “Subject: [GSA] ${PARAM} ${STATUS}”
echo “GSA Device ${DEVICE} is in ${STATUS} state for ${PARAM}. Please investigate.”
)| sendmail -t
fi
Done

Leave a Reply

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