zabbix

zabbix

bash 复制代码
[root@zabbix-server ~ 09:46:24]# vim /etc/yum.repos.d/nginx.repo
[root@zabbix-server ~ 10:08:35]# yum install nginx -y
BDB2053 Freeing read locks for locker 0x64c: 2827/139670480594752
BDB2053 Freeing read locks for locker 0x64e: 2827/139670480594752
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
nginx                                                   | 2.9 kB     00:00
nginx/x86_64/primary_db                                   |  97 kB   00:04
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.26.1-2.el7.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================
 Package       Arch           Version                      Repository     Size
===============================================================================
Installing:
 nginx         x86_64         1:1.26.1-2.el7.ngx           nginx         807 k

Transaction Summary
===============================================================================
Install  1 Package

Total download size: 807 k
Installed size: 2.8 M
Downloading packages:
nginx-1.26.1-2.el7.ngx.x86_64.rpm                         | 807 kB   00:55
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:nginx-1.26.1-2.el7.ngx.x86_64                             1/1
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* https://nginx.org/en/docs/

Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* https://nginx.org/en/support.html

Commercial subscriptions for nginx are available on:
* https://nginx.com/products/

----------------------------------------------------------------------
  Verifying  : 1:nginx-1.26.1-2.el7.ngx.x86_64                             1/1

Installed:
  nginx.x86_64 1:1.26.1-2.el7.ngx

Complete!
[root@zabbix-server ~ 10:09:39]# systemctl start nginx
[root@zabbix-server ~ 10:09:53]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@zabbix-server ~ 10:10:34]# firewall-cmd --add-service=http --zone=public success
[root@zabbix-server ~ 10:10:42]# firewall-cmd --add-service=http --zone=public --permanent
success
[root@zabbix-server ~ 10:11:04]# firewall-cmd --reload
success

安装mariadb

bash 复制代码
[root@zabbix-server ~ 10:12:21]# vim /etc/yum.repos.d/mariadb.repo
[root@zabbix-server ~ 10:13:06]# yum -y install mariadb-server mariadb
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
[root@zabbix-server ~ 10:15:45]# systemctl enable mariadb --now
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@zabbix-server ~ 10:23:53]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.6.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)]> delete from mysql.user where user='';
Query OK, 2 rows affected (0.002 sec)

MariaDB [(none)]> alter user root@localhost identified by 'root123';
Query OK, 0 rows affected (0.000 sec)

连接数据库测试

bash 复制代码
[root@zabbix-server ~ 10:26:25]# mysql -uroot -proot123
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.6.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)]>

安装php

bash 复制代码
[root@zabbix-server ~ 10:26:58]# yum -y install epel-release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================
 Package                Arch             Version        Repository        Size
===============================================================================
Installing:
 epel-release           noarch           7-11           extras            15 k

Transaction Summary
===============================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Downloading packages:
epel-release-7-11.noarch.rpm                              |  15 kB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                    1/1
  Verifying  : epel-release-7-11.noarch                                    1/1

Installed:
  epel-release.noarch 0:7-11

Complete!
[root@zabbix-server ~ 10:27:14]# sed -i "s/#baseurl/baseurl/g" /etc/yum.repos.d/epel.repo
[root@zabbix-server ~ 10:27:59]# sed -i "s/metalink/#metalink/g" /etc/yum.repos.d/epel.repo
[root@zabbix-server ~ 10:29:05]# sed -i "s@https\?://download.[a-z]*\.\?[a-z]*/pub@https://repo.huaweicloud.com@g" /etc/yum.repos.d/epel.repo
[root@zabbix-server ~ 10:32:23]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
warning: /var/tmp/rpm-tmp.87iaY7: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:webtatic-release-7-3             ################################# [100%]
[root@zabbix-server ~ 10:32:50]#  yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-pdo php72w-xml php72w-fpm php72w-mysqlnd php72w-opcache php72w-ldap php72w-bcmath
Loaded plugins: fastestmirror, langpacks

配置nginx支持php

bash 复制代码
[root@zabbix-server ~ 10:36:06]# vim /etc/php-fpm.d/www.conf
[root@zabbix-server ~ 10:36:49]# vim /etc/nginx/conf.d/default.conf

配置php

