Categories
Programming

Release of new utility: Bacula Reports 0.9

I write a lot of code, most of it unsuitable for release to the public but this little gem is worth a public release.

After using Bacula to backup all my servers (both Windows and Linux) for some time, the large number of mailings you get when using it on a small server park drove me insane. Even when using filters to sort out new mail, it is hard to see if everything is going as it should be.

Enter Bacula Reports: a mail aggregator for Bacula 2.x and 3.x.

Bacula Reports consists of a faux mail command (which does not send out reports by mail but rather analyses and stores them) and a report generator which aggregates all the stored reports into one mailing with an overview and some HTML styling to make it more readable (if you don’t want HTML, modify the template to generate plain text).

By integrating the scripts into the Bacula configuration at 2 points (a mail command used for sending out reports and a job to send out the combined report), the storm of daily mails changes into one neat report at the end of the backup cycle.

Normal error messages and operator messages are unaffected and will be delivered as they used to be, only the backup reports per job are redirected to Bacula Reports.

Requirements:

  • A linux server (32 or 64 bit, tested on CentOS 5.2 and Gentoo 2008)
  • A working Bacula 2.x or 3.x installation
  • PHP as a command line interpreter (run ‘php –v’ to see if you have it)
  • 10 minutes of your time to set everything up

The cool thing of the scripts is that they require only 2 small changes in the director configuration to reroute the status mailings and if you don’t like it or run into trouble, reverting is normally a matter of simply commenting out the modified lines and restoring the old ones.

One drawback for some people: it requires PHP on the command line (as stated before). The reason for this is very simple: I want to use the same code in the future for a web GUI and my unix-scripting skills are virtually non-existing compared to PHP or Java.

Even though its PHP, the scripts have a small footprint and run very fast – they should be easy to add to any existing Bacula environment.

{jd_file file==5} {jd_file file==6}

Categories
Linux / Gentoo Linux

Postfix Queues and Amavis trouble

After I had not received mail for a couple of days I suddenly started to receive postmaster errors from one of the servers I maintained. The message told me the mail could not be delivered. On further inspection it seemed that this was a problem because postfix could not connect to [127.0.0.1].

This meant of course that some daemon on the server was out for lunch and it was screwing up the mail deliveries. Using ‘postqueue -p’ to inspect the queues I found out that 4000 messages where packed up in the queue, filling her up to the maximum I allowed.

After running ‘postsuper -r ALL’ (which means, re-queue all messages for instant delivery) I tailed the ‘/var/log/mail.log’ file to find out that 20% of the messages got delivered and the rest wound up back in line.

One error that kept flashing by was: ‘TROUBLE in check_mail: parts_decode_ext FAILED: run_command (open pipe): Can’t fork at…’. It had something to do with the FileIO class. Now the message came from Amavis and in fact, amavisd is nothing more than a Perl framework, hooking all kinds of filters together. This means its memory hungry but won’t totally crash upon hitting the floor.

This explained why a part of the messages made it through: a few threads fitted in memory, allowing for completing the delivery, however most mail got rejected once again and returned faithfully to the waiting queue. Another inspection of the queue confirmed this: after 2 attempts 3200 messages where still there.

Then it dawned on me: I had not enabled the swap memory! After fixing this (and adding 1GB swap to the 256MB of RAM) and reloading Amavis I tried once again to requeue all mail. This time the mail got through the filters in one piece (and well within the memory boundaries). I wish all issues with servers were as simple as this ^-^.

Categories
Japan Blog Study Tour

Freestyle

Three weeks have passed and today (Saturday) was the last day that was semi-part of the study tour. After spending 2 hours of getting all my clothes folded up and packed again for transport I went to bed at 4 and got up at half past 7 (who needs sleep anyway in Japan?). I grabbed my suitcase, jumped into my clothes and headed for the elevator while some of my roommates wished me good luck (all three of them were headed back to Holland that day). I grabbed some coffee and white bread with strawberry jam for the last time (after one and half week eating strawberry jam its getting annoying) and after 25 minutes after my alarm went off I strolled into Tokyo.

Categories
Japan Blog Study Tour

NII and cheerleaders

IMG_3013 After an early start we started walking to NII which was supposed to be located at a thirty minute walk but for some reason we standing in front of the NII building after 5 minutes. Great. And ofcourse because we were way too early they weren’t ready to have us yet so we stood waiting in front of the building for 20 minutes or so.IMG_3018  The positive thing about this was that the sun was shining which is helping if you are still feeling a bit shaky and are carrying fever suppressing pain killers around.

Categories
Japan Blog Study Tour

High up in the sky

While I’m typing this, I’m flying above Syberia somewhere at 36500 feet or 11125 meter altitude while flying at 927 km/hour (I need to get one of these engines for my car :-P). We still need to go 3181 miles which will cost us 6 hours and 41 minutes – gotta love in-flight information systems.

But lets start at the beginning, I woke up at 11 o clock in the morning with a steady 7 hours of sleep (needed to make sure I brought enough music and movies along for the flight and the stay in general, so I was up late). After getting dressed with a cup of coffee and a long shower I managed to recheck the packing list to make sure I hadn’t forgotten anything. By the time I was almost done, my parents and my youngest sister dropped in to bring me to the bus and to wave me off.

Once at the gathering point (its 14:30 by now), we found ourselves short one touring car. After a while the last people finally arrived and the bus finally showed up. Ofcourse the bus driver didn’t drive all the way up to the gathering point, instead he parked at the end of the street, making us walk to the damn bus. We finally headed off in the right direction: Schiphol Airport!