Getting Zabbix "1.8.cassa" to work with Thrift 0.8.0 ---------------------------------------------------- Andris Mednis at zabbix com 2012.07.26 1. Download Thrift 0.8.0 source code. http://www.apache.org/dyn/closer.cgi?path=/thrift/0.8.0/thrift-0.8.0.tar.gz 2. Verify its PGP signature or MD5 checksum. 3. Unpack Thrift source code. To preserve old Thrift installation, let's put the new one in a different place, for example, in /opt: # cd /opt # tar zxf thrift-0.8.0.tar.gz As this will be a custom patched Thift, let's rename it to avoid confusion with standard Thrift: # mv thrift-0.8.0 thrift-0.8.0_patched # chown -R andris:andris thrift-0.8.0_patched $ su - andris $ cd /opt Fix permissions (directories are public writable after unpacking): $ find ./thrift-0.8.0_patched -type d -exec chmod og-w {} \; $ cd thrift-0.8.0_patched 4. Patch Thrift. To prevent crashes like described in ZBX-5263, Thrift 0.8.0 must be patched. We have prepared a custom patch file with 2 patches used at Zabbix. Download the patch file from https://support.zabbix.com/secure/attachment/19654/thrift-0.8.0_patch_zabbix.txt Go into Thrift source directory, for example: $ cd /opt/thrift-0.8.0_patched Apply the patch (I put the patch file in /tmp): $ patch -bNp1 -i /tmp/thrift-0.8.0_patch_zabbix.txt patching file compiler/cpp/src/generate/t_c_glib_generator.cc patching file lib/c_glib/src/transport/thrift_socket.c 5. Compile Thrift. I configured only minimum: $ sh configure --prefix=`pwd` --with-c_glib --without-csharp --without-java --without-erlang --without-python --without-perl --without-php --without-php_extension --without-ruby --without-haskell --without-go ... thrift 0.8.0 Building code generators ..... : Building C++ Library ......... : yes <--- Make sure you have 'yes' here Building C (GLib) Library .... : yes <--- and here ! Building Java Library ........ : no Building C# Library .......... : no Building Python Library ...... : no Building Ruby Library ........ : no Building Haskell Library ..... : no Building Perl Library ........ : no Building PHP Library ......... : no Building Erlang Library ...... : no Building Go Library .......... : no Building TZlibTransport ...... : yes Building TNonblockingServer .. : no ... $ make $ make install ... ---------------------------------------------------------------------- Libraries have been installed in: /opt/thrift-0.8.0_patched/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- ... 6. Cassandra interface files for Zabbix. Zabbix "1.8.cassa" branch includes 4 generated and patched Cassandra interface files: src/libs/zbxcassa/cassandra.c src/libs/zbxcassa/cassandra.h src/libs/zbxcassa/cassandra_types.c src/libs/zbxcassa/cassandra_types.h They were generated using Thrift 0.7.0, but are working with Thrift 0.8.0, too. So, no need to change them. Now Thrift 0.8.0 is ready. Let's continue with Zabbix server. 7. Download Zabbix "1.8.cassa" branch. For example: $ svn co svn://svn.zabbix.com/branches/1.8.cassa ... Checked out revision 29161. $ cd 1.8.cassa 8. Configure Zabbix. $ ./bootstrap.sh To get it working with our new Thrift installation which is in /opt/thrift-0.8.0_patched/, edit Zabbix "configure" script. $ vi configure Find strings CASSANDRA_CPPFLAGS="-I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/local/include/thrift" CASSANDRA_LDFLAGS="" and replace with CASSANDRA_CPPFLAGS="-I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -I/opt/thrift-0.8.0_patched/include/thrift" CASSANDRA_LDFLAGS="-L/opt/thrift-0.8.0_patched/lib" Run configuration script, for example: $ ./configure --enable-server --enable-agent --with-pgsql --prefix=`pwd` --with-cassandra ... Configuration: Detected OS: linux-gnu Install path: /home/andris/ZBX-5263/1.8.cassa Compilation arch: linux Compiler: gcc Compiler flags: -Wall -Wuninitialized -O -g -Wdeclaration-after-statement -I/usr/include/postgresql -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -I/opt/thrift-0.8.0_patched/include/thrift Enable server: yes Server details: With database: PostgreSQL WEB Monitoring via: no Native Jabber: no SNMP: no IPMI: no SSH: no Linker flags: -rdynamic -L/usr/lib -L/opt/thrift-0.8.0_patched/lib Libraries: -lm -lresolv -lpq -lglib-2.0 -lgobject-2.0 -lthrift -lthrift_c_glib ... 9. Compile and install Zabbix. $ make dbschema $ make install Install Zabbix PHP frontend. 10. Set library path. To load our new Thrift libraries set LD_LIBRARY_PATH: $ export LD_LIBRARY_PATH=/opt/thrift-0.8.0_patched/lib Check which libraries will be loaded: $ ldd sbin/zabbix_server | grep thrift libthrift-0.8.0.so => /opt/thrift-0.8.0_patched/lib/libthrift-0.8.0.so (0x00007f19082ea000) libthrift_c_glib.so.0 => /opt/thrift-0.8.0_patched/lib/libthrift_c_glib.so.0 (0x00007f19080d6000) Seems good - libraries are from /opt/thrift-0.8.0_patched/. 11. Start Zabbix. Before running Zabbix, don't forget to set LD_LIBRARY_PATH to the new Thrift: $ export LD_LIBRARY_PATH=/opt/thrift-0.8.0_patched/lib Then start Zabbix agent and server: $ ./sbin/zabbix_agentd -c ~/ZBX-5263/zabbix_agentd.conf $ ./sbin/zabbix_server -c ~/ZBX-5263/zabbix_server.conf I hope this helps.