SL6 and Zabbix 1.8.5

9 05 2011

Someone pointed out to me that my post on compiling Zabbix on CentOS no longer works. Well to be honest, I have switched my CentOS systems to Scientific Linux 6 for a plethora of reasons (Short Story: a lot of the scientific packages we use at work are now being tested on SL6 by the various development groups where they are left up to the community on CentOS. So we jumped to SL6).

Nevertheless, I didn’t want to have bad information posted on my blog so I decided to update.

If you try to use my old post for compiling on SL6 or CentOS you end up with an error message like reader mailo got:
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
make[2]: Leaving directory `/usr/src/redhat/BUILD/zabbix-1.8.5′
make[1]: Leaving directory `/usr/src/redhat/BUILD/zabbix-1.8.5′
+ install misc/conf/zabbix_agent.conf misc/conf/zabbix_agentd misc/conf/zabbix_agentd.conf misc/conf/zabbix_agentd.win.conf misc/conf/zabbix_server.conf misc/conf/zabbix_proxy.conf /var/tmp/zabbix-1.8.5-root/etc/zabbix
install: omitting directory `misc/conf/zabbix_agentd’
error: Bad exit status from /var/tmp/rpm-tmp.54232 (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.54232 (%install)

This is due to a new directory structure in misc/conf/zabbix_agentd. Lennart at Andrew Farley’s blog caught the fix.

Here are the steps to compile now.
1) Download the zabbix spec file into ~/rpmbuild/SPECS/

2) Edit the spec file
2a) Change line 6 from “Version: 1.8.3” to “Version: 1.8.5”
2b) Change line 382 from “install misc/conf/zabbix_{a*,s*,p*} $RPM_BUILD_ROOT%{_sysconfdir}” to “install misc/conf/zabbix_{a*,s*,p*}.conf* $RPM_BUILD_ROOT%{_sysconfdir}”

3) Download Zabbix 1.8.5 from zabbix.com into ~/rpmbuild/SOURCES/

4) Download the patch file into ~/rpmbuild/SOURCES/

5) Build your RPMS!

So all together on the command line:
$ cd ~/rpmbuild/SPECS/
$ wget http://repo.andrewfarley.com/centos/specs/zabbix.spec
$ sed -e 's/1.8.3/1.8.5/' -i zabbix.spec
$ sed -e 's/p\*\}\ /p\*\}.conf\*\ /' -i zabbix.spec
$ cd ~/rpmbuild/SOURCES/
$ wget http://repo.andrewfarley.com/centos/specs/zabbix-centos-log-and-pid-paths.patch
$ wget (find download link from here)
$ cd ~/rpmbuild/SPECS/
$ rpmbuild -bb --target=`uname -m` zabbix.spec

That should be it! So far this is working for me. If I come across any other issues I will fix them here.

Once again, major props to Andrew. And props to Lennart for the fix.

[EDIT] Eric G built RPMs for 1.8.5 and 1.9.3 below in the comments. If you just want to install the RPMs instead of building from source you should be able to use his repo. Thanks Eric G!





CentOS and Zabbix

9 03 2010

[Edit] It has been pointed out to me that this post no longer is working 100%. I have pointed out the errors in the latest post found Here. It should just be a quick edit of the spec file.

I am not shy about the fact that I am a Debian guy. However, the support I have been getting from the CentOS world lately has been absolutely phenomenal. Documentation has been pretty solid and the help from the community has been very supportive. Top that with how robust all the CentOS servers I have worked with over the last few years have been and I am beginning to see why so many people prefer to run this distro. I am not quite to the point of running it on everything, but I DID setup a CentOS box at home for me to play around on. If you don’t think that is a big deal then you don’t understand that it has been years since a non-Debian based distro has graced my home (outside of the occasional testbed and/or virtual machine). Smoothwall was the last non-Debian system and as posted earlier we had a bit of a fallout. So to me it is a big deal that I now have a CentOS system running as part of the ‘Official’ systems at my house.

Still not a huge fan of RPM’s though. I know, I know, It has been almost 7 years since that SUSE disaster, 4 since the big Fedora fiasco, almost 3 since I was able to _kill_ the last Mandrake box I was forced to work on ( the death of that box still gives me happy thoughts ) and it has been a couple of years since that Smoothwall disaster (grr…still get pissed at that one) but I still have a bit of loathing against RPM’s. That and Debian has been very good to me over the years; it always treats me very well (except for Sid because he is a little b***h sometimes)….Anyway, back to the point.

Today I had to update a ton of CentOS boxes to the latest (5.4). So I created my own local mirror to save time. It was actually really easy. First I found a rsync mirror from the CentOS mirrors website.
rsync -avrt mirror /var/www/html/centos/
ln -s /var/www/html/centos/5.4 /var/www/html/centos/5
createrepo /var/www/html/centos/5/
service httpd start

Then checked that the apache server worked by going to http://server/centos.
Then I had to edit /etc/yum.repos.d/CentOS-Base.repo and I replaced “http://mirrorlist.centos.org” with the servers http accessible name. I also had to edit /etc/yum/pluginconf.d/fastestmirror.conf and change enabled=0. That fast mirror plugin would skip my local mirror in the tests and wouldn’t use it. After the edit I was getting GB speeds off the local network and I wasn’t having to hit the main mirrors for all the same updates over and over again. If my upload wasn’t such crap I would open it up for others, but sadly I don’t have those kind of u/l speeds.

Now that I am now taking care of them I wanted to add them to the Zabbix system I had already built for my Debian boxes. The only problem was that my options were either the .deb files I had built for Debian based distros or I could compile everything from source again. Armed with my new knowledge from building out kernel RPM’s I chose a third route. To create my own spec file for Zabbix and do it the rpmbuild way! That quickly turned for the worse…so I went to Google and begged and pleaded for assistance.

Thanks to Andrew Farley I now have a Zabbix.spec file to work with to compile my own rpms! It was literally as simple as downloading the files and compiling. Here are the steps I used:
cd ~/rpmbuild/SOURCES/
wget -c (find latest download link here: http://www.zabbix.com/download.php)
cd ~/rpmbuild/SPECS
wget -c http://repo.andrewfarley.com/centos/specs/zabbix.spec
rpmbuild -bp --target=`uname -m` zabbix.spec
rpmbuild -bb --target=`uname -m` zabbix.spec

Thats it!

Thanks a WHOLE lot to the CentOS team for helping this Debian guy out!
Thanks a WHOLE lot for the spec file Andrew Farley!

And of course Debian and Zabbix are still Awesome! 😀
[Edit] When you install you will need a few packages. Here are the packages and where to get them.
net-snmp-devel : CentOS Base repo
iksemel-devel : http://dag.wieers.com/rpm/FAQ.php#B
php 5.2 : http://wiki.centos.org/HowTos/PHP_5.1_To_5.2