Monitoring Brocade FC switches with Nagios

The last four days I spent looking for ways on monitoring a Brocade Fibrechannel switch (in my case IBM 2145 B32/F40). The first thing I came up with, is using SNMP. As it was already configured for the previous monitoring with Munin, getting information should be quite easy. After looking through Google for a bit, there is already one script that worked for me.

Only trouble I had with that script, is that it crams every single port into one result. As I wanted something, that a) could watch a single port and b) return performance data, I went ahead an used the script to do a basic rewrite. But after a short while, I grew antsy and started writing a script from scratch, using the OIDs I got from that script and a Cacti template.

So far, I got a good plugin, but it’s still lacking a few things:

  1. Support for warning/critical thresholds for each error category
  2. Sadly the important errors (er_link_fail, er_loss_sync and er_loss_sig) are kept in a separate table structure (swEndDeviceRlsEntry), which I can’t seem to access right now; even though the entries are mandatory and according to the MIB should be at least read-only.
  3. The plugin isn’t doing a proper $session->close(); . After moving the snmp stuff into a subroutine, Perl refuses to do the session closing. Don’t know why right now.

Right now, the plugin supports two modes. The first just checks if the port is operational and in sync and the second checks the port status, but also returns the performance data.

Only do a basic check if the Port is in operational status

Check the port status, but also return performance data

That might look like much, but Nagios is gonna pass everything after “|” to your performance data command.

List of OIDs, which hold the various information:

The last three OIDs, as well as the ones in FCMGMT-MIB (as I mentioned in the TODO), sadly don’t exist (or I’m doing something wrong ? — no clue right now), so I can’t incorporate them into the script at this time.

However, I found something in a separate OID-tree (also the FCMGMT-MIB), which seems to be exactly what I’m looking for.

Only trouble with those OIDs is, that they are OCTET STRING’s, which right now just return crap (either nothing or just a new-line) with my script. Gonna have to work on that.

If you’re interested in the Perl script (for now, lacking some options, performance data, $session->close();), you’ll find it here.

PXEBoot the VMware ESXi installer

Some of you may know, that VMware released vSphere 4.0 Update 1 yesterday. I took this as a reason, to finally wrap my head around booting the VMware ESXi installer from my PXE/TFTP box. Since VMware was kind enough to provide (a somewhat worthless) document, that explains how to extract the necessary files on Windows. But that quite doesn’t work with Linux — and VMware just states that you should be using mount and it’s option offset.

Luckily there are smart people around. Cameron shows exactly as to how you’d mount the dd-image. If the dd-image is mounted, you just need to copy over cim.vgz, license.tgz, oem.tgz, sys.vgz, vmk.gz and vmkboot.gz. After doing so, you should add a section to your pxelinux.cfg that kinda looks like this:

Just make sure, everything following APPEND and before IAPPEND is in a single line.

Custom Keymap.xml with XBMC

If you intend to use a custom Keymap.xml with XBMC you might need to be aware of a change that recently happened. Up till now the Keymap.xml was placed in ~/.xbmc/keymaps. Recently (not exactly sure, which svn revision it changed) although it changed.

Since r21442 (that’s after the current 9.04.1 release), the default keymapping files are stored in the system/keymaps/ subfolder of your installation. To alter the default keymapping simply add one or more xml-files in the Userdata/keymaps/ folder with the changes you wish to make. If the keymaps folder doesn’t exist, create it. For backwards compatibily, Userdata/Keymap.xml is still read.

If you place the Keymap.xml in ~/.xbmc/keymaps you’re gonna see weird things happening. Basically, most commands work however not everything. Once you move the keymap.xml to ~/.xbmc/userdata/keymaps, everything magically starts working again.

Linksys WUSB600N on Ubuntu

Since I recently moved, I also needed to make a few changes to my home setup. Up till now, I always had a wall or a border where I could hide the CAT5/CAT6 cable for my boxen. But my new flat has doors everywhere. So I decided to buy two Linksys WUSB600N for my XBMC-box as well as for the NAS-box.

The setup was pretty straight forward, I didn’t have to fiddle with it too long. The only thing I had to do, was setup wpa_supplicant in /etc/network/interfaces, as the router supplied by my provider comes with WPA2 enabled (which is a good thing).

Additionally, I just reinstalled my NAS-box with Karmic Koala. That gave me a bit of trouble, since apparently since Jaunty they included new drivers for the ralink-devices (namely rt2800usb and rt2x00usb). These two sadly don’t work with the WUSB600N, so I had to blacklist them (/etc/modprobe.d/blacklist-ralink.conf in my case).

Configuring nagios-plugins-zypper

Since I’m running check_zypper via nrpe (which in turn runs as nobody), I need to set up sudo. In order for the plugin to work, we need to add the following line to /etc/sudoers (by means of visudo):

(Keep in mind this needs to be a single line …)