Using NET-SNMP and HP-UX SNMP together

Why would one want to do such a thing? A major reason is that the HP-UX SNMP daemon only supports the EMANATE protocol for subagents; this means that subagents that support the AgentX protocol (which NET-SNMP – provided as part of HP’s Internet Express – supports) are not supported and cannot be accessed via HP’s SNMP daemon.

However, the HP-UX specific information is only available via the HP-UX native SNMP daemon. What is the answer?

Change one or the other to run on a non-native port, that’s the answer. With the two daemons listening on different ports – in essence, acting like to discrete damons – the capabilities of both can be exploited. Since the native HP-UX snmp daemon does not provide the capability of specifying the port, the net-snmp daemon can be moved – and it is relatively trivial to do so as well.

There is probably already a line that says:

agentaddress 161

Change this line to a new port – I used 166:

agentaddress 166

Restart the daemon. Once the NET-SNMP daemon has been moved, enable HP’s SNMP daemon (if you’ve not already done so) and start it up again:

cd /sbin/init.d
SnmpMaster start

This should enable your two SNMP daemons on different ports. Now you can access whichever one holds the data you want. For example, using the command snmpwalk, getting Caché data can be as simple as:

snmpwalk -m ALL -v 2c -c public my:166 .

Whereas getting HP-specific data can be retrieved this way:

snmpwalk -m ALL -v 2c -c public my .

Note the contrast between the two commands: one accesses the host my with the standard port (my); one uses the host my with the port 166 (my:166).

As a side note, note that Caché provides AgentX subagents, and note, too, that OpenVMS supports SNMP and AgentX as of v8.x. Thus, there’s no fighting with the SNMP daemon on OpenVMS.

AgentX and SNMP on HP-UX

A recent (in a relative fashion) protocol for support SNMP agents is called AgentX. This protocol is an attempt to standardize the protocol between a “master” SNMP agent (or server daemon) and the client agents. This style of SNMP configuration then makes the SNMP support extensible, providing for the ability to add and remove whole SNMP subtrees as desired. Intersystems Caché is one product that provides an agent that uses that AgentX protocol.

Unfortunately, HP-UX does not support AgentX, but rather a commercial protocol called EMANATE.

To be able to use subagents that support AgentX, the native SNMP server must be disabled, and one that supports AgentX installed to take its place. Thankfully, this is not difficult.

First, disabling SNMP requires modifying a number of files in /etc/rc.config.d:

  • SnmpHpunix
  • SnmpMaster
  • SnmpMib2
  • SnmpNaa
  • SnmpTrpDst
  • cmsnmpagt
  • emsagtconf

Change the entry that enables the affiliated agent or server: typically, this is by setting an entry such as SNMP_MASTER_START to 0.

This completely disables all agents as well as the master SNMP daemon. Don’t forget to stop all of these using their init scripts to stop them:

cd /sbin/init.d
./SnmpHpunix stop
./SnmpIpv6 stop
./SnmpMib2 stop
./SnmpTrpDst stop
./SnmpNaa stop
./SnmpMaster stop
./cmsnmpagt stop
./emsa stop

After this, get HP’s Internet Express and install Net-SNMP, which supports AgentX. Strangely enough, the Net-SNMP documentation states that Tru64 and OpenVMS servers come with AgentX support built-in.

Once installed, use the utility snmpconf to configure the agent – it creates the appropriate configuration file in the directory you are in. You’ll want to set these configuration parameters, either through the use of snmpconf or directly:

master yes
agentuser root
agentgroup sys
agentaddress 161
agentXSocket tcp:localhost:705

Better yet, create a special user and group for SNMP – installation of Net-SNMP does not set this up for you.

Once the snmpd.conf is configured, then run snmpd. Make sure you are running the right snmpd; reread the path if you need to:

# type snmpd
snmpd is /opt/iexpress/net-snmpd/sbin/snmpd
# snmpd -Lsdaemon -c /opt/iexpress/net-snmp/etc/snmpd.conf

You’ll have to create an initialization script in /sbin/init.d; we’ve discussed how to do this before.

You should not expect the rich set of HP-UX-specific entries that are provided with the standard installation, but in trade you get extensibility – which allows you to run subagents such as that provided with Intersystems Caché.