BenV's notes

Software

IE Fascism

by on Aug.25, 2011, under Software

Obviously dealing with windows isn’t my favorite, but it comes along as part of the job.

Today my boss wanted to view some car site in internet exploder, because “Some sites don’t show properly in Firefox, Internet Explorer does a better job sometimes”. So I was like “You mean garbage sites that still write IE specific html… oh never mind, show it :)”

First he showed his problem in Firefox. As far as I’m concerned it looked like a failing search engine on the site and nothing html related, but whatever. (continue reading…)

Leave a Comment :, , , more...

Syslog-ng POLLERR occurred while idle; fd=’NN’

by on Aug.05, 2011, under Software

While trying to craft a custom firewall traffic logger using iptables and syslog-ng to run it through a script I ran into this lovely error.
Syslog-ng is happy to spam 2458734597 lines (or more if you have lots of diskspace ;)) like this into your syslog:

Aug 5 15:11:47 ss syslog-ng[18731]: POLLERR occurred while idle; fd='17'
Aug 5 15:11:47 ss syslog-ng[18731]: POLLERR occurred while idle; fd='16'
Aug 5 15:11:47 ss syslog-ng[18731]: POLLERR occurred while idle; fd='17'
Aug 5 15:11:47 ss syslog-ng[18731]: POLLERR occurred while idle; fd='16'
Aug 5 15:11:47 ss syslog-ng[18731]: POLLERR occurred while idle; fd='17'
Aug 5 15:11:47 ss syslog-ng[18731]: POLLERR occurred while idle; fd='16'
Aug 5 15:11:47 ss syslog-ng[18731]: POLLERR occurred while idle; fd='17'

The reason was -not- that it could not be executed…. the reason was that the program (“test.sh”) quit (or at least closed its input) instantly.
Good to know for next time.

Leave a Comment : more...

Humble Bundle part 3

by on Jul.27, 2011, under Software

And here we go again (and again!)!

Get 5 games, donate to charity / the EFF, and support developers at the same time. Or only get the games. Or only support the EFF. Or whatever 😉
Do it now! Humble Bundle 3 is here!

The games this time: Crayon Physics Deluxe, Cogs, VVVVVV, Hammerfight, and And Yet It Moves.

The last one has an interesting graphics style: it looks like it’s all put together from ripped up magazines.

As for weird graphics, the first one features drawings made of crayons… which you draw yourself!
Here’s a video of it:

Crayon Physics Deluxe from Petri Purho on Vimeo.

The rest you’ll have to find out for yourself.
Did I mention you get them on Steam / Desura as well for that price? 😉

Leave a Comment :, , , , more...

Need Ventrilo/Teamspeak? Try Mumble!

by on Jun.29, 2011, under Software

Firelands!

Today the 4.2.0 aka Firelands patch was released for World of Warcraft.

First thing to notice: where did all my inventory space go? And why do I have tons of ingame mail? Well, they removed the keyring, making a bunch of keys obsolete (which they send you gold for in return through ingame mail), and the rest of them are stashed in your inventory.
Gee thanks assholes. Guess those keys are really a lot bigger than those 128 axes I carry in my backpacks.

Apparently this is needed to make room for the Dungeon Journal, which shows you the stuff you would normally check Wowwiki etc for, things like boss abilities and drop lists. Don’t know why that requires the key ring to go away, but leave that to Blizzard.
Of course with new content comes a new daily grind guide. Wonder how long I’ll manage to put up with that.
(continue reading…)

Leave a Comment :, , , , more...

CMake note

by on Jun.17, 2011, under Software

Another note for future reference!

Unfortunately CMake is something I run into way too often these days, and since I can never remember how to tell it to do certain shit, here’s how.
They should give me a configure along with the product.

The equivalent of

./configure --prefix=/usr
=>
export CMAKE_INSTALL_PREFIX=/usr

Destdir seems something CMAKE does understand, so just

export DESTDIR=`pwd`/tmp

and it’ll work just fine.

Finally, for the interactive configuration of something we have:

cmake -i

Leave a Comment : more...

PostgreSQL 9.0 on Slackware

by on Jun.14, 2011, under Morons, Software

Another reason to avoid MySQL

Today MySQL has managed to piss me off enough to get rid of it for something I was working on.
The case:
I just created a brand new database. In that database I want to store items, and those items should be linked to users.
So as a first stab I had this CREATE TABLE statement:

CREATE TABLE user (user_id SERIAL, username varchar(255) UNIQUE NOT NULL, password char(32) NOT NULL, PRIMARY KEY (user_id));
CREATE TABLE item (item_id SERIAL, name varchar(255) NOT NULL UNIQUE, user_id bigint unsigned REFERENCES user(user_id),PRIMARY KEY (item_id)) ENGINE = InnoDB;

Guess what MySQL said? Of course, it said “Sure thing dude!”. And to make sure you believe me, here’s the verbatim:

mysql> CREATE TABLE user (user_id SERIAL, username varchar(255) UNIQUE NOT NULL, password char(32) NOT NULL, PRIMARY KEY (user_id));
Query OK, 0 rows affected (0.36 sec)
mysql> show warnings;
Empty set (0.00 sec)
mysql> CREATE TABLE item (item_id SERIAL, name varchar(255) NOT NULL UNIQUE, user_id bigint unsigned REFERENCES user(user_id),PRIMARY KEY (item_id)) ENGINE = InnoDB;
Query OK, 0 rows affected (0.32 sec)
mysql> show warnings;
Empty set (0.00 sec)

Well guess what….
IT LIED!
Those references to the user table? What references? (continue reading…)

Leave a Comment :, , , more...

Check_MK plugin: daemontools

by on Jun.12, 2011, under Software

Another day, another plugin (aka package) for Check MK.
This time it’s a check for Daemontools, the daemon that keeps other daemons up and running.
Personally I use it for a lot of services on my servers, like Apache and Tinydns. However, sometimes a service is flapping in Daemontools
because of a configuration error or something similar and you fail to notice for hours because the service seems to be ‘up’ (but only for a few seconds before it restarts again).

This check makes sure all services that are supposed to be up (“normally up”) are up, and also it checks for how long they’ve been up.
If the uptime is only a few seconds it’ll issue a warning because it might be flapping.

Check_MK - Daemontools

Check_MK - Daemontools Perf-o-meter

[Download not found]
Leave a Comment : more...

Check_MK plugin: qmail

by on Jun.08, 2011, under Software

Just a tiny update for my Check_MK qmail package.
It still checks the qmail queue size 🙂
New in this version is the added Perf-O-Meter. Shiny shiny!

Check_MK Qmail plugin v1.1

Check_MK Qmail Perf-O-Meter

[Download not found]
[Download not found]

Leave a Comment :, more...

Check_MK plugin: lmsensors

by on Jun.07, 2011, under Software

On the subject of Pretty Graphs (see my earlier post), I decided to write a plugin (a.k.a. ‘Package’) for Check_MK in order to monitor (and make pretty graphs!) of the sensor output of lmsensors.
Most machines support this out of the box these days, and it’s always interesting to see the conditions of your machine. In case you don’t know, it gives the temperature and voltage of your CPU and mainboard. Thus it’s a good source for making pretty graphs 🙂

Since these plugins are very easy to install (once you’ve got check_mk up and running that is) and still nobody had written one for lmsensors, I decided to do it myself. Writing python isn’t my strongest point (yet), but these are good opportunities to learn.

One of the issues I ran into while writing the plugin was that PNP4Nagios fails on service names that have a plus character in them. For instance, I had Sensor +12V. This created the files Sensor_+12V.rrd and corresponding xml, but when one would go to the PNP4Nagios graph of that sensor it would request a file called Sensor__12V.rrd, which obviously failed.
Therefore I molested the names a bit, so your sensor might now be simply called MB12V instead of M/B+12V.

Configuration of LM-Sensors
For my plugin to work you need to make sure that you have the ‘sensors’ tool. This normally comes in a package called “lmsensors” or “lm-sensors”. Note that you obviously need some kind of hardware sensor on your machine that’s supported by lm-sensors for it to work, including the required kernel module. Fortunately this will often work out of the box.
After making sure you have sensors and that running ‘sensors’ will give output like this:

benv@localhost:~$ sensors
it8720-isa-0228
Adapter: ISA adapter
in0: +1.04 V (min = +0.00 V, max = +4.08 V)
in1: +1.66 V (min = +0.00 V, max = +4.08 V)
in2: +3.39 V (min = +0.00 V, max = +4.08 V)
+5V: +3.04 V (min = +0.00 V, max = +4.08 V)
in4: +3.10 V (min = +0.00 V, max = +4.08 V)
in5: +1.90 V (min = +0.00 V, max = +4.08 V)
in6: +4.08 V (min = +0.00 V, max = +4.08 V)
5VSB: +3.04 V (min = +0.00 V, max = +4.08 V)
Vbat: +3.30 V
fan1: 2235 RPM (min = 10 RPM)
fan2: 0 RPM (min = 0 RPM)
fan3: 2500 RPM (min = 0 RPM)
fan5: 0 RPM (min = 0 RPM)
temp1: +41.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor
temp2: +36.0°C (low = +127.0°C, high = +90.0°C) sensor = thermal diode
temp3: +38.0°C (low = +127.0°C, high = +127.0°C) sensor = thermistor
cpu0_vid: +1.250 V

