Archive

Author Archive

Monitoring Tomcat with Munin on Debian GNU/Linux

June 20, 2013 Leave a comment

To monitor Tomcat with Munin 2.0 on Debian GNU/Linux (tested on Debian Squeeze with Tomcat6 and Debian Backports), you need the following steps.

First, you need to install package tomcat6-admin which enables the Tomcat Manager app we will be using.

# apt-get install tomcat6-admin

Next, create a user with a manager role in Tomcat, editing /etc/tomcat6/tomcat-users.xml and adding the following two lines in the appropriate list.

<role rolename=”manager”/>
<user username=”munin” password=”Munin” roles=”manager”/>

Restart Tomcat to reread its configuration and enable the newly-installed Tomcat Manager app.

# service tomcat6 restart

Configure the Munin tomcat_* plugins adding a file /etc/munin/plugin-conf.d/tomcat with the following content:

[tomcat_*]
  env.host 127.0.0.1
  env.port 8080
  env.user munin
  env.password Munin

Enable the tomcat_* plugins:

# cd /etc/munin/plugins/; ln -s /usr/share/munin/plugins/tomcat_* .

Restart Munin node:

# service munin-node restart

Enjoy!

Firefox 15 PDF Reader preview

September 1, 2012 Leave a comment

In Ubuntu, the shipped Firefox 15 comes with the new embedded HTML5 PDF reader disabled.

It is easy to enable though.

Go to “about:config”, search on “pdf” and switch the “pdfjs.disabled” entry to “false”.

Restart Firefox and test it pointing to some PDF URL.

In case it does not work, have a look at the “Portable Document Format (PDF)” type to action association in “Edit->Preferences->Applications” and set it to the internal Firefox preview.

Munin 2.0 on Debian

June 25, 2012 3 comments

Munin 2.0 has been released and packaged for Debian, and even backported to Squeeze (from backports.debian.org).

Even though there are still some quirks in this version (or just the Debian packaging), it is far better (more scalable, more powerful and prettier) than version 1.4.

Basically, the following article should cover it all: http://munin-monitoring.org/wiki/CgiHowto2, but doesn’t quite achieve it, so far.

Let’s see together how to install it successfully on Debian Squeeze. I will however not cover the agent (Munin Node), as there is no significant difference between basic installation of its 1.4 and 2.0 versions.

As a first significant performance improvement, Munin is now able to use RRDcached (it fairly reduces the disk I/O pressure on RRD files), and it is fairly easy to setup. Just install package rrdcached (who would have guessed?), then add the following options to OPTS in /etc/default/rrdcached:

OPTS="-s munin -l unix:/var/run/rrdcached.sock -b /var/lib/munin/ -B -j /var/lib/munin/journal/ -F"

This will override its defaults. And of course, restart then the daemon.

Adapt /etc/munin/apache.conf to your likings, in this case, we are going to uncomment all cgi and fastcgi-related blocks.

Install packages libapache2-mod-fcgid and spawn-fcgi, then download the following script and install it as an initscript on your system (e.g. as /etc/init.d/spaw-fcgi-munin-graph and running insserv):

http://files.julienschmidt.com/public/cfg/munin/spawn-fcgi-munin-graph (though this version is still buggy and quite fragile, contact me for a slightly improved version)

apt-get install libapache2-mod-fcgid spawn-fcgi

Add user munin and www-data to group adm, and allow group adm to write to /var/log/munin/munin*-cgi-*.log:

adduser munin adm
adduser www-data adm
chmod g+w /var/log/munin/munin*-cgi-*.log

Add user www-data to group munin and the opposite:

adduser www-data munin; adduser munin www-data

Start the spawn-fcgi-munin-graph service and check it is indeed running.

Enable the fcgid and rewrite Apache modules and restart the Apache2 service.

Customize /etc/munin/munin.conf to your likings, enabling the (Fast)CGI parts.

Whenever monitoring more than a single host, I recommend moving (i.e. commenting and copying) the localhost definition to some new /etc/munin/munin-conf.d/ file per domain (e.g. beeznest.conf), and add your hosts there, with a meaningful domain name.

HOWTO Build your own binaries of PHP Xapian bindings for Debian

July 6, 2011 9 comments

Due to a licensing issue, the PHP bindings for Xapian were removed from Debian Squeeze. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513796 for more information about this.

