zabbix - yar145/mytestrepo1 GitHub Wiki
Zabbix 6.2, 2-nd aws volume, postgresql 13, timescaldb , ngnix
fdisk /dev/nvme1n1 Command (m for help): n Command (m for help): p Command (m for help): w mkfs.xfs /dev/nvme1n1p1
blkid /dev/nvme1n1p1 /dev/nvme1n1p1: UUID="c2c27ff8-74f2-4da1-b438-6105ee00a0ae" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="52d29861-01"
mkdir /opt/lib
vi /etc/fstab UUID=c2c27ff8-74f2-4da1-b438-6105ee00a0ae /opt/lib xfs defaults 0 2
mount /opt/lib
mkdir /opt/lib/pgsql mkdir /opt/lib/pgsql/13 mkdir /opt/lib/pgsql/13/data
dnf module disable postgresql dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm yum update -y [root@zabbix ~]# dnf --repo pgdg13 install postgresql13-server postgresql13
[root@zabbix ~]# chown -R postgres.postgres /opt/lib/pgsql [root@zabbix ~]# chmod -R 700 /opt/lib/pgsql
[root@zabbix ~]# su postgres
/usr/pgsql-13/bin/initdb -D /opt/lib/pgsql/13/data --encoding UTF8 cd /tmp /usr/pgsql-13/bin/pg_ctl -D /opt/lib/pgsql/13/data -l logfile start /usr/pgsql-13/bin/pg_ctl -D /opt/lib/pgsql/13/data -l logfile stop
exit
vi /usr/lib/systemd/system/postgresql-13.service
edit
Location of database directory
Environment=PGDATA=/opt/lib/pgsql/13/data/ wq! systemctl enable postgresql-13
vi /etc/yum.repos.d/timescaledb.repo
[timescale_timescaledb] name=timescale_timescaledb baseurl=https://packagecloud.io/timescale/timescaledb/el/8/$basearch repo_gpgcheck=1 gpgcheck=0 enabled=1 gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300
yum update
yum install timescaledb-2-postgresql-13
sudo -u postgres psql
postgres=# SHOW config_file; config_file
/opt/lib/pgsql/13/data/postgresql.conf
cd /opt/lib/pgsql/13 timescaledb-tune --pg-config=/usr/pgsql-13/bin/pg_config --conf-path=/opt/lib/pgsql/13/data/postgresql.conf
systemctl restart postgresql-13
rpm -Uvh https://repo.zabbix.com/zabbix/6.2/rhel/8/x86_64/zabbix-release-6.2-3.el8.noarch.rpm dnf module switch-to php:7.4
dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
sudo -u postgres createuser --pwprompt zabbix ahX7kad6chejeeth0hoo
sudo -u postgres createdb -O zabbix zabbix
zcat /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix
echo "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;" | sudo -u postgres psql zabbix
sudo -u postgres psql zabbix psql (13.8) Type "help" for help.
zabbix=# \dx
List of installed extensions
Name | Version | Schema | Description
-------------+---------+------------+-------------------------------------------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
timescaledb | 2.8.1 | public | Enables scalable inserts and complex queries for time-series data
(2 rows)
cat /usr/share/zabbix-sql-scripts/postgresql/timescaledb.sql | sudo -u zabbix psql zabbix
vi /etc/nginx/conf.d/zabbix.conf
server { listen 8080; server_name zabbix.core.idenon.com;
vi /opt/lib/pgsql/13/data/pg_hba.conf
TYPE DATABASE USER ADDRESS METHOD
"local" is for Unix domain socket connections only
local all all peer
IPv4 local connections:
host all all 127.0.0.1/32 md5
IPv6 local connections:
host all all ::1/128 md5
Allow replication connections from localhost, by a user with the
replication privilege.
local replication all peer host replication all 127.0.0.1/32 md5 host replication all ::1/128 md5
systemctl restart postgresql-13
systemctl enable zabbix-server zabbix-agent nginx php-fpm systemctl restart zabbix-server zabbix-agent nginx php-fpm
HTTPS by NGINX
mkdir /etc/nginx/certs
chmod 750 /etc/nginx/certs
cd /etc/nginx/certs
openssl req -newkey rsa:2048 -nodes -keyout zabbix.key -x509 -days 3650 -out zabbix.crt -subj "/CN=bazix"
chmod 0400 zabbix.key
chmod 0400 zabbix.crt
mv /etc/nginx/conf.d/zabbix.conf /etc/nginx/conf.d/zabbix-ssl.conf
vi /etc/nginx/conf.d/zabbix.conf server { listen 80; return 301 https://$host$request_uri; }
vi /etc/nginx/conf.d/zabbix-ssl.conf
server { listen 443 ssl default_server; server_name _;
ssl on;
ssl_certificate /etc/nginx/certs/zabbix.crt;
ssl_certificate_key /etc/nginx/certs/zabbix.key;
vi /etc/nginx/nginx.conf server { #listen 80 default_server; #listen [::]:80 default_server; #server_name _;
nginx -t systemctl restart nginx