MantisBT timezone warning (date_default_timezone_get)

For a proof-of-concept, I had to install a new Mantis Bug Tracker instance and after finishing the installation, the login screen greeted me with the following warning:

SYSTEM WARNING: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead

The solution is amazingly simple. The only thing that I needed to find out was that this is a PHP error and not a MantisBT error. So after that was settled, I went on and just followed the instructions given by the warning:

Read the rest of this entry

Java: Recursive digit sum function

For an university assignment, I had to implement a recursive function to calculate the digit sum of a given number. I place my solution here for my own reference:

public static int digitSum(int n) {
	if(n < 10)
		return n;
	else
		return n % 10 + digitSum(n / 10);
}

This code can also be found in the GitHub repository that I am keeping for university: ChecksumTool.java

Java: Comparing floating-point numbers

When comparing floating-point numbers (float, double) in Java, we quickly discover that we get roundoff errors. This has to do with the limited precision of Java floating point variables. The following code example shows the problem at hand:

double r = Math.sqrt(2);
double d = r * r - 2;
if (d == 0)
	System.out.println("sqrt(2) squared minus 2 is 0");
else
	System.out.println("sqrt(2) squared minus 2 is not 0 but " + d);

Theoretically, d should be 0, but because we have limited precision (see the documentation on primitive data types) there will be a difference:

sqrt(2) squared minus 2 is not 0 but 4.440892098500626E-16

One possibility to circumvent this problem is to define a constant value (the following example uses EPSILON). We then check if the difference is smaller than that constant value. Since we received a very small number (4.4E-16) above, we can use 1E-14 as the value of our constant:

Read the rest of this entry

Nagios: Check iSCSI Initiator

In the last few weeks I reworked our internal Nagios configuration and added a few checks to some of our internal servers. Since we do not have a dedicated SAN for our environment, we are using iSCSI as a low-cost storage solution. However, the Microsoft iSCSI Initiator implementation sometimes has trouble connecting to the iSCSI target. As a result, we had to monitor the iSCSI Initiator.

So here is our implementation of check_iscsi for the Microsoft iSCSI Initiator. It uses the iscsicli utility provided together with the iSCSI Initiator and runs on the remote server. To use it, place the following batch file in the scripts/ folder of your NSClient++ installation.

Read the rest of this entry

WMI client (WMIC) for Linux

One excellent tool for Systems Management on Windows is the Windows Management Instrumentation (WMI), which allows you to remotely execute commands and query parameters on a Windows Host. Of course, all modern Windows systems have the WMI Client installed, but what about the Linux clients?

To get the same functionality on a Linux system (I am using Debian in this example), we need to get the following two packages from this website:

Read the rest of this entry

Nagios 3.3.1 “make install”: Error 1

To monitor our software, we use the free Nagios supervision system fitted with custom checks for our application. This way, we can make sure that not only the Operating System is properly monitored but also the core components of our application including the Application Server and the Oracle Databases.

Today I tried to update to the latest version of Nagios 3.3.1 on one of our supervision servers running Ubuntu Server. So I downloaded the package, ran “./configure” and ran “make fullinstall“. I then stumbled upon the following (quite meaningless) error:

/usr/bin/install: omitting directory `includes/rss/extlib'
/usr/bin/install: omitting directory `includes/rss/htdocs'
/usr/bin/install: omitting directory `includes/rss/scripts'
make[1]: *** [install] Error 1
make[1]: Leaving directory `/tmp/nagios-3.3.1/nagios/html'
make: *** [install] Error 2
root@watchtower:/tmp/nagios-3.3.1/nagios#

Phew. Alright, using my trusty friend Google I quickly discovered a thread on ubuntuforums.org with the solution.

Read the rest of this entry

LIGHTTPD: Google+ Redirection

Lately, I have seen a few personal sites that redirect /+ to the personal Google+ profile. I thought “What a good idea!”. Sadly, my quick search on Google itself only showed how to do it with Apache (see here for example). Since I am using lighttpd this obviously does not work for me.

So here is how to do it with lighttpd:

$HTTP["host"] =~ "(^|\.)krenger\.ch" {
        # Redirect /+ to Google+
        url.redirect = ( "^/\+" => "https://plus.google.com/115712438575389450995/about")
}

The result is something like this: http://krenger.ch/+

Linux RAMDISK with tmpfs

The Linux kernel provides the tmpfs, which basically creates a file system in memory. This temporary file system can be used to store temporary data, such as caches or log files. Read more about tmpfs in the kernel documentation: tmpfs.txt

After reading this excellent article about using tmpfs in Linux, I decided to put it to the test. Even though the Linux kernel already does a good job caching files, I wanted to see the performance of this solution by applying different loads on it. For this, I am using the IOzone tool I already used for my ZFS tests (1) (2) and my Amazon EC2 IO test.

Read the rest of this entry

Debian with a vanilla kernel

So one might want to ask why you’d want to sacrifice the fantastic stability and openness of Debian to install a vanilla (= original) kernel (Debian currently has 2.6.32). There are quite a few reasons for doing so. For example, the current kernel (2.6.38) has TRIM support, which is something I am looking for when using SSDs. Also, maybe you want to have a bleeding edge kernel just for the fun of it. So lets get started.

First order of business is to download a few packages, download the latest kernel from kernel.org and then unpack the kernel in /usr/src/:

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