The point of optimization? ?
- zabbix macro definition? ? ?
- View historical interval data, automatic monitoring? ? ?
- Add hosts in batches? ? ?
- Install client automation? ? ?
- Web program delivery, change release system? ? ?
- Network troubleshooting link announcement cutover fault diagnosis system? Early warning system?
Monitoring item
Configure alarm sound
Custom monitoring
1 script to get the value
2 zbx format, configuration file, create key value: key value key to obtain client data
3 Restart the client, the server test key is available
4 web key-value association
Monitoring script plugin
[root@bzy2c8nnb0dtlnbi plugins.d]# grep -i include= /etc/zabbix/zabbix_agent2.conf # Include= Include=/etc/zabbix/zabbix_agent2.d/*.conf # Include=/usr/local/etc/zabbix_agent2.userparams.conf # Include=/usr/local/etc/zabbix_agent2.conf.d/ # Include=/usr/local/etc/zabbix_agent2.conf.d/*.conf Include=./zabbix_agent2.d/plugins.d/*.conf
write:
vi /etc/zabbix/zabbix_agent2.d/web.conf #UserParameter=key,cmd #UserParameter=check.django,ps -ef | grep /usr/local/bin/python3 | grep 80 | wc -l UserParameter=check.django,ss -lntup| grep -w *:80 | wc -l Restart the client systemctl restart zabbix-agent2 client local testing [root@bzy2c8nnb0dtlnbi zabbix_agent2.d]# zabbix_agent2 -t check.django check.django[s|3]
agent monitoring item
Server=192.168.3.101 #Passive mode, specify the ip address of the zabbix-server server, use commas to separate multiple ip
ServerActive=192.168.3.101 #Active mode, specify the ip address of zabbix-server, use commas to separate multiple IPs, if you comment this option, the active monitoring of the current server will be disabled
Hostname=itops-server #When using the active mode, the setting of this name must be consistent with the host name created by the zabbix-web monitoring page
After modification, restart zabbix agent to make the service take effect
service zabbix_agent restart
Configuration
zbx is not green, whether the client configuration server is configured, whether the local port 10050 is enabled
Make a mirror image
docker commit -m 'zabbix6.0 login' -a="haogeoyes" zabbix1 zabbix:v1
Questions
login language
reference documents
Locale for language “en_US” is not found on the web server. Tried to set: en_US, en_US.utf8,
language selection:
You are not able to choose some of the languages, because locales for them are not installed on the web server.
Configure Chinese:
dnf install langpacks-zh_CN.noarch
dnf install glibc-common
locale -a | grep zh_CN
Font Settings
mac reference documentation
scp /Library/Fonts/Songti.ttc root@xx:/tmp cp /tmp/Songti.ttc /root/zabbix/ cd /usr/share/zabbix/assets/fonts/ mv graphfont.ttf graphfontbak.ttf cp /root/zabbix/Songti.ttc mv Songti.ttc graphfont.ttf
zabbix is not ready to start
View the log /var/log/zabbix/zabbix_server.log
"vm.memory.size[total]" on host "Zabbix server" failed: first network
centos8 install zabbix6.0
docker pull centos:centos8
6.0 centos8 official installation document
docker run –name zabbix1 -t -d -p 8100-8199:8100-8199 -v /root/zabbix:/root/zabbix –privileged=true centos:centos8 /usr/sbin/init
7000-8000:7000-8000
yum install
rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-4.el8.noarch.rpm curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo mv *repo /bak/ dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent No, you need to use the official source vi /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB baseurl = http://mirrors.aliyun.com/mariadb/yum/10.5/centos8-amd64/ gpgkey = http://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDb gpgcheck = 1 enabled = 1 official source [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.5/centos8-amd64 module_hotfixes=1 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 [root@b87815deda95 yum.repos.d]# systemctl start mariadb [root@b87815deda95 yum.repos.d]# systemctl enable mariadb Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service. [root@b87815deda95 yum.repos.d]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.5.19-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database zabbix character set utf8mb4 collate utf8mb4_bin; Query OK, 1 row affected (0.000 sec) MariaDB [(none)]> create user zabbix@localhost identified by 'zabbix'; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> set global log_bin_trust_function_creators = 1; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> quit; Bye [root@b87815deda95 yum.repos.d]# ls /usr/share/zabbix-sql-scripts/mysql/server.sql.gz /usr/share/zabbix-sql-scripts/mysql/server.sql.gz [root@b87815deda95 yum.repos.d]# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix Enter password: [root@b87815deda95 yum.repos.d]# mysql -uroot -p MariaDB [(none)]> set global log_bin_trust_function_creators = 0; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> quit;
centos8 install mariadb 10.5 reference document
Modify /etc/zabbix/zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf
DBPassword=zabbix
Modify /etc/nginx/conf.d/zabbix.conf
listen 8180;
server_name zabbix;
Startup
systemctl restart zabbix-server zabbix-agent nginx php-fpm
systemctl enable zabbix-server zabbix-agent nginx php-fpm
Page initialization http://14.29.251.xx:8180/
web login default username Admin password zabbix
Clear Cache Reference
refresh cache dnf clean all dnf makecache dnf repolis dnf search mariadb view version dnf search mariadb-server --showduplicates --disablerepo=AppStream dnf -y install MariaDB-server-debuginfo-10.5.17-1.el8.x86_64 rpm -qa | grep -i mariadb systemctl enable mariadb systemctl start mariadb
Re-deploy
http://mirrors.aliyun.com/
Ali yum source retrieval
Zabbix 6.0 can only be client-side in centos7
nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/
r
e
l
e
a
the s
e
v
e
r
/
releaseever/
releaseever/basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install epel-release.noarch -y
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php72w-cli php72w-fpm php72w-gd php72w-mbstring php72w-bcmath php72w-xml php72w-ldap php72w-mysqlnd
yum install -y nginx
rpm -qa | egrep ‘nginx|php’
rpm -qa | egrep ‘nginx|php’ | wc -l
11
configuration
vi /etc/nginx/conf.d/nginx.conf
server {
listen 80;
server_name nginx;
root /root/zabbix;
location / {
index index.php;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /app/code/zbx$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME
d
o
c
u
m
e
no
t
r
o
o
t
document_root
documentr?ootfastcgi_script_name;
include fastcgi_params;
}
}
modify php configuration
Replace apache matching the beginning of user/group with nginx
sed -ri ‘/^(user|group)/s#apache#nginx#g’ /etc/php-fpm.d/www.conf
egrep ‘^(user|group)’ /etc/php-fpm.d/www.conf
/root/zabbix/info.php
systemctl start nginx php-fpm
systemctl enable nginx php-fpm
Access test
http://xx/info.php
curl http://127.0.0.1/info.php
Tool testing
yum provides */netstat
error nginx 403
check log
check log
/var/log/nginx/error.log
023/03/18 00:02:04 [error] 1413#1413: *1 open() “/root/zabbix/favicon.ico” failed (13: Permission denied), client: 125.121.41.124, server: nginx, request: “GET /faviconn
.ico HTTP/1.1″, host: “14.29.251.27:8051”, referrer: “http://14.29.251.27:8051/info.php”
Add permission xxx
Note: Modify permissions to root
vi /etc/nginx/nginx.conf
user root
Report an error
File not found.
Deploy the database
zabbix 6.0 does not support mariadb 5.5 and the default source is above 10.5
mariadb
Configuration source
vi /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://mirrors.aliyun.com/mariadb/yum/10.5/centos7-amd64/
gpgkey = http://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDb
gpgcheck = 1
enabled = 1
yum install mariadb-server -y
rpm -qa | grep -i mariadb
systemctl enable mariadb
systemctl start mariadb
Configuration
database initialization
mysql_secure_installation
carriage return
no
other full y
change password root
Create user
- Chinese garbled characters in the specified character set
create database zabbix charset utf8 collate utf8_bin; - Create user password zabbix
grant all on zabbix.* to ‘zabbix’@’localhost’ identified by ‘zabbix’;
Authorize other addresses
grant all on zabbix.* to ‘zabbix’@’xx.xx.xx.%’ identified by ‘zabbix’;
Import data to database
Import order
Download source code
https://www.zabbix.com/download_sources#60LTS
curl -O https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.14.tar.gz zabbix-6.0.14.tar.gz tar zxvf zabbix-6.0.14.tar.gz cd zabbix-6.0.14/database/mysql/ [root@857cd8bba2b3 mysql]# ls Makefile.am Makefile.in data.sql double.sql history_pk_prepare.sql images.sql schema.sql [root@857cd8bba2b3 mysql]# mysql -uroot -proot zabbix < schema.sql [root@857cd8bba2b3 mysql]# mysql -uroot -proot zabbix < images.sql [root@857cd8bba2b3 mysql]# mysql -uroot -proot zabbix < data.sql [root@857cd8bba2b3 mysql]# mysql -uroot -proot zabbix < double.sql [root@857cd8bba2b3 mysql]# mysql -uroot -proot zabbix < history_pk_prepare.sql
Compile and install
cd zabbix* yum install -y mysql-devel pcre-devel openssl-devel zlib-devel libxml2-devel net-snmp-devel net-snmp libssh2-devel OpenIPMI-devel libevent-devel openldap-devel libcurl-devel ./configure make install ./configure --sysconfdir=/etc/zabbix/ --enable-server --with-mysql --with-net-snmp --with-libxml2 --with-libxml2 --with-ssh2 --with-openipmi - -with-zlib --with-libpthread --with-libevent --with-openssl --with-ldap --with-libcurl --with-libpcre make install echo $?
- Error configure: error: no acceptable C compiler found in $PATH
yum -y install gcc.x86_64
./configure under /usr/local by default --sysconfdir=/etc/zabbix/ specifies the configuration file directory --enable-server install server-client --with-mysql enable support for mysql dependent function --with-net-snmp --with-libxml2 --with-libxml2 --with-ssh2 --with-openimpi --with-zlib --with-libpthread --with-libevent --with-openssl --with -ldap --with-libcurl --with-libpcre
Configuration: Detected OS: linux-gnu Install path: /usr/local Compilation arch: linux Compiler: cc Compiler flags: -g -O2 Library-specific flags: database: -I/usr/include/mysql -I/usr/include/mysql/mysql libpcre: libXML2: -I /usr/include/libxml2 Net-SNMP: -I/usr/local/include -I/usr/lib64/perl5/CORE -I. -I/usr/include OpenIPMI: -I/usr/include libssh2: -I /usr/include TLS: -I/usr/include LDAP: -I/usr/include libevent: -I/usr/include Enable server: yes Server details: With database: MySQL WEB Monitoring: cURL SSL certificates: /usr/local/share/zabbix/ssl/certs SSL keys: /usr/local/share/zabbix/ssl/keys SNMP: yes IPMI: yes SSH: yes (libssh2) TLS: OpenSSL ODBC: no Linker flags: -L/usr/lib64 -L/usr/lib64/ -L/usr/lib -L/usr/lib -L/usr/lib -L/usr/lib -L/usr/lib -L/usr /lib -L /usr/lib -rdynamic Libraries: -lmariadb -lxml2 -lnetsnmp -lssh2 -lOpenIPMI -lOpenIPMIposix -lz -lpthread -levent -lssl -lcrypto -lldap -llber -lcurl -lm -ldl -lresolv -lpcre Configuration file: /etc/zabbix/zabbix_server.conf External scripts: /usr/local/share/zabbix/externalscripts Alert scripts: /usr/local/share/zabbix/alertscripts Modules: /usr/local/lib/modules Enable proxy: no Enable agent: no Enable agent 2: no Enable web service: no Enable Java gateway: no LDAP support: yes IPv6 support: no ***************************************************** *********** * Now run 'make install' * * * * Thank you for using Zabbix! * * <http://www.zabbix.com> * ***************************************************** ***********
Dependency does not pass
[root@857cd8bba2b3 zabbix-6.0.14]# ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk...gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking how to create a pax tar archive... gnutar configure: Configuring Zabbix 6.0.14 checking whether make sets $(MAKE)... (cached) yes checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for cc... no checking for c99... no checking for gcc... no checking for clang... no configure: error: in `/zabbix/zabbix-6.0.14': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details
Deployment test
docker build
docker-compose.yml docker-compose up -d
Install zabbix test
docker run --name zabbix -t -d -p 8051:10051 -p 8001:80 -v /root/zabbix:/root/zabbix --privileged=true centos:7 /usr/sbin/init docker exec -it zabbix /bin/bash yum source rpm -ivh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-get zabbix-agent rpm -ivh http://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-1.el7.noarch.rpm generate cache yum makecache renew yum -y update rpm -ivh http://repo.zabbix.com/zabbix/6.2/rhel/7/x86_64/zabbix-release-6.2-1.el7.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX Remove all zabbix dependencies rpm -e --nodeps `rpm -qa | grep zabbix` create database zabbix character set utf8mb4 collate utf8mb4_bin; create user zabbix@'%' identified by 'zabbix'; grant all privileges on zabbix.* to zabbix@'%'; set global log_bin_trust_function_creators = 1; report error No package zabbix-server-mysql available solve yum install epel-release Error: Error downloading packages: fping-3.16-1.el7.x86_64: [Errno 256] No more mirrors to try. solve Install version 6.2 zabbix
mysql file mount?
local installation
http://14.29.251.27:8889/zabbix/setup.php
report error
Transaction check error:
file /usr/bin/zabbix_get from install of zabbix-get-6.0.14-release1.el7.x86_64 conflicts with file from package zabbix6.0-6.0.13-1.el7.x86_64
rpm -qa | grep zabbix
force uninstall
rpm -e zabbix6.0-6.0.13-1.el7.x86_64 –nodeps
http://:8889/
Minimum required PHP version is 7.2.5.
upgrade php
]# php -v
PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
remove yum remove php*
[root@bzy2c8nnb0dtlnbi zabbix]# yum search php7
Plugin loaded: fastestmirror
Repository base is listed more than once in the configuration
Repository updates are listed more than once in the configuration
Repository extras are listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
- base: mirrors.ustc.edu.cn
- epel: mirrors.bfsu.edu.cn
- extras: mirrors.ustc.edu.cn
- updates: ftp.sjtu.edu.cn
Warning: No package matching php7
No matches found
mistake:
yum-config-manager
-bash: yum-config-manager: command not found
solve:
[root@bzy2c8nnb0dtlnbi zabbix]# yum -y install yum-utils
load plugin
yum-config-manager –enable remi-php72
No refactoring:
yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum search php72w
yum -y install php72w php72w-mysql
no php command
reinstall
sudo yum install epel-release sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm sudo yum install yum-utils sudo yum-config-manager --enable remi-php72 sudo yum update sudo yum install php72 php72-php-mysqlnd php72-mysql
yum install php php-mysql php-mysqlnd –skip-broken
mistake:
The requested URL /zabbix/setup.php was not found on this server