Linux LVM How-to: Adding a new partition

Since I started out with Linux (so about six years ago), I always used the Linux Logical Volume Manager (LVM) to partition my tables. First it was just because it seemed easier to configure my harddisks with it (also, the installer usually provided a nice option to do so), but in the last few months I had the possibility to work more with LVM and got to know some nice features.

One thing I regularly have to do is to extend an existing logical volume on a server. This article focuses on extending a logical volume with the help of LVM.

Read the rest of this entry

BASH: here-document at line n delimited by end-of-file (wanted `EOF’)

On one of our Debian hosts, we use bash scripts and cron jobs to automate certain tasks. One of these bash scripts downloads files from an FTP server and archives them. After upgrading the host machine to Debian 6.0.4, one of the bash scripts suddenly showed warnings:

/srv/foo/bar.sh: line 146: warning: here-document at line 140 delimited by end-of-file (wanted `EOF')

Whoops, so let’s look into it. The change was probably introduced with the new version of bash:

Read the rest of this entry

Mac OS X: Plotting with GNU Octave (libfreetype)

For our courses in linear algebra, we are using the GNU Octave software for numerical computation. Since I am using a MacBook Air for university, I had to install Octave on Mac OS X. I simply followed the steps described here and successfully installed gnuplot and the Octave software package. But when I tried to plot something with Octave, I received the following error message:

Read the rest of this entry

RHEL: Add DVD to YUM repository

When setting up a new server in a highly secured network, one does not always have access to the Red Hat Network to download packages for the installation of the server. Often, a local repository is provided later on in the setup process.

This leaves us with the problem of installing the necessary packages for the Oracle database. Luckily, we can use the DVD we used for the installation of the Operating System to get all required packages.

Read the rest of this entry

Nagios: Escape dollar character

Some services (such as MSSQL instances) include a dollar character ($) in their name. A few weeks ago, I had to add a service called “$02_JBoss Server” to our internal Nagios configuration. After searching through the Nagios documentation and FAQs, this is what I found:

For Nagios 3, add two backslashes and a second dollar (\$) symbol, like this: check_command check_command check_nt!SERVICESTATE!-d SHOWALL -l MSSQL\$$INSTANCE

The above example actually has a small error in it, because there is no second backslash (even though it says so in the description)!

The correct way to check a service named “$02_JBoss Server” is to use a definition like this:

check_command           check_nrpe_args!CheckServiceState!ShowAll "\\$02_JBoss Server"

JBoss: LDAP authentication (login-config.xml) example

In the past weeks, I was responsible for setting up a new JBoss Application Server for a customer. One thing I had to do was to enable authentication via the customers existing Active Directory for SSO (Single Sign On).

When fiddling with authentication, one is always happy to find examples of existing installations. In this post, I give an example of how to configure LDAP authentication (in this case with Active Directory) in JBoss. While you can find extensive documentation on the JBoss website, I always like it if there is a specific example provided, so here it goes:

login-config.xml

Read the rest of this entry

Nagios – Error: Could not stat() command file

So there I was. I just installed Nagios on a brand new Debian (6.0.3) host, I was greeted with the following error message after logging into the Nagios web interface and clicking a link that uses external commands:

Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'

What? Well, after making sure my configuration is correct, I figured that this must be some kind of permission problem…

Read the rest of this entry

HTML table with ezSQL

When writing an application in PHP, I like to use Justin Vincents ezSQL for database access. ezSQL allows you to write your query and get your results as a PHP object, as shown in the following example:

// Select multiple records from the database and print them out..
$users = $db->get_results("SELECT name, email FROM users");
 
foreach ( $users as $user )
{
            // Access data using object syntax
            echo $user->name;
            echo $user->email;
}

So one common task you might want to do is to present the retrieved result as a table. While the ezSQL library features a debug() method, this should obviously only be used during development. So if you want to display your result as a table, you’ve got to do it yourself and I hereby provide a snippet of code on how to do it…

So after you’ve fetched your result from the database you can use the following method to print a HTML table with your results:

Read the rest of this entry

Mac OS X Standard de_CH keymap

For my studies, I bought a MacBook Air with the swiss keyboard layout. The Air is really nice to carry around, since it is light, thin and features a battery that lasts for more than 6 hours of light work (e.g. working in Eclipse).

However, one thing I did not really like was the circumstance, that Apple uses a non-standard keyboard layout for its notebooks. When you are typing letters this will most likely not bother you, but as soon as you start to use special characters (such as []{}~\), you’re in trouble.

So I searched for a way to restore the standard keymap for the swiss german keyboard. Luckily, I stumbled upon this great application called Ukelele, which allows you to modify the keymap for Mac OS X.

Read the rest of this entry

Linux: pstree formatting

Today one of our developers came to me to discuss a problem and I wanted to show him something on one of our Linux machines. To check a process, I ran pstree and noticed that the formatting of the output was all wrong:

simon@atlas:~$ pstree
initââ¬âacpid
     ââapache2âââ10*[apache2]
     ââatd
[..]
     âârsyslogdâââ3*[{rsyslogd}]
     ââsshdââ¬âsshdâââbashâââping
     â      ââsshdâââbashâââpstree
     â      ââsshdâââsshdâââsh
     ââudevdâââ2*[udevd]

This is obviously just a cosmetical problem and the output is quite hard to read. When encountering something like this, the first guess would be that the encoding is somehow wrong. When checking the environment variables with env, we find that LANG is set to “en_US.UTF-8”.

Read the rest of this entry

Hello world

My name is Simon Krenger, I am a Technical Account Manager (TAM) at Red Hat. I advise our customers in using Kubernetes, Containers, Linux and Open Source.

Elsewhere

  1. GitHub
  2. LinkedIn
  3. GitLab