Matilda Systems Corporation | High Availability Resources
  

 
Recent Events




Quick Links

What We Do

High Availability Resources

Where we are located

Kids Zone

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.


Overview

The HACMP cluster manager makes a great deal of cluster configuration and status information available via SNMP. This information includes:
  • the name and id of the cluster
  • the topology of the cluster (i.e. nodes, networks and adapters)
  • the resources of the cluster including
    • what resources are defined
    • what resource groups are defined
    • what each resource group includes
    • which resource groups are active on each node in the cluster
This information is available via SNMP queries.

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 information

The information managed by an SNMP daemon (eg. snmpd on AIX) can be obtained using SNMP requests. There are two variants of interest:
  • an SNMP get request fetches the value of a single variable.
  • an SNMP get request followed by a sequence of SNMP getnext requests fetches a set of variables.

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 example

Here's how to obtain the name of a cluster called "Critter":

AIX:

# snmpinfo -m get -o hacmp.defs clusterName.0 
               1.3.6.1.4.1.2.3.1.2.1.5.1.2.0 = "Critter"
              

Linux (assumes the hacmp.my file is in /tmp):

# snmpget -m ./hacmp.my tiger public clusterName.0
enterprises.ibm.ibmAgents.aix.aixRISC6000.risc6000agents.risc6000clsmuxpd.cluster.clusterName.0 = "Critter"

A number of points need to be emphasized:

  • Very important point: this and all other examples on this page assume that the SNMP query command is being invoked from the directory that contains the appropriate MIB description file.

  • Human input is represented in italics fixed point font and computer output is represented in normal fixed point font.

  • The output of the Linux example above is a single line. If the equals sign and the "Critter" string appear on a second line then your web browser window is too narrow (don't be too surprised if you can't get your browser window wide enough to avoid the line wrap). We'll see very shortly how to reduce the length of these output lines to something more manageable.

  • The AIX example queries the SNMP agent running on the local host. This default can be overridden using the -h flag followed by the name of the alternative host.

    The Linux snmpget command requires that the SNMP agent's host be explicitly specified as the first positional parameter (i.e. tiger in the example).

  • The community name for each of these examples is public. In the AIX example, the community name was allowed to default to public (it can be overridden using the -c option). In the Linux example, the snmpget command requires that the community name be the second positional parameter.

  • The output of the AIX snmpinfo command is in numeric format by default. That long string of numbers separated by periods is the numeric name of the variable and the quoted string after the equals sign is the variable's value. Note that if you didn't have the appropriate MIB description file, you'd need to enter that long string of numbers separated by periods instead of being able to use the symbolic name.

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"
  • In order to keep the output of the examples consistent, the remaining examples on this page will use the -v option with AIX's snmpinfo command and the -Os option with the Linux commands.

  • The Linux snmpget command requires that the operand of the -m option contain a slash. Otherwise, the specified name is assumed to refer to a file in an installation-dependent directory (i.e. don't forget to prefix the name with a ./ (or any other appropriate pathname containing a slash) or put the hacmp.my file in the appropriate directory).

  • The AIX snmpinfo command can be used to request information from another AIX system. This is done by using the -h option. For example, the following command would request the name of a cluster running on a node called elephant:
# 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 nodeName
nodeName.1 = "elephant"
nodeName.2 = "tiger"
Linux:
# snmpwalk -Os -m ./hacmp.my tiger public nodeName
nodeName.1 = "elephant"
nodeName.2 = "tiger"
The 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 snmpgetnext requests on Linux. This is at best a theoretical possibility as managing the process within a shell script is a very complex undertaking . . .

Some shell scripts

Here's a link to a tar file of scripts that print various useful cluster information using SNMP queries.

Look in the haREADME file (also included in the tar file) for more information.

These scripts are changing quite quickly (as of 2002/03/02). Drop back later for new and/or improved versions.

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.