Category Archives: english

Paving the road from CRITICAL to OK

Imagine you have an issue on your mail server. It’s an intricate issue, one of those whose origin may be difficult to track because it lies on the lowest levels of the system: mail server runs on a legacy operating system inside a virtual machine on top a modern host that attaches disk images from a clustered storage system, connected into a fast network and receiving user requests via load balanced tunnels, etc.

There are so many parts running this setup that figuring out what happened could be a lot of effort, so the first thing that comes to your mind are the metrics collected by Munin (aha! let’s find some correlation of events in those graphs). So, you open the Munin web pages and you discover that it’s been 3 days since graphs were last updated. You think that maybe the state files were updated and you just need to rebuild the graphs… Bad luck, again.

How could this happen and nobody noticed? You think that we need to add some Nagios checks for the Munin lock files, so you get a warning or critical alert if it’s been too long since last update, right? Then you discover that the check is already there and it’s been moaning every single one of those 3 days that Munin wasn’t being updated. Well, it happens that Munin is not a core service, it’s only useful once in a while, though it can be very frustrating not having it when you actually need it. Thus, nobody payed attention to that alert because nobody needed Munin at that time and there were other alerts more pressing. So, what will happen next time?

Okay, you promise that next time you’ll pay more attention to those critical alerts and see that Munin needs an intervention. Are you happy with that? I’m not. I believe that errors caused by humans raise defects on the underlying system being operated. Also, I believe that repetitive work is a bad approach to solve any issue. Automation makes IT better.

In this particular case, Munin fails to remove its locks sometimes for whatever reason (it may well be that there’s something caused by our configuration, but it’s not worth the trouble to debug it because it only happens a few times a year). When it happens though, Nagios checks send alerts and the person on call should connect to the Munin server and just remove the locks. That’s just it, remove the locks. Therefore, I added an event handler to those Nagios checks that will remove the lock next time is gets too old. The critical alert will be triggered anyway and that’s good because it’s a critical event that should be recorded, but the system will take care of that immediately and very soon it will be OK again.

Now I’m wondering how many of our critical alerts could be automated like this. I’m sure that not all of them will be that easy to automate, but what if most of them are? Well, I won’t start adding random event handlers everywhere. I’ll wait for the next issue that raises an automation opportunity because I’m a huge fan of small steps. I hope you’ll do the same.

My Free Software Activities in Jul-Sep 2017

If you read Planet Debian often, you’ve probably noticed a trend of Free Software activity reports at the beginning of the month. First, those reports seemed a bit unamusing and lengthy, but since I take the time to read them I’ve learnt a lot of things, and now I’m amazed at the amount of work that people are doing for Free Software. Indeed, I knew already that many people are doing lots of work. But reading those reports gives you an actual view of how much it is.

Then, I decided that I should do the same and write some kind of report since I became a Debian Developer in July. I think it’s a nice way to share your work with others and maybe inspire them as it happened to me. So I asked some of the people that have been inspiring me how do they do it. I mean, I was curious to know how they keep track of the work they do and how long it takes to write their reports. It seems that it takes quite some time, it’s mostly manual work and usually starts by the end of the month, reviewing their contributions in mailing lists, bug trackers, e-mail folders, etc.

Here I am now, writing my first report about my Free Software activities since July and until September 2017. I hope you like it:

  • Filed bug #867068 in Cannot claim account after former SSO alioth cert expired.
  • Replied a request in private mail for becoming the maintainer for the Monero Wallet, that I declined suggesting to file an RFP.
  • Attended DebConf17 DebCamp but I missed most of Open Day and the rest of the Debian conference in Montreal.
  • Rebuilt libdbd-oracle-perl after being removed from testing to enable the transition to perl 5.26.
  • Filed bug #870872 in Server Error (500) when using a new SSO cert.
  • Filed bug #870876 in make subscription easier to upstreams with many packages.
  • Filed bug #871767 in lintian: [checks/cruft] use substr instead of substring in example.
  • Filed bug #871769 in reportbug: man page mentions -a instead of -A.
  • Suggested to remove libmail-sender-perl in bug #790727, since it’s been deprecated upstream.
  • Mentioned -n option for dpt-takeover in how to adopt pkg-perl manual.
  • Fixed a broken link to HCL in
  • Adopted libapache-admin-config-perl into pkg-perl team, upgraded to 0.95-1 and closed bug #615457.
  • Fixed bug #875835 in libflickr-api-perl: don’t add quote marks in SYNOPSIS.
  • Removed 50 inactive accounts from pkg-perl team in alioth as part of our annual membership ping.

Happy hacking!


Notes from FOSDEM

