咸阳网站建设费用熊猫seo实战培训
2025/12/31 9:20:35 网站建设 项目流程
咸阳网站建设费用,熊猫seo实战培训,抖音代运营是干嘛的,网站建设分析图文章目录zabbixzabbix介绍当前支持版本生命周期Zabbix概述zabbix架构搭建LNMP架构安装nginx先测试nginx环境安装mariad配置yum源连接数据库测试安装php配置nginx支持php配置php测试测试php首页测试连接数据库zabbix-server**导入数据库**安装软件包修改zabbix-server配置文件被…文章目录zabbixzabbix介绍当前支持版本生命周期Zabbix概述zabbix架构搭建LNMP架构安装nginx先测试nginx环境安装mariad配置yum源连接数据库测试安装php配置nginx支持php配置php测试测试php首页测试连接数据库zabbix-server**导入数据库**安装软件包修改zabbix-server配置文件被监控端安装agentzabbix管理监控主机邮件服务告警服务zabbixzabbix介绍zabbix官网Zabbix企业级开源监控解决方案部署手册下载Zabbix产品手册产品手册以下企业都在用当前支持版本生命周期Zabbix概述Zabbix 由 Alexei Vladishev 创建目前由 Zabbix SIA 积极开发和维护。Zabbix 是一款企业级开源分布式监控解决方案。Zabbix 是一款用于监控网络众多参数、服务器/虚拟机/应用程序/服务/数据库/网站/云平台等健康状态和完整性的软件。 Zabbix 提供灵活的告警机制允许用户为几乎任何事件配置基于邮件的告警从而实现对服务器问题的快速响应。基于存储数据 Zabbix 提供出色的报表和数据可视化功能使其成为容量规划的理想选择。Zabbix 同时支持轮询和捕获两种方式。所有 Zabbix 报表、统计信息及配置参数均可通过基于 Web 的前端界面访问。该 Web 前端确保您可以从任何位置评估网络状态和服务器健康状况。经过适当配置Zabbix 可在 IT基础设施监控中发挥重要作用无论是对拥有少量服务器的小型组织还是对拥有众多服务器的大型企业都同样适用。Zabbix 完全免费。 Zabbix 基于 GNU 通用公共许可证 version 第 2 版编写和分发这意味着其源代码可自由分发并面向公众开放。zabbix架构Zabbix由多个主要软件组件构成。各组件职责概述如下。服务器Zabbixserver是核心组件agents向其报告可用性、完整性信息及统计指标。服务器作为中央存储库保存所有配置数据、统计数据和运行数据。数据库存储所有配置信息以及Zabbix收集的数据均存储在数据库中。Web界面为了从任何地方和任何平台轻松访问Zabbix系统提供了基于Web的界面。该界面是Zabbix server的一部分通常但不一定运行在与服务器相同的物理机器上。ProxyZabbix proxy可以代表Zabbix server 收集性能和可用性数据。proxy是Zabbix 部署中的可选组件但它能有效分担单个Zabbix server的负载。AgentZabbixagents被部署在监控目标上用于主动监控本地资源和应用程序并将收集到的数据报告给Zabbix服务器。自Zabbix4.4起有两种类型的agents可用Zabbix agent轻量级支持多种平台使用C语言编写和Zabbix agent2 高度灵活易于通过插件扩展使用Go 语言编写)。数据流此外退一步审视Zabbix内部整体数据流非常重要。为了create一个收集数据的监控项你必须先create一个主机。转到Zabbix体系的另一端你必须先有一个监控项才能create触发器。你必须有一个触发器才能create动作。因此如果你想收到服务器XCPU负载过高的警报你必须先为服务器Xcreate一个主机条目接着创建一个监控其CPU的监控项然后设置一个在CPU过高时激活的触发器最后配置一个发送邮件给你的动作。虽然这看起来步骤很多但通过使用模板功能其实并不复杂。然而正是这种设计使得create非常灵活的配置成为可能。搭建LNMP架构Zabbix基于LNMP架构部署zabbix-server通过Centos-7-template模板克隆产生mysql001通过mysql01克隆产生主机名IP功能zabbix-server192.168.108.50/24安装zabbixmysql001192.168.108.51/24被监控安装nginx#创建nginx的yum源[rootzabbix-server ~]# rm -rf /etc/yum.repos.d/*[rootzabbix-server ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/artifactory/os-conf/centos/centos-7.repo--2025-12-1110:20:54-- https://mirrors.huaweicloud.com/artifactory/os-conf/centos/centos-7.repo Resolving mirrors.huaweicloud.com(mirrors.huaweicloud.com)...124.70.61.162,1.92.76.132,120.46.2.67,... Connecting to mirrors.huaweicloud.com(mirrors.huaweicloud.com)|124.70.61.162|:443... connected. HTTP request sent, awaiting response...200Length:1811(1.8K)[application/octet-stream]Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’100%[]1,811--.-K/sin0s2025-12-1110:20:54(878MB/s)- ‘/etc/yum.repos.d/CentOS-Base.repo’ saved[1811/1811][rootzabbix-server ~]# vim /etc/yum.repos.d/nginx.repo[rootzabbix-server ~]# cat /etc/yum.repos.d/nginx.repo[nginx]namenginxrepobaseurlhttp://nginx.org/packages/centos/7/$basearch/enabled1gpgcheck0#安装nginx[rootzabbix-server ~]# yum install -y nginx#开启服务[rootzabbix-server ~]# systemctl start nginx[rootzabbix-server ~]# systemctl enable nginxCreated symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.#防火墙添加通过http[rootzabbix-server ~]#[rootzabbix-server ~]# firewall-cmd --add-servicehttp --zonepublicsuccess[rootzabbix-server ~]# firewall-cmd --add-servicehttp --zonepublic --permanentsuccess[rootzabbix-server ~]# firewall-cmd --reloadsuccess先测试nginx环境安装mariad配置yum源#配置Mariadb10.5yum源zabbix6.0必须使用该版本低版本不支持[rootzabbix-server ~]# vim /etc/yum.repos.d/mariadb.repo[rootzabbix-server ~]# cat /etc/yum.repos.d/mariadb.repo[mariadb]nameMariaDBbaseurlhttps://mirrors.aliyun.com/mariadb/yum/10.6/centos7-amd64/enabled1gpgcheck0#下载mariadb[rootzabbix-server ~]# yum install -y mariadb-server mariadb#开启服务[rootzabbix-server ~]# systemctl enable mariadb --nowCreated symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.#设置root密码[rootzabbix-server ~]# mysqlWelcome to the MariaDB monitor. Commands end with;or\g. Your MariaDB connectionidis3Server version:10.6.19-MariaDB MariaDB Server Copyright(c)2000,2018, Oracle, MariaDB Corporation Ab and others. Typehelp;or\hforhelp. Type\ctoclearthe current input statement. MariaDB[(none)]selecthost,user from mysql.user;----------------------------|Host|User|----------------------------|localhost|||localhost|mariadb.sys||localhost|mysql||localhost|root||zabbix-server||----------------------------5rowsinset(0.001sec)MariaDB[(none)]delete from mysql.user whereUser;Query OK,2rows affected(0.001sec)MariaDB[(none)]selecthost,user from mysql.user;------------------------|Host|User|------------------------|localhost|mariadb.sys||localhost|mysql||localhost|root|------------------------3rowsinset(0.001sec)MariaDB[(none)]alter user rootlocalhost identified byroot123;Query OK,0rows affected(0.001sec)MariaDB[(none)]quit Bye连接数据库测试[rootzabbix-server ~]# mysql -uroot -proot123Welcome to the MariaDB monitor. Commands end with;or\g. Your MariaDB connectionidis4Server version:10.6.19-MariaDB MariaDB Server Copyright(c)2000,2018, Oracle, MariaDB Corporation Ab and others. Typehelp;or\hforhelp. Type\ctoclearthe current input statement. MariaDB[(none)]安装php[rootzabbix-server ~]# yum install -y epel-release[rootzabbix-server ~]# sed -i s/#baseurl/baseurl/g /etc/yum.repos.d/epel.repo[rootzabbix-server ~]# sed -i s/metalink/#metalink/g /etc/yum.repos.d/epel.repo[rootzabbix-server ~]# sed -i shttps\?://download.[a-z]*\.\?[a-z]*/pubhttps://repo.huaweicloud.comg /etc/yum.repos.d/epel.repo[rootzabbix-server ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmRetrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm warning: /var/tmp/rpm-tmp.HIhdb2: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY Preparing...################################# [100%]Updating / installing...1:webtatic-release-7-3################################# [100%][rootzabbix-server ~]# 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配置nginx支持php#修改php-fpm配置文件把apache改为nginx[rootzabbix-server ~]# vim /etc/php-fpm.d/www.conf8usernginx10groupnginx#配置location在index中添加index.php。以支持index.php的首页[rootzabbix-server ~]# vim /etc/nginx/conf.d/default.conf9indexindex.phpindex.htmlindex.htm;#配置php请求被传送到后端的php-fpm模块默认情况下php配置块是被注释的此时去掉注释并修改#把fastcgi_param中的/scripts改为$document_root。root是配置php程序放置的根目录。29location~\.php${ 30 root/usr/share/nginx/html;31 fastcgi_pass 127.0.0.1:9000; 32 fastcgi_index index.php; 33 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 34 include fastcgi_params; 35 }配置php#修改PHP配置文件[rootzabbix-server ~]# vim /etc/php.ini#支持php短标签202short_open_tagOn#隐藏php版本359expose_phpOff#以下为zabbix优化配置要求368max_execution_time300#执行时间378max_input_time300#接收数据等待时间389memory_limit128M#每个脚本占用内存656post_max_size16M#POST数据大小799upload_max_filesize2M#上传文件大小800always_populate_raw_post_data-1#原来空的需要添加877date.timezoneAsia/Shanghai#时区#启动php-fpm服务[rootzabbix-server ~]# systemctl enable php-fpm --nowCreated symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.#重启nginx[rootzabbix-server ~]# systemctl restart nginx测试测试php首页[rootzabbix-server ~]# vim /usr/share/nginx/html/info.php[rootzabbix-server html]# cat info.php?php phpinfo();?测试连接数据库[rootzabbix-server html]# cat info.php?php$linkmysqli_connect(127.0.0.1,root,root123);if($link)echosuccess;elseechofail;?# $linkmysqli_connect(127.0.0.1,root,root123); 设置变量$link连接数据库# if ($link) echo success; 如果连接上输出success# else echo fail; 连接不上输出fail# 创建zabbix用的数据库及账号 [rootzabbix-server ~]# mysql -uroot -proot123 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 6 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)] grant all privileges on *.* to zabbix% identified by zabbix123;^C MariaDB [(none)] create database zabbix character set utf8 collate ust8_bin; ERROR 1273 (HY000): Unknown collation: ust8_bin MariaDB [(none)] create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.000 sec) MariaDB [(none)] show databses; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near databses at line 1 MariaDB [(none)] show databases; -------------------- | Database | -------------------- | information_schema | | mysql | | performance_schema | | sys | | test | | zabbix | -------------------- 6 rows in set (0.000 sec) MariaDB [(none)] grant all privileges on *.* to zabbix% identified by zabbix123; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)] grant all privileges on *.* to zabbixlocalhost identified by zabbix123; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)] flush privileges; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)] quit Byecollate的作用对于mysql中那些字符类型的列如VARCHARCHARTEXT类型的列都需要有一个COLLATE类型来告知mysql如何对该列进行排序和比较。COLLATE会影响到ORDER BY语句的顺序会影响到WHERE条件中大于小于号筛选出来的结果会影响DISTINCT、GROUP BY、HAVING语句的查询结果。另外mysql建索引的时候如果索引列是字符类型也会影响索引创建只不过这种影响我们感知不到。凡是涉及到字符类型比较或排序的地方都会和COLLATE有关。测试连接zaabix数据库[rootzabbix-server ~]# vim /usr/share/nginx/html/info.php[rootzabbix-server ~]# cat /usr/share/nginx/html/info.php?php$linkmysqli_connect(127.0.0.1,zabbix,zabbix123);if($link)echozabbix数据库连接成功;elseechozabbix数据库连接失败;?测试zabbix-server导入数据库#解压[rootzabbix-server ~]# lsanaconda-ks.cfg initial-setup-ks.cfg Public Desktop Music Templates Documents nginx-release-centos-7-0.el7.ngx.noarch.rpm Videos Downloads Pictures zabbix-6.0.6.tar.gz[rootzabbix-server ~]# tar zxvf zabbix-6.0.6.tar.gz#导入数据库#将该目录的数据库导入zabbix数据库[rootzabbix-server ~]# cd /root/zabbix-6.0.6/database/mysql/[rootzabbix-server mysql]# lsdata.sql history_pk_prepare.sql Makefile.am schema.sql double.sql images.sql Makefile.in[rootzabbix-server mysql]# mysql -uroot -proot123 zabbix schema.sql[rootzabbix-server mysql]# mysql -uroot -proot123 zabbix images.sql[rootzabbix-server mysql]# mysql -uroot -proot123 zabbix data.sql[rootzabbix-server mysql]# mysql -uroot -proot123 zabbix double.sql[rootzabbix-server mysql]# mysql -uroot -proot123 zabbix history_pk_prepare.sql#进入zabbix数据库查看[rootzabbix-server mysql]# mysql -uroot -proot123Welcome to the MariaDB monitor. Commands end with;or\g. Your MariaDB connectionidis16Server version:10.6.19-MariaDB MariaDB Server Copyright(c)2000,2018, Oracle, MariaDB Corporation Ab and others. Typehelp;or\hforhelp. Type\ctoclearthe current input statement. MariaDB[(none)]use zabbix;Reading table informationforcompletion of table andcolumnnames 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|----------------------------178rowsinset(0.001sec)#是178条MariaDB[zabbix]quit Bye安装软件包#安装zabbix环境包[rootzabbix-server mysql]# 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# 创建zabbix用户[rootzabbix-server mysql]# useradd -s /sbin/nologin -M zabbix#使得编译器在编译 C 代码时使用 GNU C99 标准[rootzabbix-server mysql]# export CFLAGS-stdgnu99#执行configure脚本[rootzabbix-server mysql]# cd[rootzabbix-server ~]# cd zabbix-6.0.6/[rootzabbix-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#安装[rootzabbix-server ~]# make install#检查版本[rootzabbix-server ~]# zabbix_server --versionzabbix_server(Zabbix)6.0.6 Revision 3f7597e3ea327June2022, compilation time: Dec11202514:01:17 Copyright(C)2022Zabbix SIA License GPLv2: GNU GPL version2or laterhttp://gnu.org/licenses/gpl.html. This isfreesoftware: you arefreeto 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 Projectforuseinthe OpenSSL Toolkit(http://www.openssl.org/). Compiled with OpenSSL1.0.2k-fips26Jan2017Running with OpenSSL1.0.2k-fips26Jan2017修改zabbix-server配置文件[rootzabbix-server ~]# vim /etc/zabbix/zabbix_server.conf38LogFile/var/log/zabbix_server.log123DBPasswordzabbix123#创建日志文件并修改属组和属主[rootzabbix-server ~]# touch /var/log/zabbix_server.log[rootzabbix-server ~]# chown zabbix.zabbix /var/log/zabbix_server.log#创建并添加systemctl服务管理zabbix-server[rootzabbix-server ~]# vim /usr/lib/systemd/system/zabbix-server.service[rootzabbix-server ~]# cat /usr/lib/systemd/system/zabbix-server.service#添加下面这段话直接复制[Unit]DescriptionZabbix Server with MySQL DBAftersyslog.target network.target mysqld.service[Service]TypesimpleExecStart/usr/local/sbin/zabbix_server -fUserzabbix[Install]WantedBymulti-user.target#启动zabbix[rootzabbix-server ~]# systemctl start zabbix-server.service[rootzabbix-server ~]# netstat -ntap |grep 10051tcp000.0.0.0:100510.0.0.0:* LISTEN65150/zabbix_server前端页面复制到站点[rootzabbix-server ~]# cp -r /root/zabbix-6.0.6/ui/* /usr/share/nginx/html/#提供网站前面[rootzabbix-server ~]# chown -R nginx:nginx /usr/share/nginx/html/http://192.168.108.50默认登陆用户名Admin默认登陆密码zabbix被监控端安装agent通过前面mysql章节的mysql01克隆mysql001[rootmysql001 ~]# systemctl status firewalld.service● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded(/usr/lib/systemd/system/firewalld.service;disabled;vendor preset: enabled)Active: inactive(dead)Docs: man:firewalld(1)[rootmysql001 ~]# systemctl stop firewalld.service[rootmysql001 ~]# setenforce 0setenforce: SELinux is disabled[rootmysql001 ~]# rm -rf /etc/yum.repos.d/*.repo[rootmysql001 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/artifactory/os-conf/centos/centos-7.repo--2025-12-1114:55:24-- https://mirrors.huaweicloud.com/artifactory/os-conf/centos/centos-7.repo Resolving mirrors.huaweicloud.com(mirrors.huaweicloud.com)...123.249.118.101,124.70.61.162,1.92.76.132,... Connecting to mirrors.huaweicloud.com(mirrors.huaweicloud.com)|123.249.118.101|:443... connected. HTTP request sent, awaiting response...200Length:1811(1.8K)[application/octet-stream]Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’100%[]1,811--.-K/sin0s2025-12-1114:55:26(190MB/s)- ‘/etc/yum.repos.d/CentOS-Base.repo’ saved[1811/1811]#更新CA[rootmysql001 ~]# yum update ca-certificates -y#安装软件包[rootmysql001 ~]# rpm -ivh https://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-4.el7.noarch.rpmRetrieving https://repo.zabbix.com/zabbix/6.0/rhel/7/x86_64/zabbix-release-6.0-4.el7.noarch.rpm warning: /var/tmp/rpm-tmp.sAb6Z7: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY Preparing...################################# [100%]Updating / installing...1:zabbix-release-6.0-4.el7################################# [100%][rootmysql001 ~]# yum install zabbix-agent2 -y#启动服务[rootmysql001 ~]# systemctl enable zabbix-agent2.service --nowCreated symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service to /usr/lib/systemd/system/zabbix-agent2.service.#修改配置文件[rootmysql001 ~]# vim /etc/zabbix/zabbix_agent2.conf13PidFile/var/run/zabbix/zabbix_agent2.pid32LogFile/var/log/zabbix/zabbix_agent2.log43LogFileSize082Server192.168.108.50#指向监控服务器135ServerActive192.168.108.50#指向监控服务器146Hostnamemysql001#名称283Include/etc/zabbix/zabbix_agent2.d/*.conf#重启服务(先不重启看看配置生效不)[rootmysql001 zabbix_agent2.d]# systemctl restart zabbix-agent2.servicezabbix管理http://192.168.108.50监控主机zabbix首页登录后邮件服务记下在zabbix-server服务器上安装邮箱服务[rootzabbix-server ~]# yum install -y mailxLoaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Package mailx-12.5-19.el7.x86_64 already installed and latest version Nothing todo配置邮箱服务[rootzabbix-server ~]# vim /etc/mail.rc[rootzabbix-server ~]# tail -n 10 /etc/mail.rc----文件末尾新增---setfrom3186973288qq.comsetsmtpsmtps://smtp.qq.com:465setsmtp-auth-user3186973288qq.comsetsmtp-auth-password#qq授权码setsmtp-authlogin#set smtp-use-starttls 这里是不需要配置的很多地方没说明配置了反而会验证失败所以我注释掉setssl-verifyignoresetnss-config-dir/root/.certs#制定的存放QQ邮箱SSL证书的位置。setnss-config-dir/etc/pki/nssdb/[rootzabbix-server ~]# chmod -R 755 /etc/pki/nssdb/因为需要QQ邮箱的SSL证书所以我们还需要手动的获取QQ邮箱的证书保存到本地指定的目录里以备调用和验证具体命令如下[rootzabbix-server ~]# mkdir -p /root/.certs/[rootzabbix-server ~]# echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne /-BEGINCERTIFICATE-/,/-END CERTIFICATE-/p ~/.certs/qq.crtdepth2CUS, ODigiCert Inc, OUwww.digicert.com, CNDigiCert Global Root G2 verify return:1depth1CUS, ODigiCert, Inc., CNDigiCert Secure Site OV G2 TLS CN RSA4096 SHA2562022CA1 verify return:1depth0CCN, STGuangdong Province, LShenzhen, OShenzhen Tencent Computer Systems Company Limited, CN*.mail.qq.com verify return:1 DONE[rootzabbix-server ~]# certutil -A -n GeoTrust SSL CA -t C,, -d ~/.certs -i ~/.certs/qq.crtcertutil: could not decode certificate: SEC_ERROR_INVALID_ARGS: security library: invalid arguments.[rootzabbix-server ~]# certutil -A -n GeoTrust Global CA -t C,, -d ~/.certs -i ~/.certs/qq.crtcertutil: could not decode certificate: SEC_ERROR_INVALID_ARGS: security library: invalid arguments.[rootzabbix-server ~]# certutil -L -d /root/.certsCertificate Nickname Trust Attributes SSL,S/MIME,JAR/XPI为了防止出现前文所说的发送邮件警告提示还需要进入邮箱SSL证书存放目录 /root/.certs 里执行如下命令[rootzabbix-server ~]# cd /root/.certs/[rootzabbix-server .certs]# certutil -A -n GeoTrust SSL CA - G3 -t Pu,Pu,Pu -d ./ -i qq.crtNotice: Trust flag u issetautomaticallyifthe private key is present. certutil: could not decode certificate: SEC_ERROR_INVALID_ARGS: security library: invalid arguments.这是为了信任证书的标记操作。至此已经完成了mailx结合QQ邮箱发送系统邮件的部署了通过命令行发送测试邮件试试吧# 执行命令后进入交互式编辑输入正文后按 CtrlD 结束并发送\[rootzabbix-server .certs]# mailx -s test 3186973288qq.comhhh123DEOT[rootzabbix-server .certs]# Error in certificate: Peers certificate issuer is not recognized.smtp-server:/root/dead.letter0/0...message not sent.前往QQ邮箱查收测试邮件创建脚本目录并重启zabbix服务[rootzabbix-server .certs]# vim /etc/zabbix/zabbix_server.conf548AlertScriptsPath/usr/lib/zabbix/alertscripts[rootzabbix-server .certs]# mkdir -p /usr/lib/zabbix/alertscripts[rootzabbix-server .certs]# chown -R zabbix:zabbix /usr/lib/zabbix/alertscripts[rootzabbix-server .certs]# systemctl restart zabbix-server.service编写邮件发送脚本[rootzabbix-server .certs]# vim /usr/lib/zabbix/alertscripts/mailx.sh[rootzabbix-server .certs]# cat /usr/lib/zabbix/alertscripts/mailx.sh#!/bin/bash#send mailmessagesecho$3|tr\r\n\nsubjectecho$2|tr\r\n\necho${messages}|mail -s${subject}$1/tmp/mailx.log21权限设置[rootzabbix-server .certs]# touch /tmp/mailx.log[rootzabbix-server .certs]# chown -R zabbix.zabbix /tmp/mailx.log[rootzabbix-server .certs]# cd[rootzabbix-server ~]# chmod x /usr/lib/zabbix/alertscripts/mailx.sh测试脚本发送邮件[rootzabbix-server ~]# cd /usr/lib/zabbix/alertscripts/[rootzabbix-server alertscripts]# ./mailx.sh 3186973288qq.com hello mailx.sh This is test已收到邮件告警服务管理-报警媒介类型创建媒体类型

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询