binfalse
Get rid of version grml.02
April 28th, 2011I 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
April 27th, 2011I’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
April 18th, 2011I 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 replaceicingaadmin
withNewUser
. - 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
SSLRequireSSL
- 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$ **" [...]
to:
[...] /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..
Inspecting Java startups
April 17th, 2011The developers around you might know that there are some mechanism hooked when creating an object. Lets have a look at the order of these processes.
Even beginners should know about constructors. They are called if you create an object of a class, but there are some things running before. Here is an example class:
public class Initializing
{
// static initializer
static
{
System.out.println ("class loaded");
}
// instance initializer
{
System.out.println ("new instance");
}
// constructor
public Initializing ()
{
System.out.println ("constructor");
}
public static void main (String [] args)
{
System.out.println ("first object");
new Initializing ();
System.out.println ("\\n\\nsecond object");
new Initializing ();
}
}
The output is:
class loaded
first object
new instance
constructor
second object
new instance
constructor
As you can see, first of all the static initializer is called. It’s also called exactly once, when the class is loaded. It’s clear that the class has to get loaded before the main ()
inside can be executed.
The main ()
then prints a string to indicate the start of that routine and afterwards it creates the first object of the type Initializing
. This calls the instance initializer before the constructor is executed. Also the creation of the second object calls first the instance initializer and then the constructor.
That’s the workaround. At the first time a certain class is used the static initializer is executed, and each time an object of that class is created first the instance initializer is called and then the constructor.
Btw. all of these routines are able to access members that are private, but notice that the static initializer can only access static fields.
Stupid handycrafts
April 12th, 2011Today I had to install a new server for some biologists, they want to do some NGS. It took a whole day and all in all we’ll send it back…
These biologists ordered the server without asking us, I think the salesmen noticed that they don’t have expertise. The money is provided by the university, so no need to design for efficiency. And that is how it came that they send the hardware (2 Xeon-DP 5500, 72 GB mem) in a desktop case with a Blu-ray writer, a DVD-writer, a GPU with 2.72 TeraFLOPS (afaik they don’t want to OpenCL) and: NO CHASSIS FANS!! Ouch..
It’s as clear as daylight that this cannot work. Did they thought the hot air around the mem (18 slots, each 4GB) leaves the chassis by diffusion?? The processor cooling construction for my Athlon X2 is twice as big as all their fans together…
After setting up a Linux and installing lm-sensors
the CPU’s are running at >75°C, fighting for air. Of course we immediately turned off the hardware! After half an hour we were able to start it again and took a look at the BIOS sensors for the memory. No time to get bored while the temperatures raised up to 80°C and more in less than 5 min, see figure 2… Of course time to turn it off again! Don’t want to hazard a nuclear meltdown..
They also enclosed a raid controller. I’ve googled that. Less than 100$.. wtf… The controller came with a CD to create a driver disk. But when you boot into the small Linux on the CD it hangs with the message “Searching for CD…”. And there is no driver for us, you are only able to use this controller when you are running Win 2003/XP/Vista or a RHEL or a Suse Enterprise. Other systems are not supported.. Proprietary crap..
What should I say, I’m pissed off. A whole business day is gone for nothing… Just because of some less-than-commodity handycrafts… I strongly recommend to ask Micha before plugging such bullshit!