Zabbix 1.8.4 with Postrgesql 9.0 on CentOS 5.5

If there is any single application that I consider myself a complete and utter homer for, it’s Zabbix. I’ve talked about it here, and my hope is to toss out at least one fun Zabbix-related tidbit each week.

Today’s fun is something that I ran into just this past week. We are currently running Zabbix version 1.8.4. The latest stable version of Zabbix is currently 1.8.5, but we’ll likely hold out until Version 2.0 before we upgrade.

A couple of months ago we moved our Zabbix installation off of a shared utility server to it’s very own HP DL-380 full of RAM and hard disks. When we made this move we also upgraded Postgresql from 8.4 to 9.0 using PGDG. All seemed well and good until it came time to build out some really cool maps that Zabbix makes so easy. My first map was going to be a map of the health of our VPN network utilizing some fun network latency checks that I’d just made using Zabbix Simple Checks.

When I went to add the first map background, it said it uploaded it just fine. But in the Zabbix GUI it didn’t show my cool US Map. When I looked at the stock images that come with Zabbix none of them showed up, either. In place of the graphic it simply said “No Image”. Clicking on that link kicked up a PHP error that the data wasn’t a valid image type. Zabbix stores these graphics in the database as BLOBS, and uses php-gd to render them into the page.

After approximately 3 hours of staring at PHP and random googling, I stumbled upon ZBX-3063.

As it turns out, there was a change in Postgresql 9.0 that altered how it outputs binary data. This change caused Zabbix to flip its biscuit a little bit. Happily there’s a simple patch, outlined in the Zabbix issue tracker.

#diff -u
— 2010-09-30 13:14:29.000000000 +0400
+++ 2010-09-30 14:12:21.000000000 +0400
@@ -83,6 +83,10 @@
$error = ‘Error connecting to database’;
$result = false;
+/* if pg_version exist and begins with the nines then set bytea_output = ‘escape’, as PG9 new hex bytea default type output. */
+ elseif(($ver = pg_version($DB[‘DB’])) && preg_match(‘/^9.*/’,$ver[‘server’])){
+ DBexecute(‘set bytea_output = escape’);
+ }
case ‘ORACLE’:
$connect = ”;

And *POOF*. An apache reload and Zabbix is happily rendering my cool maps and dots. Click the pic below to enlarge.

5AM VPN Health map.
5AM VPN Health map.

One of the coolest things about Zabbix is the ability to create maps. In this map each dot represents one of our VPN endpoints, changing colors if issues arrive. Each line changes color depending on VPN latency and packet loss as well.  Total time to make it – 20 minutes.



One thought on “Zabbix 1.8.4 with Postrgesql 9.0 on CentOS 5.5

Something to Add?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s