zabbix 安装配置

  • 命令

[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# setenforce 0

[root@localhost ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

 [root@localhost ~]# yum -y install zabbix-server-mysql  zabbix-web-mysql mariadb-server httpd

 

#启动服务

service httpd restart 

systemctl start mariadb.service

 

#MYSQl初始化

[root@localhost yum.repos.d]# mysql_secure_installation

密码可以不设置(n) 其他选项y

 

登录mysql

[root@localhost ~]# mysql

创建数据库

mysql> create database zabbix character set utf8 collate utf8_bin;

zabbix用户授权,密码设置为123456

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';

 

导出数据

#使用Mysql来导入Zabbix server的初始化数据库schema和数据

[root@localhost doc]# zcat /usr/share/doc/zabbix-server-mysql-3.4.15/create.sql.gz  | mysql -uzabbix -p123456  zabbix

查询表是否导入成功

[root@localhost doc]# mysql -uroot zabbix -e 'show tables'

 

 

修改配置文件

[root@localhost doc]# vim /etc/zabbix/zabbix_server.conf

#修改这三处位置

DBHost=localhost

DBName=zabbix #数据库

DBUser=zabbix    #用户

DBPassword=123456 #密码

 

这是我的zabbix-server 配置文件

点击查看代码
cat /etc/zabbix/zabbix_server.conf |grep -Ev "^$|^#"
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
StartDiscoverers=5
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
UnavailableDelay=300
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

 

#启动zabbix,并配置自启动

[root@localhost doc]# systemctl start zabbix-server

[root@localhost doc]# systemctl enable zabbix-server

修改zabbbix时区

[root@localhost doc]# vim /etc/httpd/conf.d/zabbix.conf

#修改时区为亚洲-上海

php_value date.timezone Asia/Shanghai

11.访问zabbix,http://IP/zabbix/

#默认用户名Admin,密码zabbix

 

上一篇:监控Redis


下一篇:zabbix 添加主机监控