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!

Advertisements

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
%d bloggers like this: