CRUX : Home

Home :: Documentation :: Download :: Development :: Community :: Wiki :: Ports :: Bugs :: Links :: About

Back to wiki start page

Category: Ports

Installing Zabbix - monitoring system

Author

Mikhail Kolesnik

Description

These brief instructions will help you to get started with Zabbix - flexible open source monitoring solution.

Requirements

This text assumes you will use apache web server with mod_php and MySQL database on a local host. It's really easy to use PostgreSQL instead: use '--with-pgsql' in Pkgfile and adjust database/user creation steps with care. (Setting up web server is beyond the scope of this article.)

Web frontend requires few php extensions and php-mysql or php-postgresql depending on your database choice:

 # prt-get depinst apache mod_php php-gd php-bcmath php-mysql 

You'll probably have to increase max_execution_time to 300 seconds and set date.timezone in /etc/php/php.ini or equivalent file.

InnoDB storage engine is used in default sql scripts and is a far better choice than MyISAM for zabbix database tables. So, don't forget to comment out 'skip-innodb' in /etc/my.cnf. However, before creating database (or upgrading) you can run something like this (on your own risk):

  $ sed -i 's|type=InnoDB|type=MyISAM|g' /path/to/zabbix-1.x.x/create/schema/mysql.sql
Note
We are talking about 1.4.x/1.6.x Zabbix versions here. You can safely upgrade from 1.4.x to 1.6.x version (upgrade from 1.1.x to 1.4.x version was not tested). Read the official manual before upgrading.

Instructions

  1. Install the contrib/zabbix_server port with required dependencies:
    # prt-get depinst --post-install zabbix_server
    
  2. Install a few optionall zabbix utilities:
    # prt-get depinst --post-install zabbix_utils
    
  3. Install the monitoring agent daemon on chosen hosts (or at least at the server itself). Zabbix can also use SNMP and simple checks if it is not possible to instal a native agent. See a list of precompiled agents for different platforms. Consult /usr/ports/contrib/zabbix_agentd/README for additional information.
    # prt-get depinst --post-install zabbix_agentd
    
  4. Change server and agent's hostname(address) in /etc/zabbix/zabbix_agentd.conf:
    Server=server.yourdomain
    Hostname=somehost.yourdomain
    
  5. Untar source somewhere:
    $ cd /tmp
    $ tar -zxf /path/to/zabbix-1.x.x.tar.gz
    $ cd zabbix-1.x.x
    
  6. Login as mysql privileged user and create mysql 'zabbix' database, user and password:
    $ mysql -u<username> -p<password>
    mysql> CREATE DATABASE zabbix;
    mysql> CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password_as_is';
    mysql> GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
    mysql> quit;
    $ cd create/schema
    $ cat mysql.sql |mysql -u<username> -p<password> zabbix
    $ cd ../data
    $ cat data.sql |mysql -u<username> -p<password> zabbix
    $ cat images_mysql.sql |mysql -u<username> -p<password> zabbix
    
  7. Copy php-frontend on a web server and make a configuration file writable by the user your web server is running from. It's a good idea to turn on SSL/TLS support on a web server at this point.
    $ mkdir -p /path/to/htdocs/zbx/
    $ cp -R ../../frontends/php/* /path/to/htdocs/zbx/
    $ chown apache /path/to/htdocs/zbx/conf
    
  8. Point web browser to http[s]://server.yourdomain/zbx/ and follow the instructions.
  9. Change these values in /etc/zabbix/zabbix_server.conf:
    DBHost=localhost
    DBName=zabbix
    DBUser=zabbix
    DBPassword=password_as_is
    
  10. Examine and run post-install script (if not already done by prt-get) to create dedicated zabbix user. Start server and agent(s) like:
    # /etc/rc.d/zabbix_server start
    # /etc/rc.d/zabbix_agentd start
    
  11. Optionally add the following lines to /etc/services:
    zabbix_agent 10050/tcp
    zabbix_trap 10051/tcp
    

Now you must be able to log in. Default frontend user is 'Admin', password is 'zabbix'.

Additional Zabbix resources:
Official manual
Support forum
Wiki