为什么要使用监控
1.对系统不间断实时监控
2.实时反馈系统当前状态
3.保证服务可靠性安全性
4.保证业务持续稳定运行
如何进行监控,比如我们需要监控磁盘的使用率
1.如何查看磁盘使用率df -h
2.监控磁盘的那些指标block、inode
3.如何获取具体的信息df -h|awk '/\/$/{print $(NF-1)}'
4.获取的数值到达多少报警 80%
zabbix监控与传统的监控的区别是什么?
1.硬件监控 路由器、交换机、防火墙 (DELL IRDAC ipmi)
2.系统监控 CPU、内存、磁盘、网络、进程、TCP
3.服务监控 nginx、php、tomcat、redis、memcache、mysql
4.WEB监控 请求时间、响应时间、加载时间、
5.日志监控 ELk(收集、存储、分析、展示) 日志易
6.安全监控 Firewalld、WAF(Nginx+lua)、安全宝、牛盾云、安全狗
7.网络监控 smokeping 多机房
8.业务监控 活动引入多少流量、产生多少注册量、带来多大价值
环境
zabbix version | 4.0 |
---|---|
系统版本 | centos7.6 |
优化系统
关闭防火墙firewalld
systemctl disable firewalld
systemctl stop firewalld
关闭selinux
sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config
调整单个进程最大能打开文件的数量
echo '* - nofile 65535' >> /etc/security/limits.conf
配置镜像仓库
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum clean all
安装Zabbix server, agent,web
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
安装有可能报错
解决方法
[zabbix]
name=Zabbix Official Repository - $basearch
#baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/$basearch/ #修改为阿里云地址
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
#baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/debuginfo/
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/$basearch/debuginfo/ #修改为阿里云地址
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=1
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
yum clean all
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
安装数据库(这里安装mariadb)
yum install mariadb mariadb-server -y
systemctl restart mariadb
systemctl enable mariadb
创建数据库
mysql -uroot -e "create database zabbix character set utf8 collate utf8_bin;"
mysql -uroot -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';"
远程连接
mysql -uroot -e "grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';"
将数据导入到数据库中
zcat /usr/share/doc/zabbix-server-mysql-4.0.24/create.sql.gz | mysql -uroot zabbix
配置zabbix-server
grep '^D' /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
为Zabbix前端配置PHP,修改时区
vim /etc/httpd/conf.d/zabbix.conf
···
php_value date.timezone Asia/Shanghai
···
重启服务
systemctl restart zabbix-server zabbix-agent httpd
访问浏览器
http://zabbix_server_ip/zabbix
账号密码
Admin/zabbix
修改中文
解决中文乱码问题
解决方案
#过滤字体所在目录
rpm -ql zabbix-web | grep fonts
[root@harbor fonts]# ll
lrwxrwxrwx. 1 root root 33 Sep 2 14:44 graphfont.ttf -> /etc/alternatives/zabbix-web-font
[root@harbor fonts]# cd /etc/alternatives/
[root@harbor fonts]# ll
lrwxrwxrwx. 1 root root 33 Sep 2 14:44 graphfont.ttf -> /etc/alternatives/zabbix-web-font
[root@harbor alternatives]# ll
lrwxrwxrwx. 1 root root 15 Mar 24 14:07 ld -> /usr/bin/ld.bfd
lrwxrwxrwx. 1 root root 34 Mar 24 14:07 libnssckbi.so.x86_64 -> /usr/lib64/pkcs11/p11-kit-trust.so
lrwxrwxrwx. 1 root root 26 Mar 24 14:08 mta -> /usr/sbin/sendmail.postfix
lrwxrwxrwx. 1 root root 40 Mar 24 14:08 mta-aliasesman -> /usr/share/man/man5/aliases.postfix.5.gz
lrwxrwxrwx. 1 root root 22 Mar 24 14:08 mta-mailq -> /usr/bin/mailq.postfix
lrwxrwxrwx. 1 root root 38 Mar 24 14:08 mta-mailqman -> /usr/share/man/man1/mailq.postfix.1.gz
lrwxrwxrwx. 1 root root 27 Mar 24 14:08 mta-newaliases -> /usr/bin/newaliases.postfix
lrwxrwxrwx. 1 root root 43 Mar 24 14:08 mta-newaliasesman -> /usr/share/man/man1/newaliases.postfix.1.gz
lrwxrwxrwx. 1 root root 23 Mar 24 14:08 mta-pam -> /etc/pam.d/smtp.postfix
lrwxrwxrwx. 1 root root 22 Mar 24 14:08 mta-rmail -> /usr/bin/rmail.postfix
lrwxrwxrwx. 1 root root 25 Mar 24 14:08 mta-sendmail -> /usr/lib/sendmail.postfix
lrwxrwxrwx. 1 root root 41 Mar 24 14:08 mta-sendmailman -> /usr/share/man/man1/sendmail.postfix.1.gz
lrwxrwxrwx. 1 root root 25 Sep 2 13:59 mysqlbug -> /usr/lib64/mysql/mysqlbug
lrwxrwxrwx. 1 root root 29 Sep 2 14:44 zabbix-server -> /usr/sbin/zabbix_server_mysql
lrwxrwxrwx. 1 root root 38 Sep 2 14:44 zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf #存放字体所在目录
[root@harbor alternatives]# cd /usr/share/fonts/dejavu/
找到Windows字体位置
C:\Windows\Fonts
将字体微软雅黑复制到桌面
#将msyh.ttc上传至/usr/share/fonts/dejavu/目录下面
#替换字体
[root@harbor dejavu]# mv DejaVuSans.ttf DejaVuSans.ttf.bak
[root@harbor dejavu]# mv msyh.ttc DejaVuSans.ttf
重新访问浏览器查看字体
zabbix官网:https://www.zabbix.com/download
笔者联系方式
QQ:1359013011
微信同上
转载:https://blog.csdn.net/wang688098/article/details/108378383
查看评论