Just so fresh and so clean

Occasionally I have to clear all the logs on a Windows system, if it’s reasonably new then the following command run in PowerShell as an administrator (Right-Click then ‘Run As Administrator) should do just that.


Icinga plugin state UNKNOWN after upgrade

I was updating the monitoring setup at work the other day and suddenly got hit by a few State: UNKNOWN - **ePN /usr/lib/nagios/plugins/check_rbl: plugin did not call exit() messages.

When the plugin was executed outside of Icinga it worked fine, online searches revealed nothing of use, I spent ages trying to adjust the config file and check command for the plugin but with no success.

Eventually I was able to track it down to the embedded Perl interpreter used by Icinga. The solution was fairly simple I just had to add nagios: -epn as a comment within the first 10 lines of the script. This told Nagios to use an external Perl interpreter when running this plugin.

This solution should apply to anything based on Nagios by the way: Icinga, Shinken, Centreon-Engine, Opsview, etc.


Fear not for I have returned

It’s been a while since I last updated and the truth is I just don’t have time to write proper blog posts. Keeping that in mind, but still wishing to keep this up-to-date. I’ve decided to post quick tips and snippets that I find useful. Here’s the first:

I’ve been doing some database work recently and I wanted to unify the character set and collation for all databases and tables. Changing the database collation was easy to do in bulk. The tables less so and I was not manually changing 13,014 tables, eventually I came up with this:

That should generate a bunch of statements that look like this:

For every table in every database except the information_schema, mysql and performance_schema databases. I just pipe these right back in to MySQL but you can output them to a text file and run that later if you prefer. This snippet should also to be useful for any mass/multiple/bulk table edits or changes.


Mounting a case-insensitive filesystem on Linux

Recently I had a web developer who was coding on a Linux server, he was used to working on Windows servers and was having problems dealing with the case sensitivity of the EXT3 filesystem. I looked into it and in addition to using the Apache mod_speling module, also decided to go a step further. As root or using sudo do the following:

  1. Create a file of the size you wish the filesystem to be, 1GB in this example:
  2. Format the filesystem, fat32 in this example but you can use NTFS or another case-insensitive file system:
  3. Mount the filesystem and test it, you may wish to use uid= and gid= to mount it as a specific user and you’ll probably want to adjust the umask to something less permissive:
  4. Add this to /etc/fstab so that it gets mounted after a reboot:

I wouldn’t use this for production systems, in that situation I’d recommend a dedicated FAT32 or NTFS partition. If you do have to run this on a production system it should be fine for 99% of setups, it just feels like a quick hack to me.


Vim SnipMate plugin error and how to fix it

I have been moving back and forth between Emacs and Vim for about two years trying to pick one, I think Vim has finally won. I’ve been putting together a .vimrc and plugin set since then. I may write more on why I went with Vim and on my setup later, but I had a problem recently and I thought I’d post the fix I used:

I had just installed the SnipMate plugin which mimics the snippet functionality of TextMate, and every time I restarted I got an error stating:

I did some troubleshooting and narrowed it down to the cpoptions=ces$ line in my .vimrc. This line makes the cw command and similar commands put a $ at the end instead of just deleting text and replacing it. I could see no reason for me to need this and just removed the line. That setting then defaulted back to cpoptions=aABceFs and the error was gone.