k10temp-pci-00c3
Adapter: PCI adapter
temp1: +32.0°C (high = +70.0°C)

You might see things like ‘in0’ instead of ‘CPU Voltage’. Don’t ask me what voltage corresponds with what sensor on your mainboard, but you can rename the sensor output by editing /etc/sensors.conf or /etc/sensors3.conf depending on your flavor of linux.
In order for the check_mk plugin templates to recognize the type you’ll need to make sure they have some kind of indication of the type of sensor. For instance label the temperature sensors with ‘temp’ or ‘temperature’. The default names like ‘in0’ will also work, but something like ‘Pizza sensor’ obviously won’t.

To change labels or ignore certain sensors because they give bogus data (not connected etc), first find your adapter type.
In the example above this is it8720-isa-0228. Now edit the sensors.conf file and add a section
for this adapter if it isn’t already there.

Here’s an example for renaming in0 to “CPU Voltage” and turning off the second fan since it’s not connected.
Also we’ll change the minimum and maximum voltage for the CPU Voltage — this determines when nagios will send out an alarm or not:

chip "it8720-isa-0228"
set in0_min 1.0
set in0_max 2.0
label in0 "CPU Voltage"
ignore fan2

After changing the sensors file you’ll need to make lmsensors aware of the configuration change by running ‘sensors -s’. (might need root).

benv@localhost:~$ sensors -s
benv@localhost:~$ sensors
it8720-isa-0228
Adapter: ISA adapter
CPU Voltage: +1.31 V (min = +1.00 V, max = +2.00 V)
fan1: 2235 RPM (min = 10 RPM)
fan3: 2500 RPM (min = 0 RPM)
# some stuff deleted to save space :)

Tada. Now repeat this process for all sensors 🙂

Installation:
There are two parts to installing a Check MK plugin. First on the host that actually runs check_mk we need to install the package. This is quickly done:

root@checkmk# wget http://notes.benv.junerules.com/wp-content/uploads/2011/12/lmsensors-1.4.mkp
root@checkmk# md5sum lmsensors-1.4.mkp
115bd50557d1db7e934baa64e172e506 lmsensors-1.4.mkp
root@checmk# check_mk -vP install lmsensors-1.4.mkp
Installing lmsensors version 1.4.
Checks:
lmsensors
Checks man pages:
lmsensors
Agents:
lmsensors
Multisite extensions:
plugins/perfometer/lmsensors.py
PNP4Nagios templates:
check_mk-lmsensors.php
check_mk-lmsensors.fan.php
check_mk-lmsensors.temp.php
check_mk-lmsensors.volt.php
root@checkmk# check_mk -II
lmsensors.fan 2 new checks
lmsensors.volt 4 new checks
root@checkmk# check_mk -O

Done. Soon there will be pretty graphs for this machine 🙂

Now for a remote machine you will need to put the agent in place. Since this is only a single file it’s trivial to do:

benv@checkmk$ scp /usr/share/check_mk/agents/lmsensors root@othermachine:/usr/share/check_mk/agents

Note that the place you want to put that thing in is the $MK_LIBDIR/plugins directory. In my case, this was /usr/lib/check_mk_agent/plugins, but it could very well be somewhere else on your system. You can find it in the check_mk_agent script if you don’t know:

benv@somemachine$ grep MK_LIBDIR `which check_mk_agent`
export MK_LIBDIR="/usr/lib/check_mk_agent"
PLUGINSDIR=$MK_LIBDIR/plugins

Let Check_MK do an inventory on your remote machine [check_mk -II $machine] and the rest goes automagically! 🙂

And now we have pretty graphs for my sensors.
Comments and/or suggestions are welcome.

LMSensors in Check_MK

LMSensors in Check_MK

Updates:
Version 1.1: now has pnp templates to put graphs of the same type together.
Here’s an example:

Now we have combined graphs

Now we have combined graphs (v1.1)

Version 1.2: changed sed to perl in agent plugin, sensornames with more than one space (among things) were giving issues. Thanks to Cyril Pawelko for finding the issue and helping with testing!

