Zabbix - andreydiveev/wiki GitHub Wiki

Quick agent install (Debian 8):

wget http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix-release/zabbix-release_3.0-1+jessie_all.deb && \
dpkg -i zabbix-release_3.0-1+jessie_all.deb && \
apt update && apt install zabbix-agent && \
export ZABBIX_SERVER_IP="$(dig +short zbx.adiv.pw)" && \
sed -i "s/Server=127.0.0.1/Server=$ZABBIX_SERVER_IP/g" /etc/zabbix/zabbix_agentd.conf && \
sed -i "s/ServerActive=127.0.0.1/ServerActive=$ZABBIX_SERVER_IP/g" /etc/zabbix/zabbix_agentd.conf && \
service zabbix-agent restart

Ubuntu 14.04 LTS:

wget http://repo.zabbix.com/zabbix/2.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_2.2-1+trusty_all.deb
dpkg -i zabbix-release_2.2-1+trusty_all.deb

Debian 7 (Wheezy):

wget http://repo.zabbix.com/zabbix/2.2/debian/pool/main/z/zabbix-release/zabbix-release_2.2-1+wheezy_all.deb
dpkg -i zabbix-release_2.2-1+wheezy_all.deb

Debian 8 (Jessie):

wget http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix-release/zabbix-release_3.0-1+jessie_all.deb
dpkg -i zabbix-release_3.0-1+jessie_all.deb

Debian 9 (Stretch):

wget http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix-release/zabbix-release_3.0-2+stretch_all.deb
dpkg -i zabbix-release_3.0-2+stretch_all.deb

Install:

# apt update
# apt install zabbix-agent zabbix-server-mysql zabbix-frontend-php

# export ZABBIX_SERVER_IP="$(dig +short zabbix.example.org)"

# sed -i "s/Server=127.0.0.1/Server=$ZABBIX_SERVER_IP/g" /etc/zabbix/zabbix_agentd.conf
# sed -i "s/ServerActive=127.0.0.1/ServerActive=$ZABBIX_SERVER_IP/g" /etc/zabbix/zabbix_agentd.conf

# service zabbix-agent restart
# service zabbix-server start

# ln -s /usr/share/zabbix/ /var/www/zabbix

# mysql -uroot -p \
    -e "create database zabbix character set utf8 collate utf8_bin;" 
# mysql -uroot -p \
    -e "grant all privileges on zabbix.* to zabbix@'%' identified by 'password';"
# mysql -uroot -p \
    -e "flush privileges;"

# apt-get install dpkg-dev
# apt-get source zabbix-server-mysql
# cd zabbix-*
# cd database/mysql
# cat schema.sql images.sql data.sql | mysql -uzabbix -v -p zabbix

# cp /usr/share/zabbix/conf/zabbix.conf.php.example /etc/zabbix/web/zabbix.conf.php
# cat /etc/zabbix/web/zabbix.conf.php
# cat /etc/zabbix/zabbix_server.conf | grep DBPassword

Base-auth:

htpasswd -c /etc/nginx/.htpasswd exampleuser

Nginx config:

server {
    listen 80;

    root /usr/share/zabbix;
    access_log /var/log/nginx/zabbix.access.log;
    server_name zabbix.site.org;

    location / {
        auth_basic "Please, sign in:";
        auth_basic_user_file /etc/nginx/.htpasswd;
        index index.php index.html index.htm;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_param PHP_VALUE "
            max_execution_time = 300
            memory_limit = 128M
            post_max_size = 16M
            upload_max_filesize = 2M
            max_input_time = 300
            date.timezone = Europe/Moscow
            always_populate_raw_post_data = -1
        ";
        fastcgi_buffers 8 256k;
        fastcgi_buffer_size 128k;
        fastcgi_intercept_errors on;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
    }
}

Default login:

Admin
zabbix