Though, it is not really hard to build your own package from source.

Here is how:

sudo apt-get build-dep xapian-bindings
sudo apt-get install php5-dev php5-cli
apt-get source xapian-bindings
cd xapian-bindings-1.2.*
rm debian/control
env PHP_VERSIONS=5 debian/rules maint
debuild -e PHP_VERSIONS=5 -us -uc
cd ..
sudo dpkg -i php5-xapian_*.deb

Be careful: the extracted source directory (xapian-bindings-1.2.*) has to be absolutely clean, so if you tried a first time and it failed, remove the whole directory before trying again.

Of course, the same procedure holds true for Ubuntu as well.

2012-12-23 edit: if you’re using PHP 5.4, you need to modify the debuild line. Check the update article on Xapian’s wiki

To enable the extension, don’t forget to create a xapian.ini  (or 20-xapian.ini for the latest Ubuntu with PHP 5.4) containing “extension = xapian.so” in /etc/php5/apache2/conf.d/, then restart your web server.

Adobe Flash and V4L2 webcams

July 2, 2011 1 comment

Many new videoconference systems nowadays are Flash-based. Of course, the main input for them is some sort of video device (e.g. a webcam).

Under Linux, the framework responsible for this is Video4Linux (V4L), of which version 2 (aka V4L2) is current. That means that most recent webcams drivers are supported only by V4L2.

Alas, some proprietary editors (of which Skype and Adobe with Flash) still only support V4L1. If you’ve got a webcam with V4L2-only driver, you’re out of luck.

Recently, Adobe announced, Flash’s support of V4L2 on Linux beginning with 10 Beta, but they got something wrong. On my Philips SPC 315NC as an example, it is detected (in Flash’s Settings), but does not work (not activated), while it works perfectly with other programs (of which Cheese). On my Logitech QuickCam Express, it is not even detected by Flash.

Some complicated solutions are available on the Net, some based on some Gstreamer loopback-conversion from V4L2 to V4L1. Example: http://www.jtolds.com/newsletter/2008/7/27/how-to-get-v4l2-devices-to-work-with-flash

Though, there is a simpler solution I just found out: V4L2 is shipped with a compatibility-layer library. On my Ubuntu, it is to be found in /usr/lib/libv4l/v4l1compat.so.

So, using the mechanism to force loading this library, you will get your V4L2 webcam supported by Flash in your browser.

Example with Firefox:

LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so firefox

And of course, probably any other software suffering the same kind of flaw.

Enjoy!

HOWTO Rename Munin node without losing history

June 13, 2011 4 comments