Version 1.3: minor change to PNP templates — Nico Weinreich informed me that his fan templates weren’t working correctly so I updated the regular expression used to match corresponding sensor types. If you didn’t have this issue this update won’t do anything useful for you 🙂

Version 1.4: Seems like I was a dumbass and didn’t check the 1.2 package properly. This package really makes it work with perl instead of sed.
Also updated the voltage pnp template to hopefully match more voltage sensors.
Note: if the pnp4nagios template doesn’t work for you, check your pnp4nagios perfdata dir, for example /var/lib/pnp4nagios/perfdata/ and see what .rrd files exist for your host. They are based on the sensor name, so if your sensor name is “St John”, it will not match the voltage template. These names come directly from your sensors.conf (if you don’t have it the default names for the sensors).
See above on how to rename your sensors.

Version 1.5: Another bug spotted by Cyril! The pnp4nagios temperature template had a botched variable name.

Downloads:
lmsensors-1.6.mkp (3515 downloads)      SHA1: 42f7f7eebf803fb3ed755107521761bfb4fbb6bc  MD5: 199266bfd9d750243b9bc49773b6b4d6
[Download not found]
[Download not found]
[Download not found]
[Download not found]
[Download not found]
[Download not found]

35 Comments more...

Fighting with PNP4Nagios

by on Jun.07, 2011, under Software

So today I noticed my pretty Check MK graphs were broken. Trying to view a random Check_MK service’s PNPGraphs gave this error:

Warning: preg_match() [function.preg-match]: Compilation failed: unknown option bit(s) set at offset 0 in /usr/lib/kohana/system/core/utf8.php on line 30

Fatal error: PCRE has not been compiled with UTF-8 support. See PCRE Pattern Modifiers for more information. This application cannot be run without UTF-8 support. in /usr/lib/kohana/system/core/utf8.php on line 38

Of course this is after I had upgraded some Slackware packages in the daily upgrades (I still run Slackware Current on non production machines, keeps things interesting) including PHP and Perl, so I wasn’t really surprised.
I reinstalled RRDTool since the perl bindings were gone (and of course I once again had to fight it) and decided to upgrade PNP4Nagios while I was at it.
However, no dice. Searching for the error gave nothing, hence this post.

To be sure it wasn’t what they (google) claimed it would be, I checked for UTF-8 support in my libpcre:


benv@graphs$ pcretest -C
PCRE version 8.12 2011-01-15
Compiled with
UTF-8 support
Unicode properties support
Newline sequence is LF
\R matches all Unicode newlines
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack

Jup, UTF-8 support is there, along with Unicode stuff. Yay.

Next thing I noticed was that the new PHP version was complaining about extensions that wouldn’t load.
For instance dbase.so didn’t exist anymore, and some other junk failed as well. It’s possible that this error has been around for a while on that machine, but it was time to fix it!
Since my php.ini was from 2008 I decided to simply take the stock /etc/httpd/php.ini-production for now.
After that change php was again bitching about not being able to load extensions, but this times it were different ones.
Apparently they now have ‘libenchant‘ for spell checking, so that was one of the other failures.
To fix that problem use ‘slackpkg install enchant‘. (that’ll teach me to run the slackpkg install-new every once in a while :p)

Restarting Apache the hard way (not “apachectl restart” but /etc/rc.d/rc.httpd restart) helped for the PNP4Nagios error.
However, upgrading it introduced a new gimmick called:

Please check the documentation for information about the following error.

Undefined index: auth_enabled
file [line]:

application/models/auth.php [22]:

back

Right. Upgrading my Check_MK to 1.1.10p3 didn’t help.
However, checking the pnp4nagios config.php file made me aware that they added some options.
After merging in the new config.php options from their sample dir it finally worked again.
The new options I had to add when going from pnp4nagios version 0.6.7 to 0.6.13 were:

$conf['zgraph_width'] = "750";
$conf['zgraph_height'] = "450";
$conf['auth_enabled'] = FALSE;
# Adjust the next one to your configuration, it's probably different :)
$conf['livestatus_socket'] = "unix:/var/lib/nagios/rw/live";
$conf['allowed_for_all_services'] = "";
$conf['allowed_for_all_hosts'] = "";

Hooray, pretty graphs are back 🙂

LMSensor Fan1 speed graph

Pretty graphs!

1 Comment :, , , , , more...

Archives

  • 2018 (1)
  • 2016 (1)
  • 2015 (7)
  • 2014 (4)
  • 2013 (11)
  • 2012 (27)
  • 2011 (26)
  • 2010 (25)
  • 2009 (68)