Like with other free software / indieweb projects, lot of development discussion regarding Known takes place on the IRC channel #Knownchat.

I lurk there, but I kept missing stuff, and besides it’s useful to have a log of some of the conversations. I think the founders were going to set something up, but since I know they’re very busy, I thought it’d be useful to hack something together until something better comes along.

So, I hacked together a quick bot IRC logging bot.

This bot outputs logs in Markdown, and I’ve set up a quick cronjob that will take those logs once a day and push them to a github repository for everyone to see.

Pending something better, I thought this might be useful. Standard caveat; these logs should in no way be considered “official” or endorsed by the project, I made them for my own use with hopes that they’ll be handy for other folk as well.

» View #Knownchat logs...

I’ve previously documented how I’ve previously used Known to track system events generated by various pieces of hardware and various processes within my (and my client) infrastructure.

Like many, I use a UPS to keep my servers from uncontrolled shutdowns, and potential data loss, during the thankfully rare (but still more common than I’d like) power outages.

Both my UPS’ are made by APC, and are monitored by a small demon called apcupsd. This demon monitors the UPS and will report on its status, from obvious things like “lost power” and “power returned”, but also potentially more important things like “battery needs replacing”.

While some events do trigger an email, other messages are written to the console using the wall command, so are less useful on headless systems. Thankfully, modifying the script is fairly straightforward.

Setting up your script

First, set your script as you did for nagios. Create an account from within your Known install, and then grab its API key, then put it in a wrapping script.

#!/bin/bash

PATH=/path/to/BashKnown:"${PATH}"

status.sh https://my.status.server apc *YOURAPICODE* >/dev/null

exit 0

I need to Pee

The next step is to modify /etc/apccontrol to call your wrapper script.

I wanted to maintain the existing ‘post to wall’ functionality as well as posting to my status page. To do this, you need to replace the definition for WALL at the top of the script, and split the pipe between two executables.

To do this you need a command called pee, which is the pipe version of tee, and is available in the moreutils package on debian based systems. So, apt-get install moreutils.

Change:

WALL=wall

To:

WALL="pee 'wall' '/path/to/wrapperscript.sh'"

Testing

To test, you can run apccontrol directly, although obviously you should be careful which command you run, as some commands fire other scripts.

I tested by firing:

./apccontrol commfailure

Happy hacking!

Ok, so earlier I talked a bit about a Flickr photo import script for Known.

Since self-dogfooding is important, I thought I’d point you guys to my new photos site, which uses the data produced by the script’s output.

My script imports all photos, videos and tags, and also stores collections and sets.

Known currently doesn’t have a concept of grouping stuff together (although this might be on the roadmap for the future), so for the time being I’ve stored them as a GenericDataItem object. The site’s custom theme makes use of these to render sets and collections in a sensible way.

Still tweaking, but I’m pretty pleased with the results so far!