Category Archives: Monitoring

Fix mdadm SparesMissing event detected

Sometimes when you create a RAID array using mdadm and do not specifically specify there are no spare drives available for the array, the mdadm monitoring daemon will report to you in daily emails that:

A SparesMissing event had been detected on md device /dev/md*

If you check your /etc/mdadm/mdadm.conf file, you’ll most likely find the ARRAY assembly line specifies an “spares” parameter that is non-zero.

To stop this daily nagging email message, just change the “spares” parameter to 0.

ARRAY /dev/md0 metadata=1.2 spares=0 name=<mymachine>:0 UUID=<myUUID>

The reload the monitoring daemon. In Debian:

service mdadm reload

Currently, that command will actually stop and start the daemon, rather than reloading it, but hey, who knows what the future modern world will bring?

Also, this is all assuming that you really do have no spares in your array, and the mdadm system just couldn’t believe such audacity, and concluded that you must have a least one that you just didn’t tell it about.

Fix for MRTG Generating SNMP_Session Error in Debian Wheezy (and possibly Ubuntu)

Lately, after an upgrade from Debian Squeeze to Debian Wheezy, MRTG is sending emails every few minutes when it runs from the crontab. This is quickly filling up my Inbox. There error message is as follows:

Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 149

After waiting for a while to see if a fix came from Debian, I decided to look around on my own. It seems there is a patch that works, but it has not been propagated out to the repositories. Luckily, this error problem is easy to fix.

You can apply the patch at the link above, or you can just edit a file and make 2 quick changes: Edit the file

/usr/share/perl5/SNMP_Session.pm

Change line #149:

old: import Socket6;
new: Socket6->import(qw(inet_pton getaddrinfo));

Then change line #609:

old: import Socket6;
new: Socket6->import(qw(inet_pton getaddrinfo));

That seems to fix the problem quite well. Hopefully the Debian maintainer will get that change in sooner that later so others don’t have to bother!

Note: Someone commented that the line numbers listed were a bit off from version to version of Debian. Not entirely unexpected. It’s the change to calling the class directly that counts.