bash 复制代码
[root@zabbix-server ~ 10:41:15]# vim /etc/php.ini
[root@zabbix-server ~ 10:44:15]# systemctl enable php-fpm --now
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
[root@zabbix-server ~ 10:44:33]# systemctl restart nginx

测试

数据库连接

sql 复制代码
[root@zabbix-server ~ 10:53:46]# mysql -uroot -proot123
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 10.6.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 utf8 collate utf8_bin;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> GRANT all privileges ON *.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix123';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> quit
Bye

zabbix-server

导入数据库

bash 复制代码
 tar zxvf zabbix-6.0.6.tar.gz
[root@zabbix-server ~ 11:37:19]# cd /root/zabbix-6.0.6/database/mysql/
[root@zabbix-server mysql 11:37:21]# ls
data.sql    history_pk_prepare.sql  Makefile.am  schema.sql
double.sql  images.sql              Makefile.in
[root@zabbix-server mysql 11:37:26]# mysql -uroot -proot123 zabbix < schema.sql
[root@zabbix-server mysql 11:38:12]# mysql -uroot -proot123 zabbix < images.sql
[root@zabbix-server mysql 11:38:18]# mysql -uroot -proot123 zabbix < data.sql  
[root@zabbix-server mysql 11:38:47]# mysql -uroot -proot123 zabbix < double.sql 
[root@zabbix-server mysql 11:39:22]# mysql -uroot -proot123 zabbix < history_pk_prepare.sql
[root@zabbix-server mysql 11:39:42]# mysql -uroot -proot123
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.6.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)]> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| auditlog                   |
| autoreg_host               |
| conditions                 |
| config                     |
| config_autoreg_tls         |
| corr_condition             |
| corr_condition_group       |
| corr_condition_tag         |
| corr_condition_tagpair     |
| corr_condition_tagvalue    |
| corr_operation             |
| correlation                |
| dashboard                  |
| dashboard_page             |
| dashboard_user             |
| dashboard_usrgrp           |
| dbversion                  |
| dchecks                    |
| dhosts                     |
| drules                     |
| dservices                  |
| escalations                |
| event_recovery             |
| event_suppress             |
| event_tag                  |
| events                     |
| expressions                |
| functions                  |
| globalmacro                |
| globalvars                 |
| graph_discovery            |
| graph_theme                |
| graphs                     |
| graphs_items               |
| group_discovery            |
| group_prototype            |
| ha_node                    |
| history                    |
| history_log                |
| history_log_old            |
| history_old                |
| history_str                |
| history_str_old            |
| history_text               |
| history_text_old           |
| history_uint               |
| history_uint_old           |
| host_discovery             |
| host_inventory             |
| host_tag                   |
| hostmacro                  |
| hosts                      |
| hosts_groups               |
| hosts_templates            |
| housekeeper                |
| hstgrp                     |
| httpstep                   |
| httpstep_field             |
| httpstepitem               |
| httptest                   |
| httptest_field             |
| httptest_tag               |
| httptestitem               |
| icon_map                   |
| icon_mapping               |
| ids                        |
| images                     |
| interface                  |
| interface_discovery        |
| interface_snmp             |
| item_condition             |
| item_discovery             |
| item_parameter             |
| item_preproc               |
| item_rtdata                |
| item_tag                   |
| items                      |
| lld_macro_path             |
| lld_override               |
| lld_override_condition     |
| lld_override_opdiscover    |
| lld_override_operation     |
| lld_override_ophistory     |
| lld_override_opinventory   |
| lld_override_opperiod      |
| lld_override_opseverity    |
| lld_override_opstatus      |
| lld_override_optag         |
| lld_override_optemplate    |
| lld_override_optrends      |
| maintenance_tag            |
| maintenances               |
| maintenances_groups        |
| maintenances_hosts         |
| maintenances_windows       |
| media                      |
| media_type                 |
| media_type_message         |
| media_type_param           |
| module                     |
| opcommand                  |
| opcommand_grp              |
| opcommand_hst              |
| opconditions               |
| operations                 |
| opgroup                    |
| opinventory                |
| opmessage                  |
| opmessage_grp              |
| opmessage_usr              |
| optemplate                 |
| problem                    |
| problem_tag                |
| profiles                   |
| proxy_autoreg_host         |
| proxy_dhistory             |
| proxy_history              |
| regexps                    |
| report                     |
| report_param               |
| report_user                |
| report_usrgrp              |
| rights                     |
| role                       |
| role_rule                  |
| script_param               |
| scripts                    |
| service_alarms             |
| service_problem            |
| service_problem_tag        |
| service_status_rule        |
| service_tag                |
| services                   |
| services_links             |
| sessions                   |
| sla                        |
| sla_excluded_downtime      |
| sla_schedule               |
| sla_service_tag            |
| sysmap_element_trigger     |
| sysmap_element_url         |
| sysmap_shape               |
| sysmap_url                 |
| sysmap_user                |
| sysmap_usrgrp              |
| sysmaps                    |
| sysmaps_element_tag        |
| sysmaps_elements           |
| sysmaps_link_triggers      |
| sysmaps_links              |
| tag_filter                 |
| task                       |
| task_acknowledge           |
| task_check_now             |
| task_close_problem         |
| task_data                  |
| task_remote_command        |
| task_remote_command_result |
| task_result                |
| timeperiods                |
| token                      |
| trends                     |
| trends_uint                |
| trigger_depends            |
| trigger_discovery          |
| trigger_queue              |
| trigger_tag                |
| triggers                   |
| users                      |
| users_groups               |
| usrgrp                     |
| valuemap                   |
| valuemap_mapping           |
| widget                     |
| widget_field               |
+----------------------------+
178 rows in set (0.007 sec)

