Instalación Zabbix 3.4

From Zabbix-ES
Jump to navigation Jump to search

Instalacion de software adisional

# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
# yum install zabbix-server-pgsql zabbix-web-pgsql zabbix-agent zabbix-get
# yum install httpd httpd-devel -y
# yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml
# yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-1.noarch.rpm
# yum install postgresql10 -y 
# yum install postgresql10-server -y
# /usr/pgsql-10/bin/postgresql-10-setup initdb
# systemctl enable postgresql-10
# vi /usr/lib/systemd/system/postgresql-10.service
LimitNOFILE=750000
LimitNPROC=750000
# systemctl start postgresql-10

Configurar el PostgreSQL

# su - postgres
$ psql -c "alter user postgres with password 'zbxpsw'"
$ createuser zabbix -P -S -R -D
$ createdb -O zabbix -E UTF8 zabbix

# vi /var/lib/pgsql/10/data/pg_hba.conf
# “local” is for Unix domain socket connections only
local   all             all                                     trust

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust

# IPv6 local connections:A
host    all             all             ::1/128                 trust
# systemctl restart postgresql-10.service
# zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | /usr/pgsql-10/bin/psql -U zabbix zabbix -W

Instalar y configurar HTTPD

# systemctl start httpd
# systemctl enable httpd

Instalar y Configurar PHP

# vi /etc/php.ini
date.timezone = "Europe/Madrid"
# systemctl restart httpd

Configuracion Zabbix HTTPD

# vi /etc/httpd/conf.d/zabbix.conf
#
# Zabbix monitoring system php web frontend
#

Alias /zabbix /usr/share/zabbix

<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Require all granted

    <IfModule mod_php5.c>
        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 always_populate_raw_post_data -1
        php_value date.timezone Europe/Madrid
    </IfModule>
</Directory>

<Directory "/usr/share/zabbix/conf">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/app">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/include">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/local">
    Require all denied
</Directory>
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBPort=5432
DBName=zabbix
DBUser=zabbix
DBPassword=zbxpsw
# systemctl start zabbix-agent
# systemctl start zabbix-server
# systemctl start httpd
# systemctl enable zabbix-agent
# systemctl enable zabbix-server
# systemctl enable httpd
http://192.168.1.10/zabbix/setup.php
Usr: Admin
Psw: zabbix


Configuracion de Zabbix Frontend (PHP)

# /etc/zabbix/web/zabbix.conf.php
$DB['TYPE']     = 'POSTGRESQL';
$DB['SERVER']   = '192.168.1.10';
$DB['PORT']     = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER']     = 'zabbix';
$DB['PASSWORD'] = 'zbxpsw';


Pre-installation summary

Please check configuration parameters. If all is correct, press "Next step" button, or "Back" button to change configuration parameters.
Database type PostgreSQL
Database server  localhost
Database port default
Database name zabbix
Database user zabbix
Database password   ********
Database schema  

Zabbix server localhost
Zabbix server port  10051
Zabbix server name  zbxssoo02

Configuracion del Agente

# vi /usr/local/etc/zabbix_agentd.conf
LogFile=/tmp/zabbix_agentd.log
DebugLevel=2
Server=192.168.1.10,127.0.0.1
ListenPort=10050
ServerActive=192.168.1.10,127.0.0.1
UserParameter=svc.site[*],/usr/bin/svcs -a | /usr/bin/egrep -i -c 'online.*site' | /usr/bin/egrep -v -c $1
UserParameter=svc.site.byname[*],/usr/bin/svcs -a | /usr/bin/egrep -i online | /usr/bin/egrep -i -c $1 | /usr/bin/egrep -v -c 1
UserParameter=discover.svc,/var/adm/ssoo/bin/ssoo_services $1
UserParameter=check.svc[*],/usr/bin/svcs -a | /usr/bin/egrep "online.*site" | /usr/bin/egrep -ic $1
# svcadm restart ZabbixAgent

Configuracion del Server

$ vi /etc/zabbix/zabbix_server.conf
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogFileSize=0
LogFile=/var/log/zabbix/zabbix_server.log
LogSlowQueries=3000
PidFile=/var/run/zabbix/zabbix_server.pid
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
SocketDir=/var/run/zabbix
Timeout=4
DBHost=localhost
DBName=zabbix
DBPassword=zbxpsw
DBUser=zabbix
#
# Personalizados
#
MaxHousekeeperDelete=15000
FpingLocation=/usr/bin/fping
Fping6Location=/usr/bin/fping6
VMwareFrequency=60
VMwareCacheSize=32M
ValueCacheSize=64M
TrendCacheSize=64M
StartVMwareCollectors=4
StartSNMPTrapper=1
StartPollersUnreachable=100
StartPollers=256
DebugLevel=3
CacheSize=64M
root@zabbix:/etc/zabbix# service zabbix-server restart

Troubleshooting

Database error: Error connecting to database: Too many connections

MySQL

root@zabbix:/etc/zabbix# vi /etc/mysql/my.cnf
max_connections         = 800
root@zabbix:/etc/zabbix# service mysql restart

PostGreSQL

root@zabbix:/etc/zabbix# vi /var/lib/pgsql/10/data/postgresql.conf
max_connections = 800                   # (change requires restart)
root@zabbix:/etc/zabbix# systemctl restart postgresql-10.service