This howto describes how to rename a Munin 1.4.x node and/or move it to another domain without losing history, because just renaming the node in /etc/munin/munin.conf will actually just create a new host. It has been tested on Debian Squeeze (would work on Debian Lenny too, at least when using 1.4 backports). You will need at least a basic understanding of how to configure Munin to use it.

  1. Stop the cronjob (rename the /etc/cron.d/munin to something with a dot in the name, e.g: /etc/cron.d/munin.disabled)
  2. Rename the RRD files. The following command does the job (actually, moved the files by hand to the right directory after renaming them):
    for file in /var/lib/munin/localdomain/*.rrd; do mv $file `echo $file|sed ‘s/localhost\.localdomain/saidhost\.example\.net/’`; done
  3. Edit /etc/munin/munin.conf to change the node name accordingly
  4. Enable back the cronjob (renaming /etc/cron.d/munin.disabled to /etc/cron.d/munin)
  5. Wait at least 5 minutes (the time for munin-update to run at least once)
  6. Depending on your setup (if you are using Munin’s CGI mode), you might need to update some file and/or directory permissions
  7. Go to the web interface to check the result
Categories: English, Techie

HOWTO Use gThumb to rename pictures in Ubuntu 10.10 (Maverick)

March 22, 2011 1 comment

I’m used to gThumb to rename lots of pictures from camera’s filename to something including the date, hour taken and a sequence number, like this one: 2011-02-27–16.24.51_007.JPG.

Basically, simply select pictures you want to rename and press F2 (or Edit->Rename).

Previous to version 2.11, gThumb was using a vastly simpler syntax expression for renaming (they name it Template in the Rename dialog). With 2.11 and up, to get the same, I now have to use the following expression:

%D{%Y-%m-%d–%H.%M.%S}_###%E

Please also note that when changing the Rename dialog, they also made it far slower for fair number of pictures (it might take minutes before the Rename dialog appears). For those who know me, I reported the bug in Launchpad as Pictures renaming slower.

Categories: English, Uncategorized

HOWTO Install Sun’s JAVA on Ubuntu Lucid Lynx (10.04)

April 23, 2010 17 comments

After Ubuntu’s decision to default to OpenJDK for 10.04 (which is a good decision, IMHO), Sun’s (but is it still Sun, or Oracle?) JAVA somewhat “disappeared” from Ubuntu (multiverse).

That being said, some people may still need features only available in Sun’s JRE/JDK, which might not yet have been Freed.

Actually, Ubuntu is still shipping it, but in its “partner” section. To add that section to your Sources and install Sun’s JDK (as an example), just:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

You might need to accept the license (press “tab”, “enter”, “tab” on “Yes” then “enter”).

You might also just want to install sun-java6-jre or sun-java6-plugin if you just want the (Mozilla) web browser plugin.

As a side note, remember to remove OpenJDK if you do not need it, or be prepared to encounter hard to diagnose problems sometime.

sudo apt-get remove openjdk-6-jdk openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib

Ubuntu 11.10: same operation. Just replace “lucid” por “oneiric”

Categories: English, GNU/Linux, ubuntu Tags: , ,

Using Intel ATOM as OpenSolaris NAS engine

April 4, 2010 1 comment

I  recently started searching for a power- and price-efficient engine for modest-sized NAS, running OpenSolaris (Nexenta) of course.

The idea to go to Intel ATOM first comes from their high power efficiency (1-13W TDP). To really benefit from it, do not only take into account the power used by the CPU, but also the whole motherboard (you know, chipset and GPU [Graphic Processing Unit]).

ATOM is supposed to dissipate so little heat that a fan might not be necessary, so most motherboards for ATOM ship with passive/fanless cooling. I still wonder if it should not rely on some cooling offered from the case itself, especially when mechanical disks are part of the equation.

To fully benefit from OpenSolaris, and ZFS, a 64-bits CPU is recommended, and multiple cores would benefit a ZFS NAS without any doubt. So we are left with two families, or rather generations, (this is a shortcut, but it makes sense given the tiny pricing difference), the ATOM 330 and the ATOM D510 (have a look at http://en.wikipedia.org/wiki/Intel_Atom). At first glance, they are quite similar, except the D510 embeds a GPU on-die, which means its 13W TDP is about all it gets, while a 330 motherboard as a whole (including an added GPU) will significantly draw more power than the 8W advertised. And honestly, we don’t care about the performances of this GPU.

Then, most motherboards are somewhat limited in size, which means many extensions are just not available here:

  • RAM slot number (many times they are even SO-DIMM ones) and speeds, and lack of ECC support
  • PCI(e) slot number
  • SATA/PATA connectors
  • NIC numbers

Note that despite the restricted on-board size, most motherboards present a lot of different external connectors (USB, DVI, D-SUB, PS/2, IEEE 1394, …).

And finally, most motherboards only ship in mini-ITX form-factor, which is not even really compatible with (micro)ATX, though some claim it (is this real, I honestly can’t tell). This clearly makes it difficult to find an inexpensive, yet solid, case to host it.

Compare all that to regular AMD or Intel CPU and motherboards pricings, and you will see what I mean in this article.

So Intel’s ATOM is (not yet) wonderland for OpenSolaris-based NAS today. But I will probably try some day anyway. ;-)

Installing Squid on ZFS

March 24, 2010 1 comment

The recommended filesystem for Squid on OpenSolaris is ZFS: http://wiki.squid-cache.org/BestOsForSquid

It is also recommended to disable the atime property on the filesystem holding the cache, and you may want to avoid using any type of RAID.

To achieve this on Nexenta (or OpenSolaris, whatever), first create the ZFS filesystem:

# zfs create -o atime=off -o mountpoint=/var/spool/squid3 syspool/squidcache

Then install Squid (here for version 3.x, as you might have noticed from the command). On Nexenta Core Platform 3 (NCP3):

# apt-get install squid3

To further improve the setup, use the aufs storage. To do this, just enable and update option cache_dir in /etc/squid3/squid.conf to read aufs instead of ufs (and further modify that line to best suit your real cache usage).