zabbix+nginx+postgresql installation for ubuntu 16.04

 

install begin

cd ~/Downloads

wget http://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb

dpkg -i zabbix-release_3.4-1+xenial_all.deb

apt-get update

cat /etc/apt/sources.list.d/zabbix.list

should added

deb-src http://repo.zabbix.com/zabbix/3.4/ubuntu xenial main

apt-get install nginx postgresql php php-cli php-fpm php-pgsql
php-bcmath php-mbstring php-gd php-xml zabbix-server-pgsql zabbix-frontend-php

reinstall zabbix-frontend-php php-gd when error like :

/var/lib/dpkg/info/zabbix-frontend-php.postinst: 24: /var/lib/dpkg/info/zabbix-frontend-php.postinst: /usr/sbin/a2enconf: not found

reinstall php-pgsql when database type postgresql no appear :

apt-get install php-pgsql

should create

pdo_pgsql.ini bcmath.ini

under

/etc/php/7.0/mods-available

/etc/init.d/nginx restart

postgresql config

sudo su postgres

psql

psql_shell> CREATE USER zabbix WITH PASSWORD 'zabbix';

psql_shell> CREATE DATABASE zabbix WITH ENCODING='UTF-8' OWNER zabbix;

psql_shell> GRANT ALL PRIVILEGES ON DATABASE zabbix to zabbix;

psql_shell> \c zabbix zabbix -- change to zabbix databsae

psql_shell> \d -- verify the tables are owned by user zabbix

psql_shell> \q

zcat /usr/share/doc/zabbix-server-pgsql/create.sql.gz | psql -U zabbix zabbix

exit

vi /etc/postgresql/9.5/main/pg_hba.conf

add lines

local    zabbix          zabbix                                md5
host     zabbix          zabbix          192.168.2.1/32        md5
 vi /etc/php/7.0/fpm/php.ini

find and modify the following items

memory_limit 128M

max_execution_time 300

post_max_size 16M

upload_max_filesize 2M

max_input_time 300

date.timezone YOUR_TIMEZONE

add this to the bottom :

always_populate_raw_post_data -1
 /etc/init.d/php7.0-fpm restart

 vi /etc/zabbix/zabbix_server.conf

modify following:

DBName=zabbix DBUser=zabbix DBPassword=zabbix
 /etc/init.d/zabbix-server restart

nginx config

make a symbolic link

ln -s /etc/nginx/sites-available/zabbix /etc/nginx/sites-enabled/zabbix
ll /etc/nginx/sites-enabled/

symbolic link succeed with show : zabbix -> /etc/nginx/sites-available/zabbix

nignx config file /etc/nginx/sites-enabled/zabbix

upstream php-handler {
  server unix:/var/run/php/php7.0-fpm.sock;
}

 upstream test {
         server 127.0.0.1:80;
}



server {
        listen 80;
        server_name test.local;

location /zabbix {
  if ($scheme ~ ^http:){
      rewrite ^(.*)$  https://$host$1 permanent;
  }
  alias                       /usr/share/zabbix/;
  index                       index.php;
  error_page          403 404 502 503 504  /zabbix/index.php;

  location ~ \.php$ {
      if (!-f $request_filename) { return 404; }
      expires                 epoch;
      include                 /etc/nginx/fastcgi_params;
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_index           index.php;
      fastcgi_pass            php-handler;

      fastcgi_param SCRIPT_FILENAME $request_filename;
  }

  location ~ \.(jpg|jpeg|gif|png|ico)$ {
      access_log      off;
      expires         33d;
  }
}


}

go to http://localhost/zabbix and finish the steps

monitoring dell idrac and windows event logs also see : useful zabbix templates


graphs may not display, mostly a fonts problem

solution:

apt-get install DejaVuSans

ln -s /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf /usr/share/zabbix/fonts/DejaVuSans.ttf

vi /usr/share/zabbix/include/defines.inc.php

modify following:

define('ZBX_GRAPH_FONT_NAME',           'DejaVuSans'); // font file name
define('ZBX_FONT_NAME', 'DejaVuSans');
/etc/init.d/nginx restart