安装软件包

bash 复制代码
[root@zabbix-server mysql 11:42:42]# 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 fping gcc gcc-c++ make
[root@zabbix-server ~]# useradd -s /sbin/nologin -M zabbix
#使得编译器在编译 C 代码时使用 GNU C99 标准
[root@zabbix-server ~]# export CFLAGS="-std=gnu99"  
#执行configure脚本
[root@zabbix-server ~]# cd zabbix-6.0.6/
[root@zabbix-server zabbix-6.0.6]# ./configure --sysconfdir=/etc/zabbix/ --
enable-server --with-mysql --with-net-snmp --with-libxml2 --with-ssh2 --with
openipmi --with-zlib --with-libpthread --with-libevent --with-openssl --with-ldap --with-libcurl --with-libpcre
#安装
[root@zabbix-server zabbix-6.0.6]# make install
#检查版本
[root@zabbix-server ~]# zabbix_server --version
zabbix_server (Zabbix) 6.0.6
Revision 3f7597e3ea3 27 June 2022, compilation time: Jun 12 2026 11:47:01

Copyright (C) 2022 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.

This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).

Compiled with OpenSSL 1.0.2k-fips  26 Jan 2017
Running with OpenSSL 1.0.2k-fips  26 Jan 2017

修改zabbix-server配置文件

bash 复制代码
[root@zabbix-server zabbix-6.0.6 11:47:54]#  vim /etc/zabbix/zabbix_server.conf[root@zabbix-server zabbix-6.0.6 11:49:03]# touch /var/log/zabbix_server.log
[root@zabbix-server zabbix-6.0.6 11:49:10]# chown zabbix.zabbix /var/log/zabbix_server.log
[root@zabbix-server zabbix-6.0.6 11:49:21]# vim /usr/lib/systemd/system/zabbix-server.service
[root@zabbix-server zabbix-6.0.6 11:49:42]# systemctl start zabbix-server
[root@zabbix-server zabbix-6.0.6 12:29:22]#  netstat -ntap | grep 10051
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      64679/zabbix_server

前端页面复制到站点

bash 复制代码
[root@zabbix-server zabbix-6.0.6 12:29:29]#  cp -r /root/zabbix-6.0.6/ui/* /usr/share/nginx/html/
[root@zabbix-server zabbix-6.0.6 12:30:21]# chown -R nginx:nginx /usr/share/nginx/html/
[root@zabbix-server zabbix-6.0.6 12:30:27]# systemctl restart nginx

被监控端

安装agent

