Customizing the MaxMind GeoIP2 database

Documentation exists for the old MaxMind GeoIP databases but I found myself needing to add some RFC1918 addresses into the DB for a logstash configuration. This was a bit of a pain so I figured I’d share for others who want to do the same. This script is setup to use the MaxMind::DB::Reader::XS and MaxMind::DB::Writer::Tree perl modules. (I gave up perl 20 years ago. Every time you think you’re out, they pull you back in!) Anyway, the XS module requires…

Read More

LIO vs STGT

Some thoughts after a failed experiment with linux iscsi target services. The debate between SCST, STGT, LIO, etc is virtually religious. I ran STGT for about 8 years and the only real complaint I had was a lack of survivability under some less than graceful reloads and particularly, restarts. That said it was fast, stable and simple. However after needing to rebuild the storage server from the ground up, everything I read said that the focus was now on LIO so…

Read More

Using Zabbix 3.2 with Centos and SELinux

There are others out there using zabbix who have run into the same SElinux difficulties as myself. Many people will say “just disable SElinux”. But if you don’t want to do that, here’s how you make it work. Install the zabbix repo for yum: rpm -Uvh https://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm Install the zabbix agent: yum install zabbix-agent Install the SElinux policy core utilities: yum install policycoreutils-python Edit your zabbix config file: vi /etc/zabbix/zabbix_agentd.conf (Yes, you have to use vi. Or else. Just learn it already. Vi is…

Read More

Monitoring ELK dataset with Ruby

As a longtime elasticsearch/logstash user, one of the things I’ve always planned to do was setup basic rules-based monitoring of elasticsearch for correlation and alerting. I’ve broken ground on the work to do so and am sharing this simple framework for anyone who would like to expand upon it. All of this was put together over 2 days having never used ruby before so this should not be taken as an opportunity to assess the quality of the code. Functionality and security…

Read More

Continuing the saga with Google Nearline backups

My last write up about backing up to Google nearline with a script had a flaw I pointed out which was the single threaded nature and the slow process to backup a large dataset. Well wait no longer. (If you were waiting.) I’ve added pthread support to the script and an update is attached. You will need to add pthread support to your PHP installation. This will also require ZTS support. Note that a lot of bundled PHP copies do…

Read More

Script for backing up to Google Nearline storage

Recently I’ve been working on a mechanism to mirror a dataset from a local filesystem to Google Nearline cloud storage in an encrypted format. The costs are really the compelling factor. While I could buy some hard drives and put them at another location (called the colo-buddy system!) it just made sense to not have to deal with the logistics, maintenance, power, network, etc… Of course being me, it’s a PHP cli script, because well – me. If you’re looking…

Read More

Purging old indexes from elasticsearch with logstash

Currently doing some work on logstash and found myself wanting to delete indexes over a certain age. The following PHP script gets the job done. I use php as my primary command line scripting language so use or port as interested. #!/usr/bin/php <?php date_default_timezone_set(“America/Chicago”); $index_name = “logstash-“; $purge_age = 300; $elastic = “http://elastic.domain.com:9200”; $data = file_get_contents(“${elastic}/_cat/indices/${index_name}*”); foreach(split(“\n”, $data) as $line) { $split = preg_split(“/\s+/”, $line); if(count($split) > 1) { $date = preg_replace(“/${index_name}|\./”, “”, $split[2]); $split[] = floor((time() – strtotime($date)) /…

Read More

Water still over the bridge

Nearly 8 years to the day and here I am talking about net neutrality again. This is a conversation that refuses to end because in the natural order companies want to maximize their profits and find new revenue streams. However when they want to find those streams without introducing new services or making existing services better it is always opposite the values of the consumer. And in this case they want to muscle it in. They’ve never had such a…

Read More

New Digs

Not all VPS providers are equal. That is to say that you get what you pay for and while I’m paying more than I was, I want to take a minute to make a recommendation for a company that has gone out of their way to help me allocate a new home for many of my web services. In this case I’m talking about Point North Networks / Kickass VPS. You see I have been a customer of burst.net for…

Read More

Filtering output on linux with color

Last night I found myself desperate to read the output of tail but looking for specific content. (Basically tailing a log file and needing to have the fields pop out at me.) There’s no easy colorize command in linux so I did some digging, found something similar and modified it. (This is based on Kenny Moen’s blog entry about baretail on unix.) Anyway, the following perl script will allow any content to be highlighted using a simple regex and a…

Read More