Why false is sometimes true

We have some specialists in our admin staff, only able to administrate LDAP via phpLDAPadmin. But for several days the connection to the LDAP servers was read-only. It took some time to figure out why.

The configuration in /etc/phpldapadmin/config.php is very extensive, so I always ignored the failure in the following line:

$servers->setValue ('server', 'read_only', 'false');

Do you find the crap? If I comment it out the session isn’t read-only anymore. First we thought of a bug and I started to check the source code, but some more considerations let me have an idea. You might know PHP (like some other languages) interprets everything that is not empty or false explicitly as to be true. So 'hello' , 'true' and 'false' are all true ;-)

Don’t know who inserted this line, but sometimes (or generally?) you just work to correct the work of somebody else…

ShortCut[proprietary]: NVIDIA update

Again I installed a new kernel and again X isn’t able to start. Of course the last time I installed the proprietary NVIDIA driver I downloaded it to /tmp , and curiously it’s lost! The funny NVIDIA website is so damn incompatible, you need to have JavaScript or Flash or both to find your driver, no chance to get the driver with e.g. lynx from command line… So you need to have another running system to download the driver and secure copy it, or you need to reboot into the old kernel. (nonstop swearing at proprietary smut) Does this sound familiar? There is an alternative!

Once you have installed the driver, you’ve also installed a tool called nvidia-installer . This tool is able to find the newest driver at nvidia.com and to downloads it itself via FTP. Just type the following:

nvidia-installer --update

Even if you save your driver persistently, if you installed a new X version and your old driver is out of date you have to get a new driver! So this trick simplifies the world a lot ;-)

Get rid of version grml.02

I frequently get asked about the error:

dpkg-query: warning: parsing file '/var/lib/dpkg/status' near line 5038 package 'linux-image-2.6.33-grml':
 error in Version string 'grml.02': version number does not start with digit
dpkg-query: warning: parsing file '/var/lib/dpkg/status' near line 21699 package 'linux-headers-2.6.33-grml':
 error in Version string 'grml.02': version number does not start with digit
dpkg-query: warning: parsing file '/var/lib/dpkg/status' near line 61359 package 'linux-doc-2.6.33-grml':
 error in Version string 'grml.02': version number does not start with digit

So this article is to answer all questions in a time.

I don’t know why, but that grml kernel has a version number of grml.02 (other kernel versions are also affected). This version string doesn’t meet the criteria for version numbers because it doesn’t start with a digit. So dpkg is correctly warning. This warning is not critical, you might ignore it without any consequences, or you can install a newer one. Kernel with corrected version numbers can be found in grml-testing , so add the following to your /etc/apt/sources.list.d/grml.list :

deb     http://deb.grml.org/ grml-testing main

and you’ll find for example the new 2.6.38 kernel. Just for those lazy guys:

aptitude install linux-image-2.6.38-grml linux-headers-2.6.38-grml

So, have fun with your new kernel :-P

Humanizing atan2

I’m sure everyone of you got livid with the return value of the atan2 functions. Here is a fix.

public double arctan (double x, double y)
	double d = Math.atan2 (x, y) % (2 * Math.PI);
	if (d >= 0 && d <= Math.PI / 2)
		return Math.PI / 2 - d;
	else if (d < 0 && d >= -Math.PI)
		return Math.PI / 2 - d;
	else if (d > Math.PI / 2 && d <= Math.PI)
		return 2.5 * Math.PI - d;
	return d;

This is Java code, but easy to adapt for other languages. And since you are here, a little hint: Multiply the result with 180 / Math.PI to receive the angle in degrees.

Moved to Icinga

I just installed Icinga, it was the right decision!

First of all respect to the Icinga guys, the compatibility to Nagios is great! Moving from Nagios to Icinga is mainly copy and paste. Syntax is the same, management structure also equals, you can even use all your previous installed Nagios plugins and the nagios-checker add on. Well done! Except for the web interface (looks much more professional) every feels like Nagios. So I can’t see any reason to stay with Nagios.

Here are some things I had to do:

  • First of all I changed the credentials for the web interface:
  /etc/icinga % mv htpasswd.users htpasswd.users-org
  /etc/icinga % htpasswd -c -s htpasswd.users NewUser
  • This new user needs also authorizations, so you need to edit /etc/icinga/cgi.cfg and replace icingaadmin with NewUser .
  • The rights in /var/lib/icinga/rw/ were wrong, www-data wasn’t able to access the directory. So I wasn’t able to schedule manual checks via web. When I changed the permissions everything was fine:
  /etc/icinga % l /var/lib/icinga/rw/
  total 8.0K
  drwx------ 2 nagios www-data 4.0K Apr 18 01:02 .
  drwxr-xr-x 4 nagios nagios   4.0K Apr 18 01:02 ..
  prw-rw---- 1 nagios nagios      0 Apr 18 01:02 icinga.cmd
  /etc/icinga % chmod 750 /var/lib/icinga/rw/
  • I added the following into the DirectoryMatch directive of /etc/icinga/apache2.conf , to force me to use SSL encryption:
  SSLOptions +StrictRequire
  • I shortened the mail subject of the notifications. By default the subject looks like:
  ** PROBLEM Service Alert: localhost/Aptitude-Updates is WARNING **

But I’m just interested in the important parts, so I changed the following in /etc/icinga/commands.cfg :

  [...] /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" [...]


  [...] /usr/bin/mail -s "** $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" [...]

the the notifications now come with a subject like this:

  ** localhost/Aptitude-Updates is WARNING **

All in all I’m glad that I gave Icinga this chance and recommend to test it if you are still using Nagios. Maybe I’ll test some further Icinga features and maybe we’ll migrate at the university..

Martin Scharm

stuff. just for the records.

Do you like this page?
You can actively support me!