bash 复制代码
[root@mysql001 ~ 09:46:41]#  systemctl stop firewalld.service
[root@mysql001 ~ 14:00:41]# setenforce 0
setenforce: SELinux is disabled
[root@mysql001 ~ 14:00:49]# yum update ca-certificates -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package ca-certificates.noarch 0:2020.2.41-70.0.el7_8 will be updated
---> Package ca-certificates.noarch 0:2023.2.60_v7.0.306-72.el7_9 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================
 Package            Arch      Version                         Repository  Size
===============================================================================
Updating:
 ca-certificates    noarch    2023.2.60_v7.0.306-72.el7_9     updates    923 k

Transaction Summary
===============================================================================
Upgrade  1 Package

Total size: 923 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : ca-certificates-2023.2.60_v7.0.306-72.el7_9.noarch          1/2
  Cleanup    : ca-certificates-2020.2.41-70.0.el7_8.noarch                 2/2
  Verifying  : ca-certificates-2023.2.60_v7.0.306-72.el7_9.noarch          1/2
  Verifying  : ca-certificates-2020.2.41-70.0.el7_8.noarch                 2/2

Updated:
  ca-certificates.noarch 0:2023.2.60_v7.0.306-72.el7_9

Complete!
[root@mysql001 ~ 14:01:07]# rpm -ivh https://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-4.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-4.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.uZ6rUo: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-6.0-4.el7         ################################# [100%]
[root@mysql001 ~ 14:01:42]# yum install -y zabbix-agent2
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package zabbix-agent2.x86_64 0:6.0.46-release2.el7 will be installed
--> Processing Dependency: zabbix-agent2-plugin-mongodb for package: zabbix-agent2-6.0.46-release2.el7.x86_64
--> Processing Dependency: zabbix-agent2-plugin-postgresql for package: zabbix-agent2-6.0.46-release2.el7.x86_64
--> Running transaction check
---> Package zabbix-agent2-plugin-mongodb.x86_64 0:6.0.46-release1.el7 will be installed
---> Package zabbix-agent2-plugin-postgresql.x86_64 0:6.0.46-release1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================
 Package                          Arch    Version                Repository
                                                                          Size
===============================================================================
Installing:
 zabbix-agent2                    x86_64  6.0.46-release2.el7    zabbix  5.8 M
Installing for dependencies:
 zabbix-agent2-plugin-mongodb     x86_64  6.0.46-release1.el7    zabbix  3.8 M
 zabbix-agent2-plugin-postgresql  x86_64  6.0.46-release1.el7    zabbix  3.1 M

Transaction Summary
===============================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 13 M
Installed size: 40 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-agent2-plugin-mongodb-6.0.46-release1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Public key for zabbix-agent2-plugin-mongodb-6.0.46-release1.el7.x86_64.rpm is not installed
(1/3): zabbix-agent2-plugin-mongodb-6.0.46-release1.el7.x | 3.8 MB   00:06
(2/3): zabbix-agent2-6.0.46-release2.el7.x86_64.rpm       | 5.8 MB   00:08
(3/3): zabbix-agent2-plugin-postgresql-6.0.46-release1.el | 3.1 MB   00:02
-------------------------------------------------------------------------------
Total                                             1.5 MB/s |  13 MB  00:08
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Importing GPG key 0xA14FE591:
 Userid     : "Zabbix LLC <packager@zabbix.com>"
 Fingerprint: a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591
 Package    : zabbix-release-6.0-4.el7.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : zabbix-agent2-plugin-postgresql-6.0.46-release1.el7.x86_6   1/3
  Installing : zabbix-agent2-plugin-mongodb-6.0.46-release1.el7.x86_64     2/3
  Installing : zabbix-agent2-6.0.46-release2.el7.x86_64                    3/3
  Verifying  : zabbix-agent2-plugin-mongodb-6.0.46-release1.el7.x86_64     1/3
  Verifying  : zabbix-agent2-plugin-postgresql-6.0.46-release1.el7.x86_6   2/3
  Verifying  : zabbix-agent2-6.0.46-release2.el7.x86_64                    3/3

Installed:
  zabbix-agent2.x86_64 0:6.0.46-release2.el7

Dependency Installed:
  zabbix-agent2-plugin-mongodb.x86_64 0:6.0.46-release1.el7
  zabbix-agent2-plugin-postgresql.x86_64 0:6.0.46-release1.el7