Going to FOSDEM has always been a mix of feelings: is that time of year when you meet many friends from the Free Software community, you learn some interesting things that you didn’t know about, you share some knowledge, and you may have a fair amount of chocolate and beer in a usually cold weather.

Sometimes talks are not what they seem, and oftentimes you can’t get into a room because it’s full. But there’s always the chance to learn something new, so here’s my list of notes:

  • Play etcd if you want to try it and see what happens when you make changes.
  • Minikube: mini Kubernetes for developing on your laptop.
  • Software Heritage API is publicly available.
  • OpsTheater offers a stack for IaaS with Puppet, Foreman, GitLab, Icinga, ELK+Graphana, Mattermost (integrates easily with GitLab).
  • Recommendation: move things from Hiera to Foreman smart parameters. Debugging Hiera can be a nightmare if you have hundreds of YAML files.
  • octocatalog-diff compares two Puppet catalogs without deploying the changes. Facts are not live and changes in providers won’t show. A Foreman plugin is available too as a proof of concept.
  • Puppeteer helps find configuration smells that violate recommended best practices.
  • Legacy docs are big, comprehensive, and feature based. Modular docs are lean, concise, targeted, and user-story based. Content rot makes docs hard to find and navigate. Document only what users need, as user stories.
  • Perl6 grammars make it easy to implement informal DSLs. Reading recommendation: Domain Specific Languages, by Martin Fowler (2010).

Happy hacking!

Config Management Camp

This was my first time at the Config Management Camp in Gent and I had a great time and you’ll see from my notes below that it was definitely worth it.

Day 1

  • Recommendation: use find-nodes from PuppetDB with i parallel SSH (pssh).
  • Services resiliance depends on human resiliance (HumanOps).
  • tiny puppet installs applications on any OS (slides):
    • e.g. tp install puppetdb
    • tinydata is the default source for application data.
  • Vox Pupuli maintain abandoned puppet modules.
  • Reading recommendation: Thinking in Systems: A Primer, by Donella Meadows.
  • Puppet extensions:
    • Ruby functions can take lambda arguments.
    • dalen-puppetdbquery query_resources function to find other nodes resources.
    • Puppet faces allows new puppet subcommands (dalen-puppetls).
  • Foreman unknown gems (slides):
    • Foreman hooks plugin.
    • Trends show changes over time.
    • Bookmark searches. Puppet can ask the search API for information with puppet-foreman module.
    • Class import has rules to hide things in the UI.
    • hammer ssh -c ‘uptime’ -s ‘architecture=…’
    • foreman-rake hosts:scan_out_of_sync
    • There are several Foreman UI themes.
    • API docs are available in your Foreman instance as http://foreman/apidoc
  • Types and providers:
    • require “wirble” in ~/.irbrc
    • Pro tip: use Puppet types and providers for managing web APIs.

Day 2

  • Inspiring story by Annie Hedgpeth, My Journey Into Technology Through Inspec (video).
  • Getting data to the end user:
    • Memex maps the Dark Web.
    • NASA beards like GitHub, sysadmins don’t.
    • juju allows users choose their applications, configure and scale them.
  • Someone mentioned that libral (a native Resource Abstraction Layer) seemed interesting.
  • Quality automation with rudder-dev (slides)
  • undef: refactoring old puppet code (slides)
    • Puppet 3.x is EOL.
    • Hiera overload, bloated YAML. Clean it up!
    • Lack of validation/CI:
      • Syntax error should not be deployable.
      • Fix style with puppet-lint -f
      • rspec-puppet to test special cases.
      • Beaker or Test Kitchen for acceptance tests.
    • VCS top notch:
      • Make it easy as possible to avoid mistakes.
      • Put full context in the commit message.
      • Use the body to explain what and why, not how.
      • Commit often, perfect later, publish once.
      • The git pickaxe shows you how to find any text in the commits.
      • GitMagic helps setting contribution guidelines.
    • Make newbie experience better:
      • Start with control-repo.
      • Pick supported forge modules, then pick approved ones.
      • puppet module skeleton
      • Write as little as possible.

Hope you find the notes useful. Let me know if you have any questions.


Packaging SoftiWARP kernel module for Debian

One of the HPC clusters we have at work has a mixed set of nodes: a few of them have InfiniBand interfaces and the others don’t. A few weeks ago we were requested to install the SoftiWARP kernel module on those nodes that lack the InfiniBand interface. We had already tried to build the module from source and it worked well, but now the challenge was to install it as a Debian package with DKMS, so it would be built for all installed kernel versions on each node.

We use Puppet to manage cluster node configuration, so you may wonder why not using Puppet instead. Well, for one we’re talking about installing the source of a kernel module, with no configuration at all. But there’s also the fact that Puppet delegates to package providers the management of software, which know much better how to deal with software upgrades. Lastly, there’s the challenge of learning something new: though I had previous knowlegde of DKMS, I had no idea on how to make a Debian package out of it.

