Explaining the “internet of things” to non-techies can be hard… this one does a good job though
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
# Send Notifications via XMPP
def __init__(self, jid, password, recipient, msg):
super(SendMsgBot, self).__init__(jid, password)
self.recipient = recipient
logging.debug("Recipient: %s" % recipient)
self.msg = msg
logging.debug("Message: %s" % msg)
def start(self, event):
if __name__ == '__main__':
logging.basicConfig(filename='/tmp/notifications.log', format='%(asctime)s %(levelname)s:%(message)s', level=logging.ERROR)
message = os.environ["NOTIFY_NOTIFICATIONTYPE"]+"\nHost: "+os.environ["NOTIFY_HOSTNAME"]+" - "+os.environ["NOTIFY_HOSTSTATE"]+"\nHost-Plugin-Output: "+os.environ["NOTIFY_HOSTOUTPUT"]+"\nService: "+os.environ["NOTIFY_SERVICEDESC"]+" - "+os.environ["NOTIFY_SERVICESTATE"]+"\nService-Plugin-Output:"+os.environ["NOTIFY_SERVICEOUTPUT"]+"\n-------------------------\n\n"
if os.environ["NOTIFY_SERVICEDESC"] != '$SERVICEDESC$':
message = "SERVICE"
message = "HOST"
message = message+"-"+os.environ["NOTIFY_NOTIFICATIONTYPE"]+"\n"+os.environ["NOTIFY_SHORTDATETIME"]+"\nHost: "+os.environ["NOTIFY_HOSTNAME"]+" - "+os.environ["NOTIFY_HOSTSTATE"]
if os.environ["NOTIFY_SERVICEDESC"] == '$SERVICEDESC$':
message = message+"\nHost-Plugin-Output: "+os.environ["NOTIFY_HOSTOUTPUT"]
message = message+"\nService: "+os.environ["NOTIFY_SERVICEDESC"]+" - "+os.environ["NOTIFY_SERVICESTATE"]+"\nService-Plugin-Output:"+os.environ["NOTIFY_SERVICEOUTPUT"]
message = message+"\n-------------------------\n\n"
logging.debug("%s" % message)
xmpp = SendMsgBot("[email protected]", "yourpassword" , os.environ["NOTIFY_PARAMETER_1"], message)
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)
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.
rsync -av web/* ~/local/share/check_mk/web/
sending incremental file list
sent 210,421 bytes received 346 bytes 421,534.00 bytes/sec
total size is 209,125 speedup is 0.99
That’s it. WATO should now show the event console again and things like rule based notification will also work.
Yep… Couldn’t put it more eloquently myself. :-)
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…
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.
# press spacebar when prompted
loader> boot -s
root@switch01# set system root-authentication plain-text-password
# enter some password like juniper1
Reboot the system [y/n] y
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 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
if(isset($_SERVER['HTTP_CF_VISITOR']) && strpos($_SERVER['HTTP_CF_VISITOR'], 'https')) $_SERVER['HTTPS']='on';
And maybe install some kind of HTTPS plugin to get rid of the mixed-content warnings due to residual http:// content from other plugins.