Complete!
[root@mysql001 ~ 14:02:25]# systemctl enable zabbix-agent2.service --no
systemctl: option '--no' is ambiguous; possibilities: '--no-block' '--now' '--no-ask-password' '--no-reload' '--no-wall' '--no-pager' '--no-legend'
[root@mysql001 ~ 14:02:47]# systemctl enable zabbix-agent2.service --now
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service to /usr/lib/systemd/system/zabbix-agent2.service.
[root@mysql001 ~ 14:02:50]# vim /etc/zabbix/zabbix_agent2.conf
[root@mysql001 ~ 14:05:05]# systemctl restart zabbix-agent2

zabbix管理

邮箱服务

bash 复制代码
[root@zabbix-server ~ 15:05:00]# yum install mailx -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package mailx-12.5-19.el7.x86_64 already installed and latest version
Nothing to do
[root@zabbix-server ~ 15:05:08]# vim /etc/mail.rc
[root@zabbix-server ~ 15:09:14]#  chmod -R 755 /etc/pki/nssdb/
[root@zabbix-server ~ 15:09:21]#  mkdir -p /root/.certs/
[root@zabbix-server ~ 15:09:51]# echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root G2
verify return:1
depth=1 C = US, O = "DigiCert, Inc.", CN = DigiCert Secure Site OV G2 TLS CN RSA4096 SHA256 2022 CA1
verify return:1
depth=0 C = CN, ST = Guangdong Province, L = Shenzhen, O = Shenzhen Tencent Computer Systems Company Limited, CN = *.mail.qq.com
verify return:1
DONE
[root@zabbix-server ~ 15:10:15]# certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
[root@zabbix-server ~ 15:10:28]# certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
[root@zabbix-server ~ 15:10:40]# certutil -L -d /root/.certs

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

GeoTrust SSL CA                                              C,,
[root@zabbix-server ~ 15:10:46]# cd /root/.certs/
[root@zabbix-server .certs 15:10:59]# certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt
Notice: Trust flag u is set automatically if the private key is present.
bash 复制代码
[root@zabbix-server .certs 15:19:28]# vim /etc/zabbix/zabbix_server.conf
You have new mail in /var/spool/mail/root
[root@zabbix-server .certs 15:23:29]# mkdir -p /usr/lib/zabbix/alertscripts
[root@zabbix-server .certs 15:23:35]# chown -R zabbix:zabbix /usr/lib/zabbix/alertscripts
[root@zabbix-server .certs 15:23:42]# systemctl restart zabbix-server.service
[root@zabbix-server .certs 15:23:50]# vim /usr/lib/zabbix/alertscripts/mailx.sh[root@zabbix-server .certs 15:24:19]# touch /tmp/mailx.log
[root@zabbix-server .certs 15:24:25]# chown -R zabbix.zabbix /tmp/mailx.log
[root@zabbix-server .certs 15:24:32]# chmod +x /usr/lib/zabbix/alertscripts/mailx.sh
[root@zabbix-server .certs 15:24:39]# cd /usr/lib/zabbix/alertscripts/
[root@zabbix-server alertscripts 15:24:48]# ./mailx.sh 2030960748@qq.com "hello mailx.sh" "This is test"

告警服务

bash 复制代码
[root@mysql001 ~ 14:34:47]# systemctl stop mysqld

.service

root@zabbix-server .certs 15:23:50# vim /usr/lib/zabbix/alertscripts/mailx.shroot@zabbix-server .certs 15:24:19# touch /tmp/mailx.log

root@zabbix-server .certs 15:24:25# chown -R zabbix.zabbix /tmp/mailx.log

root@zabbix-server .certs 15:24:32# chmod +x /usr/lib/zabbix/alertscripts/mailx.sh

root@zabbix-server .certs 15:24:39# cd /usr/lib/zabbix/alertscripts/

root@zabbix-server alertscripts 15:24:48# ./mailx.sh 2030960748@qq.com "hello mailx.sh" "This is test"

复制代码
[外链图片转存中...(img-41rbJf4P-1782379094946)]

告警服务

~~~bash
[root@mysql001 ~ 14:34:47]# systemctl stop mysqld

外链图片转存中...(img-4P9Zx3UE-1782379094946)

监控mysql001系统资源使用