It’s been about an year since I’ve been hacking around with Cacti and SNMP on various platform here inside our Server Farm. I always had very interesting results with all the system I had to deal with whether they were FreeBSD/Linux boxes, Windows boxes, printers, routers or anything… except for the AIX boxes. AIX’s internal SNMP just sucks. Full stop. The information he’s able to report can be quantified with 2 fingers of one hand: installed software and TCP statistics. No way to report CPU usage, memory usage, file systems usage, or anything else.
So today I packed everything together and decided to compile net-snmp on AIX. I must admit I was pretty worried by this but it turned out to be pretty simple, if you just pay attention to a few steps.
First of all you need the AIX Linux Toolbox. It’s a bunch of RPMs to be installed to install the GCC compiler, the standard libs (LibGCC) and a few other things. Everything can be be found here: http://www-03.ibm.com/systems/p/os/aix/linux/toolbox/download.html
Basically you need just a few thing:
- GCC / GCC++
- LibGCC / LibGCC++ / LibGCC++-Devel
Note that to compile net-snmp probably you don’t need all of them but I wanted to create a somewhat standard environment, so I decided to include all of them.
Optionally you may want (well, you HAVE to, unless you’re running AIX 5.3 or higher) to install GNU Grep and GNU SED as AIX default one have some problems with lines longer than 2048 chars.
After installing GNU Grep and GNU SED (you can find the RPMs at the usual Linux Toolbox page) you have to make sure that GNU grep and sed take the priority over standard one. There are several way to accomplish this. The one I choose was to edit /etc/environment and to change the standard PATH to include /opt/freeware/bin (that’s where grep and sed will be installed) before /usr/bin. So my PATH actually looked like this:
Now it was just a matter of un-tarring net-snmp’s sources somewhere and running configure. BUT! (there’s always a “but” with AIX) you have to pay attention to configure’s command line as the the default parameters seems not to work ok.
So what I came up (reading net-snmp’s docs) was this:
./configure –disable-shared –disable-embedded-perl –without-kmem-usage
this way you are disabling shared libs (which seems to cause segmentation faults) and embedded perl support (for the same reason). Last but not least you’re disabling KMEM because of compatibility issues with 64bit kernels. As of now net-snmp latest version is 5.4… if you’re using a newer version or you’re using a 32bit kernel you may want to test everything using kmem (although I don’t even know what it is).
Ok. After configure finishes (and it asks you a few standard question about snmp you should be able to answer by yourself) just run
make && make install
and you’ll be happy.
Do the standard configuration in /usr/local/share/snmp/snmpd.conf (read net-snmp docs on how to do that).
Now it’s time to stop AIX’s internal snmpd with
stopsrc -s snmpd
Check that it’s really stopped with a nice
ps -ef | grep snmpd
and then run
Check it is running with the same
ps -ef | grep snmpd
as before and check it’s correctly reporting something by using snmpwalk from any other host (or from the same machine on localhost).
Now, there are some problems. At least I have them. net-snmp doesn’t report correctly for the all the TCP stuff (like lan cards activity and such). I really don’t know why but instead of getting crazy with that I just decided to reactivate AIX’s internal snmpd on a different port, for example 8161, (by editing /etc/services and specificing a different port for the snmp service instead of 161) and having net-snmp proxying that part of the snmp-tree to internal’s snmpd. Edit /usr/local/share/snmp/snmpd.conf and make sure you specify the listening port for net-snmp (just because we don’t want it to get confused by our previous changes in /etc/services) using the following line:
next step is to add the proxy specifications by using the proxy command. It should look something like this:
proxy -v 1 -c public 127.0.0.1:8161 .126.96.36.199.188.8.131.52.1
Basically you’re saying that whenever someone requests the .184.108.40.206.220.127.116.11.1 branch (that is the branch for the Ethernet Interfaces, net-snmp will proxy the request to the agent running on 127.0.0.1‘s port 8161, that is AIX’s internal snmpd, by using a version 1 snmp request.
Restart /usr/local/sbin/snmpd and restart AIX’s snmpd with
startsrc -s snmpd
Let me know if it works for you 🙂