![]() |
|
![]() |
|
Using SNMP to get cluster status information |
Home > Resources > HACMP Resources Collection > Using SNMP to get cluster status information This page describes how to obtain cluster status information using SNMP queries. The examples on this page are intended to be illustrative. There's a lot more information that can be obtained using similar techniques . . . This page is part of the Matilda Team's HACMP Resources Collection. The home page of the collection is located here. IMPORTANT: read the disclaimer BEFORE you use any information provided in this collection. OverviewThe HACMP cluster manager makes a great deal of cluster configuration and status information available via SNMP. This information includes:
This page describes some of the information which is available and how to obtain and/or interpret it. In the interests of portability, the Linux and AIX variants of the relevant commands are always shown. In addition, a set of potentially useful shell scripts is provided for extracting this information. Background informationThe information managed by an SNMP daemon (eg. snmpd on AIX) can be obtained using SNMP requests. There are two variants of interest:
You need to know the name of a variable before your can fetch a variable's value. Although it is possible to reference SNMP variables via their numeric names, it is almost certainly more practical to use their symbolic names. Correctly mapping a symbolic name to a numeric names requires the use of an appropriate MIB description file. Two different MIB description files are provided with HACMP. The files are called hacmp.my and hacmp.defs. On an HACMP "classic" system, these files are in the directory /usr/sbin/cluster/ whereas on an HACMP/ES system, these files are in the directory /usr/es/sbin/cluster/. SNMP information is managed by components called agents. Most AIX hosts and all HACMP cluster nodes runs an SNMP agent which is represented by the AIX snmpd daemon. Each collection of SNMP information is also contained within a community. By default, the HACMP related SNMP information is in the public community. Since the information obtainable via SNMP can be somewhat sensitive and since it is possible to change a cluster's configuration, some HACMP clusters are configured with community names other than public (a description of how to change the community name will appear on this page someday soon). The AIX tool for performing SNMP queries is called snmpinfo. This tool requires the hacmp.defs file in order to map SNMP symbolic variable names to SNMP numeric variable names. The Linux tool (and many other SNMP query tools) require the hacmp.my file. In order to perform SNMP queries, you need to have a copy of the appropriate file on the machine that you're performing the queries from. The AIX snmpinfo tool is part of the bos.net.tcp.server fileset. The Linux SNMP tools are probably included in your Linux distribution. If not or if you'd like to get the latest version, download the ucd-snmp package off the 'net. As of the time this page was written, the current version was 4.2.3 and the software was available at http://net-snmp.sourceforge.net/. A very basic exampleHere's how to obtain the name of a cluster called "Critter": AIX:
Linux (assumes the hacmp.my file is in /tmp):
A number of points need to be emphasized:
You can get a much more readable format from the AIX snmpinfo command by specifying the -v option. This would yield the following output: clusterName.0 = "Critter" The output of the Linux snmpget command includes a somewhat abbreviated form of variable's symbolic name (you read that right - that long sequence of words separated by periods is an abbreviated form of the name!). This can be further reduced to a more manageable form by specifying the -s option which would yield the following: clusterName.0 = "Critter"The more recent versions of the Linux snmpget command have deprecated the -s option and replaced it with a -Os option. The fully qualified name of the variable can be requested on Linux by using the snmpget command's -f option (deprecated and replaced by the -Of option in recent versions of snmpget). This yields the following if used in the above example: .iso.org.dod.internet.private.enterprises.ibm.ibmAgents.aix.aixRISC6000. risc6000agents.risc6000clsmuxpd.cluster.clusterName.0 = "Critter"
# snmpinfo -m get -h elephant -v -o hacmp.defs clusterName.0 1.3.6.1.4.1.2.3.1.2.1.5.1.2.0 = "Critter" Every SNMP value is stored in a specific SNMP variable. Although SNMP doesn't support the notion of an array or a list, each SNMP variable can have one or more instances. These instances can and are used to implement what amounts to arrays. For example, the following command(s) print a list of the SNMP variables containing the node names in a cluster: AIX: # snmpinfo -v -m dump -o hacmp.defs nodeNameLinux: # snmpwalk -Os -m ./hacmp.my tiger public nodeNameThe AIX snmpinfo command's -m dump option specifies that all variables at or below the specified name are to be retrieved and printed. In the Linux case, the same effect is achieved using the snmpwalk command instead of the snmpget. Within the protocol between the command and the agent, these lists of values are actually obtained by first issuing an SNMP get request for the first value and then repeated SNMP getnext requests until a variable name is returned that isn't an extension of the original name. On AIX, an SNMP getnext request is performed using the snmpinfo command's -m next option. On Linux, the snmpgetnext command is used. One final point should be noted about the AIX snmpinfo -m dump and Linux snmpwalk requests - they can be replaced by a suitable snmpinfo -m get followed by suitable series of snmpinfo -m next requests on AIX and by a suitable snmpget followed by a suitable series of Some shell scriptsHere's a link to a tar file of scripts that print various useful cluster information using SNMP queries. IMPORTANT: If you lack the appropriate skills, experience and/or competency, are unwilling to take responsibility for your actions, or if you don't like these disclaimers then don't use this information.
|
| © 2004 Matilda Systems Corporation |