Wednesday 18 May 2016

Installing Zabbix 3 on a Raspberry Pi

For those of you out there unfamiliar with Zabbix - it's a pretty awesome Open Source monitoring platform. It's really customisable and allows you to create some pretty nifty dashboards.Check out their website for more info. So, to start with I'm using a Raspberry Pi 2 Model B with Raspbian Jessie installed.

Install Prerequisites

First off we need to install install all Zabbix prerequisites. To install, open up a terminal or SSH into your Pi.

sudo apt-get install \
    mysql-server \
    php5 \
    apache2 \
    php5-gd \
    php5-mysql \
    php5-ldap \
    snmpd \
    libiksemel3 \
    libodbc1 \
    libopenipmi0 \
    fping \
    ttf-dejavu-core \
    ttf-japanese-gothic

When prompted, enter the root user password for MySQL and write it down somewhere.

Install Zabbix 3 Packages

Luckily for us someone has compiled the Zabbix 3 packages for the Raspberry Pi over at https://github.com/imkebe/zabbix3-rpi, so we don't need to compile it ourselves. Again, bring up a console, and let's dive in.
cd ~
wget https://github.com/imkebe/zabbix3-rpi/archive/master.zip
unzip master.zip cd zabbix3-rpi-master sudo dpkg -i zabbix-server-mysql_3.0.*+jessie_armhf.deb sudo dpkg -i zabbix-frontend-php_3.0.*+jessie_all.deb sudo dpkg -i zabbix-agent_3.0.*+jessie_armhf.deb sudo service apache2 reload

Setup the Zabbix Database

Ok, so the Zabbix server stores all its data in a database... and we're using MySQL. These instructions are derived from the original Zabbix database documentation.
mysql -uroot -p<password> -e "create database zabbix character set utf8 collate utf8_bin;"
mysql -uroot -p<password> -e "grant all privileges on zabbix.* to zabbix@localhost identified by '<db-password>';"
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p<db-password> zabbix
Obviously you'll need to substitute <password> and <db-password>.

Configure Zabbix

We now need to let the server and front end how to connect to the database. To do this, we edit a bunch of config files. I'm going to use vi.
sudo vi /etc/zabbix/zabbix_server.conf
Now, we edit the file. If you've used the defaults in this guide (database name zabbix and database user zabbix), all you need to do is uncomment the DBPassword entry and enter you zabbix database password.
DBPassword=<bd-password>
Next we set our time zone for the front-end. We edit
sudo vi /etc/apache2/conf-enabled/zabbix.conf
Uncomment the php_value date.timezone entry and enter your timezone. You can see http://php.net/manual/en/timezones.php for supported timezones.
php_value date.timezone Australia/Sydney
Restart services so that our changes take.
sudo service apache2 restart
sudo service zabbix-server start
sudo service zabbix-agent start
Now we've setup the backend. We need to fire up our web browser and head over to http://<your-pi-ip-address>/zabbix or http://localhost/zabbix if you're using the Raspberry Pi desktop browser. Go through the screens until you get to the "Configure DB connection" section, where you just need to make sure you enter the correct database username and password.
Once the front end configuration is complete, we get the login screen.
The default user is 'Admin' with password 'zabbix'.

14 comments:

  1. " The frontend does not match Zabbix database. " I get this error while installing. Does anyone know why ?

    ReplyDelete
  2. 素晴らしい。

    掲載してくた事に感謝。

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. I am getting the error whenever I try to install it. Is there something which I might be missing in it? I have followed the given coding.

    ReplyDelete
  5. Illuminate Zabbix Server MySQL Issue through MySQL Server 5.0 Support
    Assume on the off chance that you introduce Zabbix on Centos6 framework yet in the meantime you found that issue with your MySQL database availability then how you can tackle it? Note that, with Cognegic's MySQL Remote Support or MySQL Remote Service you will get the profound comprehension of your MySQL issues and furthermore you will get the execution subtle elements of SQL arrangement, database qualities et cetera. You can basically get in touch with us by means of dialing our without toll number and get the best help through Cognegic's MySQL Backup Database.
    For More Info: https://cognegicsystems.com/
    Contact Number: 1-800-450-8670
    Email Address- info@cognegicsystems.com
    Company’s Address- 507 Copper Square Drive Bethel Connecticut (USA) 06801

    ReplyDelete
  6. GREAT topic! It is really interesting to read from the beginning & I would like to share your blog to my circles, keep

    sharing… DevOps Online Training
    DevOps Training
    DevOps Online Training

    ReplyDelete
  7. If you buy SD card with 95MB/s Read/Write or more, make OS, Zabbix, and DB optimization, you will be able to monitor 400 devices gathering 125 metrics every 5 minutes from each device. I have documented installation and tweaks in this guide:
    https://bestmonitoringtools.com/how-to-install-zabbix-on-raspberry-pi-raspbian/

    ReplyDelete