Installing Zabbix to integrate with LucidWorks

Installing Zabbix to Integrate with LWE and Solr

This is a knowledge base article which is intended to help speed you through the process of setting up zabbix for LucidWorks and Solr. We often get questions about monitoring of which there is a rich source of information that a tool like zabbix can take advantage of, that is hard to replicate. We also ship monitoring templates with LWE that you can instantly plug-in to Zabbix and monitor all the stuff you care about at the click of a few buttons. In another article I will discuss some of the things that we are looking at and that you can setup with zabbix.

This will be a basic install using mysql as the backend. I will point you to the particular parts of the documentation that you need to pay attention to and describe the relevant steps to get going. This article will be using zabbix 2.0 since it has JMX support. The install is being done on an OpenSUSE 12.2 installation, so other operating systems may need tweaks in exactly how these tasks are performed or packages which need to be downloaded. Finally, this does not constitute a recommendation for LWE/solr on OpenSUSE. So let's begin!

 

The relevant steps are going to be:

  1. Making sure you have the proper requirements

    1. The requirements for Zabbix can be found here: http://www.zabbix.com/documentation/2.0/manual/installation/requirements

      • The big ones: a C compiler such as gcc, make, a recent JDK, mysqlserver and client or other backend) and you will need to make sure you have the proper devel packages for libcurl-devel, libmysql-devel as well as packages for apache2, php5 and some associated php5 packages we can worry about later. Zabbix will complain about if you don't have them and your package manager should be able to look them up. So it is not necessary up front. It may also be useful to have mysql-workbench.

         

  2. Download the source, create database, configure and make it.

    1. Download location: http://www.zabbix.com/download.php

    2. Zabbix install documentation: http://www.zabbix.com/documentation/2.0/manual/

    3. Add user zabbix and group zabbix (though not required) as zabbix is better run in a user-space.

    4. Create zabbix database and create a database user with proper privileges. It may be easier to do this in mysql-workbench (make sure /etc/my.cnf is readable by you).

      • – mysql-workbench> Create server instance

      • – mysql-workbench> Add user zabbix and give it privileges.

      • Zabbix has scripts to create the database. You will need to do the following:

        shell> cd <zabbix_source_dir>
        shell> mysql -u<username> -p<password>
        mysql> create database zabbix character set utf8;
        shell> mysql -u<username> -p<password> zabbix 
        mysql> source database/mysql/schema.sql
        # stop here if you are creating database for Zabbix proxy
        mysql> source database/mysql/images.sql
        mysql> source database/mysql/data.sql
        mysql> quit;
    5. cmd> ./configure –enable-server –enable-agent –enable-java –with-mysql –with-libcurl

    6. cmd> sudo make install

       

  3. Install apache2 with php5

    1. Make sure php5 is included with your install. You may need to download a php5 package and configure apache. On OpenSUSE you need to download the packages: php5, apache2-mod_php, php5-bcmath, php5-gd, php5-gettext, php5-mbstring, php5-mysql, php5-sockets. Zabbix will complain if you are missing anything, so if you are missing something, just use your package tool to search for what you need.

    2. Copy the frontend stuff to your htdocs/zabbix directory.

      • cmd> cd <htdocs>

      • cmd> mkdir zabbix

      • cmd> cp -r <zabbix_src>/frontends/php/* zabbix

    3. Go to http://localhost/zabbix

    4. You will likely have a few more configuration changes necessary. You need to edit your php.ini setting for your installation. (OpenSUSE: /etc/php5/apache2/php.ini)

       

  4. Configure and start zabbix_server, zabbix_agentd and Java Gateway

    1. Read: http://www.zabbix.com/documentation/2.0/manual/concepts/java. In short – to use Java you have to start another process – the Java Gateway which will proxy requests to your JMX host. So you have to configure it all as part of the server.

    2. Config files are located at /usr/local/etc/

      • zabbix_agentd.conf – Important items

        • Hostname=<hostname>

      • zabbix_server.conf – Important items

        • DBHost=<hostname>

        • DBName=zabbix

        • DBUser=<zabbix_user>

        • DBPassword=<zabbix_pwd>

        • StartPollers=<5>

        • JavaGateway=<java_gateway_host:localhost> (Java settings are very important if you want to use JMX – read the docs!)

        • JavaGatewayPort

        • StartJavaPollers=<5>

    3. Start-em 'up

      • cmd> zabbix_server

      • cmd> zabbix_agentd

      • cmd> cd /usr/local/sbin/zabbix_java; ./startup.sh

      • You may want a script to do this. This is a very basic script could be vastly improved, however, it will work as a startup script

         

#!/usr/bin/env bash

#

#

#

#

### BEGIN INIT INFO

# Provides: zabbix

# Required-Start: $network $remote_fs

# Required-Stop: $network $remote_fs

# Default-Start: 3 5

# Default-Stop:

# Short-Description: Starts Zabbix Server, Agent and Java Gateway

# Description: Starts Zabbix Server, Agent and Java Gateway

### END INIT INFO

 

zabbix_server

zabbix_agentd

rm -f /tmp/zabbix_java.pid

/usr/local/sbin/zabbix_java/startup.sh

 

Zabbix will use either the userspace that starts it or user zabbix if started by root.

 

  1. Setup LWE/Solr for JMX Mbeans

    1. Goto conf/master.conf (LWE) or just use on the command line for Solr

      • Add -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=<12345> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

    1. Startup Lucidworks and create some items in Zabbix to monitor. To start, you can open up jconsole and checkout things you think are important. The neat thing with Zabbix is that it has functions such as: sum(), avg(), last(), change() and triggers. So we can do cool things like trigger an alert if the last full gc was over 3 sec. Or you want an alert if the percent of time spent in GC over the last 5 minutes is too high. But more on that type of stuff later. It really is quite a nice setup when you get it all going and well worth the effort.

       

  1. Drink a celebratory beverage of your choice! <-- actually the editor I'm using doesn't seem to want to put these last items in the correct order. However, drinking the celebratory drink as step 1 may work as well.

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk