all about tag: Klugscheissen

monitoring the real user experience

The Problem

You may know a lot of site monitoring tools like Nagios, BigBrother, Cacti etc. But none of them can measure a near real user experience. We often have the case that someone is complaining about slow page loading. But all of your monitorings and measurement tools show normal performance of the site. Most of the tools are capable of fetching urls. But none of the tools I know behaves like a real browser. Thus doing the real loading of the page, all it’s elements and includes and rendering the page in fact.

But with a little scripting and a Linux system you can do just that.

The Solution Idea

So we like to have a site monitored as realistic as possible from a users point of view. Why not use a real browser to monitor the site performance? The trick is, to use Firefox to render a page and simply measure the time it needs to complete.

Why Firefox you ask? Because Firefox is free. You can control it via the command line (scriptable) and it got some usefull add-ons we’ll need. And – it’s very popular.

The solution itself

To run firefox you need a graphical user interface e.q. the X11/X86org environment. But this is not what we want for automatic continous measures. So we need a way to run Firefox in headless mode. Unfortunatly Firefox itself has no option to run it without a valid DISPLAY. This is where Xvfb comes in handy. This is a virtual frame buffer daemon for Linux. It simulates a X-Window server but doesn’t need a real/physical graphical output system. So you can run this on your server without a video card and tell Firefox this is your X-Server.

You can even run your normal X-Server and the Xvfb in parallel on your system. Just start Xvfb on a different Port:

/usr/bin/Xvfb :2

Then tell Firefox where the DISPLAY is:

firefox –display=127.0.0.1:2.0

But first we have to pimp Firefox a little bit. When you open Firefox via the command line and give it a URL this Page will be opened and rendered. But to measure the time for that in a script we need Firefox to close itself after successfull rendering. Then we can measure the whole time with the systems “time” command. OK, this will also count the startup and shutdown time of Firefox. But these times should be almost constant on your system. So if you like, you can measure these times in more detail and substract them from the page render times.

To have Firefox close after rendering the page and to have a proof that the page was rendered correct we use the PageSaver Add-On to Firefox. This add-on enhances Firefox to take screenshots of the whole page and save it to a jpeg file. Even more, you can control this add-on from the command line as well.

Put all this together and you have a browser which can be startet on a headless system (with Xvfb), given an url to render, renders the page, saves the rendered page as an image and closes. Perfect!

Now put a little shell scripting around and put the measured times into an RRD file, generate graphics with rrdool and you get a nice near real site performance monitoring.

Firefox Monitoring with RRD

This is my dirty script: make_screenshot_new.sh
The script to create the RRD files: create_screenshot_rrd.sh
The script to generate the graphs: make_graphs.sh

After creating the RRD file your can call the make_screenshot_new.sh periodically via Cron to measure the render times. But make sure the interval correspond with the interval you set in the RRD file


when RPM can save your ass

There are very rare times I like the RPM package management or a redhat system. But today this save my ass. Someone or something did a “chmod 777 /” on one our machines…

This normaly leads to immediate excution of this person. But anyhow I had to deal with this and recover the machine. Almost none of the system daemons startet and even a console login wasn’t possible due to wrong permissions of vital files.

The solution was a very simple shell script. The RPM database contains information about the permission of all packages. These permission can be re-applied:

#!/bin/sh -x

for package in `/bin/rpm -qa`; do
/bin/rpm -qv --setperms $package
done

So simply boot in single user mode and create this little script an run it. This should repair all the necessary permissioins.


Was soll man dazu noch sagen…

Gut gesprochen Internet: http://frank.geekheim.de/?p=402 als Reply auf: http://www.heise.de/bilder/106992/0/1


TED Talks: Barry Schwartz: The Paradox of Choice

Auf dieser Webseite gibts eine Menge Video von Voträgen schlauer Leute. Z.B.:

TED Talks: Barry Schwartz: The Paradox of Choice:
Video of a great talk by psychologist Barry Schwartz at TED.
Gefunden bei: Daring Fireball


Scheisse – Adrenalin-Junkies

Habe heute das neue Buch von Tom DeMarco & Co. bekommen. Es heißt “Adrenalin-Junkies und Formular-Zombies – Typisches Verhalten in Projekten” und handelt eben davon. Das Team um DeMarco, der mich schon mit seinem Roman “Der Termin” begeistern konnte, hat sich die Mühe gemacht und versucht verschiedene Typen von Projektteams zu kategorisieren und zu Beschreiben.

Gleich im ersten Kapitel “Adrenalin-Junkies” musste ich frappierende Ähnlichkeiten mit unserer Projektarbeit feststellen. Das muss sich ändern…

Das Buch ist leicht verständlich und kurzweilig geschrieben und bietet gute Denkanstöße. Viele Dinge werden einem bekannt vorkommen und doch ist es gut, sie mal ausformuliert vor Augen zu haben.

Ich werde nach forgeführter Lektüre berichten.


neues aus der Serie “I love Unix”

Man hat eine neue Maschine und möchte schnell seinen SSH-Key dort unterbringen. Das geht mit nur einmal Passwort eingeben so:


#!/bin/sh

host=$1

cat ~/.ssh/id_dsa.pub | ssh $host "(tee > ~/public.key; mkdir ~/.ssh; chmod 0700 ~/.ssh; cat ~/public.key >> ~/.ssh/authorized_keys; chmod 0600 ~/.ssh/authorized_keys )"



Apache 64 Bit Patch

Wenn der Apache beim Compilieren auf einem 64-Bit Redhat (oder Centos oder SuSE) mault:

/usr/lib/libexpat.so: could not read symbols: File in wrong format

Dann ist dieser Patch hier anzuwenden. Der gilt für die Version httpd 2.2.4

http://blog.chaos-co.de/downloads/apr-util_2.2.4.patch

genau den Anweisungen in diesem Blogeintrag folgen:

http://blog.chaos-co.de/index.php?/archives/2-Apache-patch-for-libexpat.so-could-not-read-symbols-File-in-wrong-format.html