You are here

Michel's Blog

Integrate Nagvis maps nicely in Check_MK

Check_MK has build-in dashboards you can create and alter from within the Check_MK webinterface. However, they do not (or at least not at this moment) give you the opportunity to create a single icon that represents a group of checks together like Nagvis. Fortunately, the current check_mk builds (both the enterprise and raw editions) comes with Nagvis preinstalled. Nagvis, on the other hand, does not handle check_mk dashlets like graphs or the status-globe. So, in order to use both on one dashboard we'd have to mix things up a bit.

Human-readable json-output with a python one-liner

I was trying to get some metrics from a service that outputs in json and copy-pasted the output into an editor and used a json-plugin to order the output in a human-readable way. While this works fine, I thought it would be easier to write a one-liner that parses the json-output and pretty-prints it on my screen.

That way it would be easier for me to read. Also I can now use grep on the output to search for specific metrics.

The one-liner uses python to read and dump json-output. Here it is:

Automatically rip audio cd's

Whenever I buy a new audio cd I use my laptop to rip the music to disk and place it on my server so that we can listen to it using a Raspberry Pi with Kodi. So, I bought myself an new and shiny laptop... but the thing does not have a cd/dvd-player! Oops... now what? Keep my old laptop just for cd ripping purposes?

I figured it would be kinda cool to attach an old usb DVD-player to the Raspberry Pi and make it rip the contents of every audio cd inserted automatically.

So, I created an udev-rule that triggers a bash-script whenever an audio-cd is inserted into the drive:

Tmux-integratie iTerm2

Leuk, thuis inloggen op een machine via ssh met gebruikersnaam, wachtwoord en een tijdelijke token.
Dan een nog een sessie openen, weer je wachtwoord en een token intikken.
En nog een keer, en nog een keer... onhandig!

Wat blijkt? iTerm2 (ja ik werk op een Mac) kan prima integreren met Tmux!
Wat is Tmux? Nou, da's net zoiets als screen, dus meerdere sessies kunnen draaien binnen 1 login... maar screen heeft zo zijn beperkingen zoals standaard geen scrollback en 't uit je hoofd moeten kennen van toetscombinaties om van sessie naar sessie te schakelen.

IP-adressen sorteren met 'sort'

Leuk, ip-adressen listen... als je normaal gesproken bijvoorbeeld ip-adressen .1 t/m .10 op een server hebt en je probeert ze te sorteren dan krijg je iets als dit:
10.1.2.1
10.1.2.10
10.1.2.2
10.1.2.3
10.1.2.4
10.1.2.5
10.1.2.6
10.1.2.7
10.1.2.8
10.1.2.9

Maar die 10 zie je toch liever netjes onder de 9, niet?
Wat je kunt doen is sort inlichten over het feit dat de punt een scheidingsteken is en vervolgens per veld sorteren. bijvoorbeeld als volgt:

Monitoring java memory-usage with Check_MK

After running out of memory with a Java application, I wanted to monitor the internal Java memory usage.

It cost me quite some time trying to get the information I seeked from JMX, still have not figured that out. Suddenly I ran into a simple Nagios-plugin that utilizes the jstat-command to just get the heap- and permgen usage from a java-process. The original plugin can be found here: https://github.com/Ericbla/check_jstat.

Looking-up PHP sessions in memcached

If, like me, you use memcached primarily for storing php-sessions using the php-module 'memcache' or 'memcached', then you probably have no idea what's actually happening inside memcached. It took me some time to figure out simply how to lookup a php-session.

Like most things in life, the answer is actually pretty simple.

You need two things:
- The session name (can be found in php.ini / phpinfo()), usually just "PHPSESSID".
- The session id (I've used Firefox add-on "view cookies" to see mine).

Running a second MySQL-instance on the same Linux box

Sometimes it can be useful to be able to start a second mysqld-instance on the same machine, for example when you need to restore some innodb-tables but only have a file back-up available of the MySQL-instance on the machine.

When searching the Internet, many people offer solutions for this that use a chroot. Well... I don't like to build-up a whole chroot just to run a second MySQL-daemon! ;-)

Getting the date of last month in bash

I confess: I tend to overcomplicate things just because that's how I know how to do it.

Example: When I need the date of 2 months ago in a bash script, I usually do date +%s to get the current date and time in seconds since epoch, then subtract 5184000 seconds of that number (60 days) and then use the date command again to get the date formatted the way I want.

Pages

Subscribe to RSS - blogs