1. zabbix配置文件
zabbix配置文件有两种:
- 服务器端配置文件(/usr/local/etc/zabbix_server.conf)
- 客户端配置文件(/usr/local/etc/zabbix_agentd.conf)
- zabbix代理配置文件(/usr/local/etc/zabbix_proxy.conf)
- 服务器端配置文件zabbix_server.conf常用配置参数:
参数 | 作用 |
---|---|
LogFile | 设置服务端日志文件存放路径 |
ListenIP | 设置服务端监听IP |
ListenPort | 设置服务端监听的端口号 |
PidFile | 设置服务端进程号文件存放路径 |
DBHost | 指定zabbix的数据库服务器IP |
DBName | 指定zabbix使用的数据库库名 |
DBUser | 指定zabbix数据库登录用户 |
DBPassword | 指定zabbix数据库登录密码 |
DBPort | 指定zabbix数据库端口号 |
User | 设置zabbix以什么用户的身份运行 |
AlertScriptsPath | 设置告警脚本存放路径 |
ExternalScripts | 外部脚本存放路径 |
客户端配置文件zabbix_agentd.conf常用配置参数:
参数 | 作用 |
---|---|
Server | 指定zabbix服务器的IP或域名 |
ServerActive | 指定zabbix服务器的IP或域名 |
Hostname | 指定本机的主机名,此项必须与web界面配置项一致 |
UnsafeUserParameters | 是否启用自定义监控项,可选值为{1 |
UserParameter | 指定自定义监控脚本参数 |
LogFile | 设置客户端日志文件存放路径 |
2.部署zabbix
环境说明:
环境 | IP | 要安装的应用 |
---|---|---|
服务器 | 192.168.232.128 | lamp架构 zabbix server zabbix agent |
客户端 | 192.168.232.130 | zabbix agent |
先安装lamp详见文章lamp部署
安装依赖包
[root@wangyitong ~]# yum -y install net-snmp-devel libevent-devel
下载zabbix与解压
[root@wangyitong ~]# wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.1.tar.gz
[root@wangyitong ~]# ls
anaconda-ks.cfg lamp zabbix-5.0.1.tar.gz
[root@wangyitong ~]# tar xf zabbix-5.0.1.tar.gz
创建zabbix用户和组
[root@wangyitong ~]# useradd -r -M -s /sbin/nologin zabbix
配置zabbix数据库
[root@wangyitong ~]# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be inre.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.30 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserv
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input state.
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.01 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix123';
Query OK, 0 rows affected, 2 warnings (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql> quit
Bye
[root@wangyitong ~]# cd zabbix-5.0.1/database/mysql/
[root@wangyitong mysql]# ls
data.sql double.sql images.sql Mak