XMPP notifications for check_mk

Want to have your check_mk notifiy you via XMPP / Jabber if something goes boom? Here’s a little Python notification script which does just that…

You’ll need sleekxmpp installed, either via pip install sleekxmpp  or apt-get install python3-sleekxmpp  if you’re running Ubuntu.

Next, just add the script to check_mk by placing it here: […]/share/check_mk/notifications/xmpp

Now call the script with the destination ([email protected]) you want notified as custom parameter from within check_mk and give it a try by triggering some alert.

(Originally from here, but last time I checked indentation was broken and the site mostly down)

Event Console not showing up in check_mk

After spending the last couple hours trying to figure out why the event console wasn’t showing up in my manually upgraded OMD/check_mk install (that is OMD 1.2 w/ check_mk 1.2.4p5 upgraded to 1.2.6b10) even though mkeventd is running – here’s what you got to do: manually copy the files from your check_mk source directory into the install director. The setup script does everything else for your, except that.

That’s it. WATO should now show the event console again and things like rule based notification will also work.

Eating with (really bad) aphthous ulcers

Aphthous stomatitis or mouth ulcers (aka canker sores) can be be a real pain in the ass, well, mouth – those 5-20% of people occasionally suffering from it know what I’m talking about. Especially if one happens to be at a spot your teeth rub against, or as it is currently the case for me, if a bunch of ’em cover pretty much your whole throat making swallowing food quite uncomfortable or downright painful.

Here’s a little gem that took me decades to figure out, even though it really is quite simple if you think about it: Instead of eating regular food, just switch to drinking your nutritional basics for a couple days. Bodybuilder and professional athletes have been doing it for decades to increase their daily intake and it works just fine for them. Lately, there’s even Soylent marketed to regular folks, but it’s basically not much different from so called meal replacement shakes that have been around since the last century.

Even though I currently can’t even eat cereal or soaked and soft muesli (granola for you american folks) without pain, let alone anything even mildly spicy or somehow granular grainy, downing a big jug of my own soylent-like mixture was no issue at all.

If you’re not really into the whole nutritional science, just go and order yourself some Soylent – it’s basically the one-size-fits-most of meal replacements. If you don’t live in the US or can’t be bothered to wait for a shipment (as probably you found this article because your throat/mouth/whatever hurts right now), go to your nearest supplier for bodybuilder or sports shop and get yourself meal replacement shakes and a shaker. Preferably a couple flavors, since you’ll be eating/drinking pretty much nothing else once you notice the distinctive lack of pain. And if they don’t have any pre-mixed meal replacement powders, just get some protein powder and something like (really finely ground) oatmeal or another form of carbs, like Maltodextrin. Put some water and/or milk in your shaker, add the right amount of powder, mix it up and your meal is ready.

Even if it’s unfamiliar and odd at first, you can live of that just fine – you’ll feel full and if you add some multivitamins, you’re body should have everything it needs to sustain you for another half a day or so, until the next shake. Hell, for some people out there it will probably be a better diet than they’re currently having.

Once your ulcers are gone, just switch back to your normal eating habits. Or stay with Soylent if you decide to actually enjoy it.

Maybe this will help some currently miserable folks out there – it sure did for me. You can thank me in the comments…

Juniper EX2200 vs. USB serial adapter

Recently I had to factory-reset a Juniper EX2200 switch for which the password got lost. No big deal one would assume: Connect the console cable to the switch, plug in a USB-to-serial adapter since neither my notebook nor my desktop come with a serial port anymore, reset the switch and press space when the boot messages scroll by…

… except they don’t. Which is funny, because the serial connection itself worked fine just a minute ago – I just had no way of logging in. Reset the switch again, nothing. Wait a couple minutes… and the switch is completely fired up, except I still don’t get any output on the serial port. Detach the USB adapter, hook it up again, press some keys and there’s the login. Try the Reset again, same thing happens. And so on…

Apparently, the only way I get output is to attach the serial line after the switch powered on. Well, ok then – connect the line the second after the switch got power. Apparently that’s to fast. Plug it in a couple seconds later, apparently that’s to slow since the switch is already booting the kernel and you’ll have to press space at the bootloader before that. Let’s try something in between… doesn’t work either, only gets garbage output and doesn’t accept my input, since apparently that’s not the right time either. Goddamn, WTF? How hard can it be to watch the switch boot? Strange thing is, I haven’t had any problems with that cheap-ass adapter and other devices so far.

An hour (and about a dozen or two resets) later I decided to fuck it and grab an old HP Server I have laying around for testing spare-hardware… it still has a serial port. Hook it up to a screen, keyboard, connect the serial line there and boot an OS from USB. Guess what? The Juniper bootloader shows up just fine, no matter what. It’s just my fucking retarded USB serial adapter thingy which craps out for some reason or another.

Done. In about two minutes or so, if it wasn’t for my stupid serial adapter, which turned it into an two almost hour ordeal.

Cloudflare Universal SSL and WordPress

Cloudflare just rolled out their Universal SSL enabling pretty much any site to use SSL without any associated costs – which is pretty awesome…

But when using it on one of my test-sites, it turned out the site looks pretty much broken. Apparently WordPress doesn’t yet use protocol relative URLs, so CSS, JS etc. may still have a http:// prefix, causing some browsers not to load that content over an insecure channel. Furthermore, trying to access the WordPress dashboard results in an infinite loop, since the request from Cloudflare to your server is still HTTP and handled accordingly by WordPress.

The quick way to fix this is to simply add a few lines to woud wp-config.php

And maybe install some kind of HTTPS plugin to get rid of the mixed-content warnings due to residual http:// content from other plugins.

Wet tumbling and the weight of brass

so-shiny-im-gonna-dieAfter wet-tumbling my first batch of brass the first thing that came to my mind was that scene from Despicable Me: It’s so fluffy shiny I’m gonna die!

So I went ahead and did my already dry-tumbled “clean” brass over again, leaving my with piles of oh so shiny brass. But… how much? Well, counting brass kinda sucks when you’re talking thousands per caliber, so better put it on a scale and do the math.

Here’s a handy breakdown for future reference:

Case grains per case grams per case cases per lb cases per kg lb per 1000 kg per 1000
9×19 59,5 3,86 118 259 8,5 3,9
.357 Mag. 78 5,05 90 198 11,1 5,1
.38 Special 68 4,41 103 227 9,7 4,4
.40 S&W / 10mm / .357 Sig. 70 4,54 100 220 10,0 4,5
.44 Mag. 115 7,45 61 134 16,4 7,5
.45 ACP 90 5,83 78 171 12,9 5,8
.223 Rem 95 6,16 74 162 13,6 6,2
.308 Win 175 11,34 40 88 25,0 11,3
.50 BMG 865 56,05 8 18 123,6 56,1

* the bigger the cartridge, the bigger the margin of error of course