Monitoring Brocade FC switches with SNMP/Nagios

I looked into the mess a bit more, and as it turns out, the weird crap I was talking about only happens if you have a port with LossofSynchronization, LossofSignal or LinkFailures value with the base of ten (i.e. 10, 101 or 10.000).

Additionally, the OID’s for those three failure elements seem to be dependent on the firmware version, as with 6.3.x they appear as different OIDs. So I may need to introduce another command-line switch, which selects the firmware version and depending on that, the OID.

Even despite those problems I just described, I ended up using the plugin to watch our SAN infrastructure. I even wrote a simple pnp4nagios template, so all the data would show up in a single graph and not a graph per data source.

check_snmp_brocade_fcport Graph: 4 Hours
check_snmp_brocade_fcport Graph: 4 Hours

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 …)

SVC: Migrate VDisks off a MDisk Group onto another

Out of necessity, another SVC shell script was just born. If you ever need to migrate a whole MDisk group onto another, you quickly discover the limited application of the SVC GUI. Now, you could query the VDisks using your original MDisk Group and then copy and paste the VDisk’s name (or the VDisk ID) into a command line and simply reuse that svctask migratevdisk command over and over.

Luckily IBM blessed the SVC with an SSH interface. So again, we can write a (kinda) simple shell script which may look like this:

And the execution would look like this:

Or maybe:

ESX: Query CDP information from the command line

I’m just tracing some troubles I’m having with a backup server and two (independent) network adapter ports (as in two ports on two different dual-port nics). If I enable the port and set it to auto configuration, it’ll get 100MBit/Half-Duplex, but the Portgroup becomes unavailable.

In order to get the connection back, I need to logon on the console (thank god even the backup server got an iLO2), and manually (as in esxcfg-nics -s 1000 -d full vmnic1) configure the adapter to 1GBit/s and full-duplex.

Since I didn’t want to go downstairs and trace the damn cables, I figured I could use the CDP features included in ESX. Turn the NICs on as 100MBit/Half-Duplex and run:

That’s all the networking guys should need. Switch’s IP-address and the Switch Port where the card is connected to. *Tada*.

Update: with ESXi 5.1, it’s just vim-cmd …

RPM: Query a specific rpm-file for information

Since I end up googling it each time I need this, it’s about time I write it down … If you want to query a specific RPM for information (Requires/Information/…) you’ll need to use the –package/-p option.

-p <file> — Query a Specific RPM Package File

Up to now, every means of specifying a package to an RPM query focused on packages that had already been installed. While it’s certainly very useful to be able to dredge up information about packages that are already on your system, what about packages that haven’t yet been installed? The -p option can do that for you.

So, if I wanted to show the Requires of my vmware-tools-kmp: