部署zabbix-server
关闭防火墙以及selinux
systemctl disable firewalld
sed -i 's#SELINUX=disabled#SELINUX=enforcing#g' /etc/selinux/config
配置阿里zabbix源
vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=alibaba zabbix
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/
gpgcheck=0
enabled=1
[zabbix2]
name=alibaba zabbix frontend
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/frontend/
gpgcheck=0
enabled=1
zabbix服务,此处yum为5.0.13版本
yum -y install zabbix-server-mysql zabbix-agent
yum -y install centos-release-scl
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
安装数据库及授权zabbix账号
yum -y install mariadb mariadb-server
systemctl enable mariadb
systemctl start mariadb
mysql -uroot #进入数据库,新机器yum mariadb没有密码
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by 'passwd';
grant all privileges on zabbix.* to zabbix@localhost;
flush privileges;
\q
初始化zabbix
ls /usr/share/doc/zabbix-server-mysql-5.0.13/
zcat /usr/share/doc/zabbix-server-mysql-5.0.8/create.sql.gz | mysql -uzabbix -p'passwd' zabbix
zabbix-server配置文件
vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=passwd
启动zabbix
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value date.timezone Asia/Shanghai
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
netstart –ntpl #查看是否开启了10050与10051端口
进入web页面
http://zabbix-server-ip/zabbix # zabbix-server-ip为服务端IP地址
第一次会进行检测与配置(略)
登录: Admin/zabbix
数字证书以及部署mail
请求数字证书
mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.mxhichina.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/ali.crt
添加证书到证书数据库中
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/ali.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/ali.crt
列出目录下证书
certutil -L -d /root/.certs
执行,出现trust flag u is ……. Key is present说明SSL配置完成
cd /root/.certs/
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i ali.crt
部署mail
yum -y install sendmail mailx libreport-plugin-mailx sharutils mutt
vim /etc/mail.rc #末尾加入
set from=xxxxx@xxx.com #阿里企业邮箱地址
set smtp=smtps://smtp.mxhichina.com:465 #阿里默认禁用25端口,用465端口
set smtp-auth-user= xxxxx@xxx.com #阿里企业邮箱地址
set smtp-auth-password=passwd #阿狸企业邮箱默认开启smtp无需授权码,直接输入邮箱密码
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/root/.certs
测试
echo "mail test info" | mail -s "mail_test" xxx@xx.com 收件邮箱地址
部署邮件告警