Uncategorized
syslog.tv is now HTTPS enabled
0
I finally stopped being lazy and decided to create an HTTPS version of this blog. I know it's not at all required but I decided it could/would be a good thing to do anyway.
For now due to the blog software being crappy it's showing an invalid certificate due to including resources that are not secured - I'll work on fixing that.
Nagios3 + MK Livestatus + xinetd on Debian 6/Ubuntu
0First we need to make sure we have all the stuff we need to compile mk livestatus and run it
MK Livestatusapt-get install make build-essential xinetd ucspi-unix
Grab the mk livestatus source from here, currently it's version 1.1.10p3 but update the commands below to match your version.
Xinetdwget http://mathias-kettner.de/download/mk-livestatus-1.1.10p3.tar.gz
tar -xvzf mk-livestatus-1.1.10p3.tar.gz
cd mk-livestatus-1.1.10p3
./configure
make && make install
Now that it's compiled we need to write a xinetd config for it, create a new file called /etc/xinetd.d/livestatus and put More >
Introducing…
0I'd like to introduce 2 pieces of software that I've finally gotten round to releasing. Neither are at all new but I guess I'm lazy. Both are written in Python, are opensource and free to use and modify.
Find and replace across multiple files
3I needed to quickly modify 500 hundred XML files, each was about 10MB in size, thankfully Linux makes that pretty fast and very easy.
find . -name "*.xml" -print | xargs sed -i 's/FROM/TO/g'
A semi "real world" example:
find . -name "*.xml" -print | xargs sed -i 's/foo/bar/g'
AFK, an SMS sender and way too much PHP…
0Sadly of late I've been stuck writing nothing but PHP during my work hours. Short of a few major internal disasters I've done nothing I would count as interesting enough to really post about, until recently.
A week or two ago I made some modifications to our internal Nagios monitoring system - http://nagios.com/ - which saw me writing a Python-powered sms script which takes Nagios messages and passes them to our SMS provider API and delivers them to my phone.
The code isn't exactly pretty and it's rather simple but it does the job and uses LXML to actually generate the message that gets More >
Coming soon… Solr research
0Recently I decided that it would be a good idea for the company I work for to start looking in to Apache Solr for use with some of our bigger clients, I will report any fun I find it with back here including installation on Debian/Ubuntu and most likely complain about Jetty and Tomcat because I hate both and am really not looking forward to working with them again, even though I am excited about Solr itself.
Watch this space.
Finding files over a set size with find & awk
0This is a really great simple way to find files on the filesystem that are over 200k in size.
find /path/to/directory/ -type f -size +200k -exec ls -lh {} ; | awk '{ print $NF ": " $5 }'
You can use the output of this to either store in a file, or pipe to wc for a count of lines
find /path/to/directory/ -type f -size +200k -exec ls -lh {} ; | awk '{ print $NF ": " $5 }' | wc -l
You can also use egrep before wc to look for specific filetypes
find /path/to/directory/ -type f -size +200k -exec ls -lh {} ; | awk '{ print $NF ": " $5 }' | egrep '(jpg|bmp|gif|tiff|jpeg)' | wc -l
less is more
1To my surprise I have found that there are still people out there who use "more", this has shocked me.
So this is a very, very short blog post to tell those who visit that less is more and more is less.
What?less is a command that comes as standard in almost all Linux distros now, and unlike more it actually has the ability to do backwards and forwards scrolling with Page Up, Page Down, arrow keys and spacebar. It's a fantastic little command!
less FILE
Very simple to use and an all round great tool. The best thing about less is it doesn't need to read the whole file in one go, it reads in More >

