H's Blog A good shell is the best user interface.

19Apr/120

SNMP Warnings in Debian Squeeze

The default installation of snmpd in Debian Squeeze will put several warnings into the daemon.log.

The reason is the licensing of the MIB files, that is not compatible with Debian.

If you are not satisfied with errors on each restart of the snmpd, here are the steps, that solved this problem in my case:

  • Edit /etc/apt/sources.list and append contrib and non-free to the standard repositories.
  • apt-get update
  • apt-get install snmpd snmp-mibs-downloader
  • Edit /etc/default/snmpd:
    export MIBS=/usr/share/mibs/netsnmp/UCD-SNMP-MIB

Commenting the original line export MIBS= did not help, also the definition export MIBS=/usr/share/mibs/netsnmp did not work, so I will leave the MIBS reference in the configuration on UCD-SNMP_MIB.

19Aug/100

SNMP Monitoring for Java VM

SNMP is not really simple, but quite a useful protocol, if you want to run standard monitoring tools like Nagios, Zero RRD or Cacti.
Even though Java offers JMX for runtime information like thread and memory consumption, you can also use SNMP to read at least a subset.
In my opinion usage of a standard monitoring tool has several advantages over JMX-based visualization in jconsole or Lambda Probe:

  • Statistics fit into centralized reporting, e.g. for SLAs.
  • The tools are independent of the Java VM. If the VM freezes, the history is still available


First you need to enable the SNMP Agent in your Java VM. Please find the details here. This is only an outline:

  • Prepare an ACL configuration at $JAVA_HOME/lib/management/snmp.acl. On Sun's Java 6 for Ubuntu 10.04 64 Bit you will find these files in the package ia32-sun-java6-bin.
  • Use the following options on the command line to enable SNMP:
    -Dcom.sun.management.snmp.port=7667
    -Dcom.sun.management.snmp.acl.file=$JAVA_HOME/lib/management/snmp.acl
    

If you really put the snmp.acl at $JAVA_HOME/lib/management, it's very likely, you will not need to specify the com.sun.management.snmp.acl.file option.

Now you are ready to read the internal state by using SNMP:

  • Zero Agent's module for Java SNMP just needs the port specified in conf/enabled/JavaSNMP.conf.
  • Please find some available OIDs in the source code of JavaSNMP.pm
  • The full list of available values is included in the following MIB.
3Jul/090

Nagios using SNMP for Process Monitoring

Without special reconfiguration on the SNMP daemon, you are able to check processes on a Linux resp. services on a Windows host remotely:

  • Linux Process: check_snmp_process.pl -H $HOSTADDRESS$ -C public -n $ARG1$ $ARG2$
  • Windows Service: check_snmp_win.pl -H $HOSTADDRESS$ -C public -n $ARG1$ $ARG2$

The first argument in these checks provides the pattern for the process resp. service name. As usual another optional argument may append further options.

Both checks provide more sophisticated options to tune the results, e.g. if there is more than a single process or service matching the name.

Again you will find the checks at nagios.manubulon.com.

3Jul/091

Nagios using SNMP for the Basic Checks (CPU, Mem, Disk)

For the basic remote checks I compared several SNMP checks already available for
Nagios and finally moved on with the following:

  • Linux CPU: check_snmp_load.pl -H $HOSTADDRESS$ -C public -Tnetsc -w 80 -c 90 $ARG1$
  • Linux Mem: check_snmp_mem.pl -H $HOSTADDRESS$ -C public -N -w 80,30 -c 90,60 $ARG1$
  • Linux Disk: check_snmp_disk_monitor.pl -H $HOSTADDRESS$ -C public -w 75 -c 90 -m / $ARG1$
  • Windows CPU: check_snmp_load.pl -H $HOSTADDRESS$ -C public -Tstand -w 80 -c 90 $ARG1$
  • Windows Mem: check_snmp_storage.pl -H $HOSTADDRESS$ -C public -m Memory -w 80 -c 90 $ARG1$
  • Windows Disk: check_snmp_storage.pl -H $HOSTADDRESS$ -C public -m '^C:' -w 75 -c 90 $ARG1$

These contributed checks are available at href="http://nagios.manubulon.com/">nagios.manubulon.com (CPU Load, Mem,
Windows Disk), the check for the Linux Disk is included in the archive
containing the Nagios Plugins.

Tagged as: , 1 Comment
26Mar/090

Nagios SNMP

SNMP (at least running in Linux using the NET-SNMP) is providing enough data to setup checks for CPU load, idle resources, memory, disk and processes in Nagios.

I recently migrated a quite few nodes from purely SNMP-based monitoring into Nagios and this was possible without modifications on the nodes, since check_snmp (load, idle), check_snmp_process_monitor.pl, check_snmp_disk_monitor.pl and check_snmp_mem.pl (besides HTTP, SMTP, ...) provide all the checks I need.
This will run even over TCP, if UDP is a problem. And it's extendable by external commands, if you really need this, not talking about the AgentX interface.
Beware that you use a proper memory check, that can handle buffers and cache in Linux, otherwise you will run into a lot of false positives.
check_snmp_process_monitor.pl, check_snmp_disk_monitor.pl are included in the contrib section of the Nagios Plugins.
I found check_snmp_mem.pl at http://nagios.manubulon.com/.
But if anyone has an idea about getting the same scope of data for a Windows node by means of SNMP, any comment in this direction is appreciated.