Zabbix篇一:服务端安装
安装篇
Zabbix安装篇一:服务端安装教程
Zabbix安装篇二:Linux批量安装客户端Zabbix-agent
Zabbix安装篇三:windows批量安装客户端Zabbix-agent
Zabbix安装篇四:钉钉机器人报警
监控篇
Zabbix监控篇一:监控SQL Server数据库
Zabbix监控篇二:监控Mariadb数据库
Zabbix监控篇三:监控Exchange Server
Zabbix监控篇四:监控路由器
zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
zabbix由2部分构成,zabbix server与可选组件zabbix agent。
zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。
最近公司部署zabbix用于监控服务器,记录下自己操作信息,下面是在测试环境上安装的一个操作步骤:
一、安装环境:
1、系统环境:CentOS Linux release 7.5.1804 (Core)
2、zabbix版本:zabbix-release-3.4-2.el7.noarch
3、测试环境,关闭了防火墙(生产环境不建议关闭,根据需求设置防火墙)
# systemctl stop firewlld.service 关闭防火墙
# systemctl disable firewalld.service开机禁用防火墙启动
4、关闭Selinux
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# setenforce 0
二、安装数据库
1、指定下载最新的10.2版本,编辑安装包路径下载路径:
# vim /etc/yum.repos.d/base.repo(没有base.repo可以自己创建)
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck = 1
2、安装10.2的mariadb
yum install mariadb-server
3、设置mariadb
# systemctl start mariadb启动
# systemctl enable mariadb 设置开机启动
# systemctl status mariadb 查看启动状态
三、Zabbix3.4安装及配置
1、下载和安装Zabbix
# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm(下载Zabbix最新版本)
# yum install zabbix-server-mysql zabbix-web-mysql -y
2、创建数据和导入数据
# mysql
Welcome to the MariaDB monitor.Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.2.17-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; 创建数据库zabbix
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';设置zabbix权限和密码
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit 退出
Bye
导入数据库
# zcat /usr/share/doc/zabbix-server-mysql-3.4.13/create.sql.gz|mysql -uzabbix -pzabbix zabbix
配置数据库用户和密码
# vim /etc/zabbix/zabbix_server.conf 修改配置文件,设置密码
DBPassword=zabbix
# grep -n '^' /etc/zabbix/zabbix_server.conf查看关键配置信息
38:LogFile=/var/log/zabbix/zabbix_server.log
49:LogFileSize=0
72:PidFile=/var/run/zabbix/zabbix_server.pid
82:SocketDir=/var/run/zabbix
101:DBName=zabbix 数据库名称
117:DBUser=zabbix 用户名称
126:DBPassword=zabbix 数据库密码
330:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
448:Timeout=4
490:AlertScriptsPath=/usr/lib/zabbix/alertscripts
500:ExternalScripts=/usr/lib/zabbix/externalscripts
536:LogSlowQueries=3000
启动zabbix和设置开机启动
# systemctl start zabbix-server
# systemctl enable zabbix-server
编辑Zabbix前端PHP配置,更改时区
# vim /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai #修改为亚洲上海
启动http和设置开启启动
# systemctl start httpd
# systemctl enable httpd
四、安装Zabbix Web
1、通过浏览器访问,并配置信息
http://s1.运维网.com/images/20180911/1536654905122190.png
http://s1.运维网.com/images/20180911/1536655991691042.jpg
http://s1.运维网.com/images/20180911/1536655997341900.jpg
http://s1.运维网.com/images/20180911/1536656006937908.jpg
http://s1.运维网.com/images/20180911/1536656012118219.jpg
http://s1.运维网.com/images/20180911/1536656018455547.jpg
# cat /etc/zabbix/web/zabbix.conf.php 查看生成配置文件信息
页:
[1]