..

Zabbix/Grafana Installation and SNMP Trap Setup

CentOS 7 + Zabbix 4.0

# yum install epel-release
# yum install yum-utils
# yum-config-manager --enable rhel-7-server-optional-rpms

Zabbix Installation

Adding Zabbix Repository

# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

MySQL

# rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
# sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo
# yum --enablerepo=mysql80-community install mysql-community-server
# systemctl start mysqld.service
# grep "A temporary password" /var/log/mysqld.log
# mysql_secure_installation
# systemctl restart mysqld.service
# systemctl enable mysqld.service
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user 'zabbix'@'localhost' identified by '<password>';
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';
mysql> alter user 'zabbix'@'localhost' identified with mysql_native_password by '<password>';
mysql> quit;

Zabbix Server

# yum install zabbix-server-mysql zabbix-web-mysql
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
# firewall-cmd --zone=public --add-port=80/tcp --permanent
# firewall-cmd --reload

/etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=<password>

/etc/httpd/conf.d/zabbix.conf

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 max_input_vars 10000
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Taipei

Following up by frontend installation steps.

SELinux Configuration

# setsebool -P httpd_can_connect_zabbix on

Zabbix Agent

# yum install zabbix-agent
# systemctl enable zabbix-agent.service
# systemctl start zabbix-agent.service

Grafana Installation

/etc/yum.repos.d/grafana.repo

[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
# yum install grafana
# yum install fontconfig freetype* urw-fonts
# systemctl enable grafana-server.service
# systemctl start grafana-server.service
# firewall-cmd --zone=public --add-port=3000/tcp --permanent
# firewall-cmd --reload
# grafana-cli plugins install alexanderzobnin-zabbix-app
# systemctl restart grafana-server

The plugins are installed under /var/lib/grafana/plugins.

Zabbix HTTP URL is http://<zabbix-server-ip>/zabbix/api_jsonrpc.php.

SNMP Trap Setup

# yum install net-snmp net-snmp-utils net-snmp-perl
# yum install perl-Config-IniFiles perl-Sys-Syslog

References