PG监控基于Zabbix

Zabbix

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
rpm -Uvh https://repo.zabbix.com/zabbix/6.4/rhel/8/x86_64/zabbix-release-6.4-1.el8.noarch.rpm
dnf clean all
dnf module switch-to php:7.4
dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent

su - postgres
createuser -p 15434 --pwprompt zabbix
createdb -O zabbix zabbix


yum install zabbix-server-mysql zabbix-agent -y
#yum install centos-release-scl -y


setenforce 0
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

详细安装流程记录

1
2
3
4
5
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all

yum install zabbix-server-pgsql zabbix-agent
yum install centos-release-scl
1
2
3
4
5
6
vim /etc/yum.repos.d/zabbix.repo

[zabbix-frontend]
...
enabled=1
...
1
yum install zabbix-web-pgsql-scl zabbix-apache-conf-scl
1
2
3
4
5
sudo -u postgres createuser --pwprompt zabbix
sudo -u postgres createdb -O zabbix zabbix

# *代表当前系统中的版本,不同时期不一样
zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix
1
2
3
vim /etc/zabbix/zabbix_server.conf

DBPassword=123
1
2
3
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

; php_value[date.timezone] = Europe/Riga
1
2
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

通过网页访问

1
2
http://172.16.249.130/zabbix
Admin/zabbix