Fortunately, I found Evgeny Golov‘s DKMS playground on Debian wiki. With those tips and my recently updated experience on packaging Perl modules for Debian, I was confident enough to try my first DKMS Debian package. Actually, it came out quite easy: I just had to adapt debian/rules a bit to accommodate modern debhelper best practices:

#!/usr/bin/make -f
sversion:=$(shell dpkg-parsechangelog|grep "^Version:"|cut -d" " -f2|rev|cut -d- -f2-|rev|cut -d':' -f2)
    dh $@
    dh_installdirs -p$(pdkms)  usr/src/$(sname)-$(sversion)
    cp -a *.txt Makefile *.c *.h debian/$(pdkms)/usr/src/$(sname)-$(sversion)
    sed "s/__VERSION__/$(sversion)/g" debian/ > debian/$(pdkms)/usr/src/$(sname)-$(sversion)/dkms.conf

Funny enough, I spend more time filling the details on debian/copyright and debian/control files than actually setting up DKMS, so big kudos to Evgeni!

Take a look at the full debian packaging for further details. You may notice that this package has a dependency on libsiw-dev (SoftiWARP userland library), which I had to package first and was a bit trickier. More on that next time.

Please mount Volume or label a new one?

A Monday morning we found several messages like this from Bacula:

09-Sep 18:27 Tape-A JobId 15196: Please mount Volume "A0000038" or label a new one for:
    Job:          sites.2012-09-08_01.50.03_40
    Storage:      "LTO-4" (/dev/nst0)
    Pool:         Default
    Media type:   LTO-4

That was Bacula complaining about the wrong volume on the drive. However, after examining the status of storage the weird thing was that the tape with barcode “A0000038” was actually mounted on the drive, it was purged and had 0 bytes used… WTF?

We started suspecting our tape rotation algorithm was not taking into account that maybe purged tapes were not used if data retention hadn’t expired, but Automatic Volume Recycling says otherwise and some tests on other purged tapes with expired data retention failed too.

Several days of searching similar issues later, it seemed clear that there was something wrong only with some purged tapes from the media catalog. So i came up with a quick test for each one of our purged tapes in order to make sure that they were labeled correctly. First, i loaded “A0000038” and read its label:

# mtx -f /dev/sg4 load 22
Loading media from Storage Element 22 into drive 0...done
# dd if=/dev/nst0 bs=65000 count=1 | od -a | head
0+0 records in
0+0 records out
0 bytes (0 B) copied, 3.81024 s, 0.0 kB/s

You can see that it failed to find any Bacula label, so next i tried the same test with another tape in full state that had been used the day before:

# mtx -f /dev/sg4 load 16
Loading media from Storage Element 16 into drive 0...done
# dd if=/dev/nst0 bs=65000 count=1 | od -a | head
0+1 records in
0+1 records out
64512 bytes (65 kB) copied, 3.73563 s, 17.3 kB/s
0000000   G   ;   =   < nul nul nul   D nul nul nul nul   B   B   0   2
0000020 nul nul stx  gs   L etx   O sub del del del   ~ nul nul nul nul
0000040 nul nul nul 240   B   a   c   u   l   a       1   .   0       i
0000060   m   m   o   r   t   a   l  nl nul nul nul nul  vt nul eot dc3
0000100   1   8   O  si  ff nul eot dc3   J   +   W stx   p nul nul nul
0000120 nul nul nul nul nul nul nul nul nul nul nul nul nul   A   0   0
0000140   0   0   0   0   6 nul nul   D   e   f   a   u   l   t nul   B
0000160   a   c   k   u   p nul   L   T   O   -   4 nul   v   m   -   h
0000200   o   s   t   -   4 nul   T   a   p   e   -   A nul   V   e   r
0000220   .       5   .   0   .   1       2   4       F   e   b   r   u

(Note that device /dev/nst0 has a minimum block size of 64512 bytes, otherwise dd would raise a Cannot allocate memory error.)

This time the Bacula label was found on the tape (the Bacula 1.0 immortal string is a clue), so we were now on the right track. Then i reviewed our wiki for the tape change procedure and there was an optional step in the tape purging section explaining how to blank a tape from another Bacula director before labeling it for this one. Therefore, it seemed that someone had been blanking the tapes after purging them and Bacula didn’t know what to make with them even though they had the right barcodes.

The fix was quick: i tested every purged tape to make a list of the blanked ones, then deleted them from the catalog and labeled them back from the bconsole:

* delete volume="A0000038"
* label barcodes slots=22 pool=Default

Bacula is happy again, and we are too! 🙂