Monday, November 4, 2013

Installing Zabbix on Jelastic

For months, I have looked over several paid and open source server monitoring products, and have seem to landed on Zabbix. It's an enterprise ready, fully open source, fully free, monitor ANYTHING platform. As I have been evaluating Jelastic as a future host for some personal projects, I decided it would be fitting to attempt an installation there. Below you will find the steps I have taken to setup and install Zabbix on the Jelastic platform.

Deploy Zabbix

To kick things off, you need to start by creating a new environment. Log in with your Jelastic credentials. While in the Jelastic dashboard, click the Create environment button. In this case, we only need a VDS and a MySQL* instance. Enter an Environment name and click Create. (*Note for the time being, you may need to enable a public IP in order for the Zabbix server to connect to the database. This will hopefully be corrected soon.)



Once the environment is deployed, you will receive an few emails which include your authentication information for your various servers. Starting with your VDS, you'll need your Login (most likely root), Password, and Public IP. I have found using a standard terminal is much faster than using the web terminal. SSH into your VDS using a command similar to this:
# SSH root@xxx.xxx.xxx.xxx

Of course, you'll need to replace the x's with the actual IP address assigned to your VDS instance. Once connected, you'll need to enter your secure password. From there, its time to install the Zabbix server:
# rpm -ivh http://repo.zabbix.com/zabbix/2.0/rhel/6/x86_64/zabbix-release-2.0-1.el6.noarch.rpm
# yum install zabbix-server-mysql zabbix-web-mysql
You will need to type 'y' a few times to agree to install the various pieces of the application, but in a few moments, the base of the Zabbix server will be installed.

Initialize the database

While still in the VDS terminal, setting up the database is easy. You will need the Access URL, Login, & Password. Enter the following to get the database setup:

# mysql -h{{Access URL}} -uroot -p{{Password}}   
mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
mysql> CREATE USER 'zabbix'@'%' IDENTIFIED BY '{{secure password}}'
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'%';
mysql> EXIT

If you want to be a bit more secure, feel free to replace % with the IP address of your VDS server. That will limit the access to a single IP address. Next, we'll need import the .sql scripts to initialize the database.

# mysql -h{{Access URL}} -uroot -p{{Password}} zabbix < /usr/share/doc/zabbix-server-mysql-2.0.8/create/schema.sql
# mysql -h{{Access URL}} -uroot -p{{Password}} zabbix < /usr/share/doc/zabbix-server-mysql-2.0.8/create/images.sql
# mysql -h{{Access URL}} -uroot -p{{Password}} zabbix < /usr/share/doc/zabbix-server-mysql-2.0.8/create/data.sql

That's it, your base database is now setup and ready to go.

Configure the server

Back on the VDS via the shell (# ssh root@xxx.xxx.xxx.xxx), you'll want to edit the zabbix_server.conf file with the following settings. DBHost will correspond the Access URL included in your confirmation email:
# vi /etc/zabbix/zabbix_server.conf
DBHost=mysql-{{Your server name}}.jelastic.servint.net
DBName=zabbix
DBUser=zabbix
DBPassword={{Your secure password}}

Then, start the Zabbix server:
# service zabbix-server start
Now configure PHP by editing the zabbix.conf file. You'll need to validate/adjust the following settings... Of course adjusting the timezone to match yours:
# vi /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value date.timezone America/Denver

Finally, start the http server:
# service httpd start 

Configure the web interface

You are all set and ready to launch the server! Point your browser at http://xxx.xxx.xxx.xxx/zabbix/, replacing the x's with your IP address, of course. If all went well, you'll see the following Welcome page. Click the Next button.



Here you will see the results of the pre-requisites check. You should have a page of OK's. Click Next.



On the Database configuration page, the Database host will be the Access URL received in the email you received from Jelastic. You'll use zabbix as the Database name and User, along with the secure password you setup. Press the Test connection button.




If all went well, you will get a nice little OK over the Test connection button. Click Next.



The default settings on the Zabbix server details page should be fine. Click Next. Click Next on the pre-installation summary as well. Finally, Click Finish



There you have it. Using the IP address of the VDS, you can now log in with the credentials UN: Admin (case sensitive) and PW: zabbix

Of course you are going to want to change the password right away.


All that is left is installing the Zabbix Agents on your Jelastic instances. For now, it seems the only way to accomplish that will be through the use of their VDS instances. Perhaps in a future release, this could be a plugin to enable the use of their standard server type instances. Regardless, I'll leave the task of installing the Zabbix Agents to a future post.