zabbix 监控配置监控配置流程
- 配置主机组
- 添加主机
- 添加监控项
模板
手动添加 - 添加触发器
- 配置用户媒介
- 配置告警方式和动作
- 手动触发告警
zabbix配置文件
zabbix配置文件有两种
服务器配置文件(/usr/local/etc/zabbix_server.conf)
客户端配置文件(/usr/local/etc/zabbix_agentd.conf)
zabbix代理配置文件 (/usr/local/etc/zabbix_proxy.conf)
服务器端口配置文件zabbix_server.server.conf常见配置参数
参数 | 作用 |
---|---|
logfile | 设置服务端日志文件存放 |
listenip | 设置监听ip |
listenport | 监听端口 |
pidfile | 设置进程号文件 |
dbhost | zabbix的数据库服务器 |
[root@localhost ~]# apachectl start
[root@localhost ~]# service mysqld start
Starting MySQL........... SUCCESS!
[root@localhost ~]# service php-fpm start
Starting php-fpm done
[root@localhost ~]# zabbix_server
[root@localhost ~]# zabbix_agentd
[root@localhost ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:9000 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 0.0.0.0:10050 0.0.0.0:*
LISTEN 0 128 0.0.0.0:10051 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
[root@localhost ~]#
配置网络源
- 安装编译所需的开发包和依赖包
[root@150 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
[root@150 ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
//安装依赖包
[root@150 zabbix-5.2.0]# yum -y install wget gcc gcc-c++
[root@150 zabbix-5.2.0]# yum -y install pcre-devel make
//编译
[root@150 zabbix-5.2.0]# ./configure --enable-agent
//创建zabbix用户
[root@150 zabbix-5.2.0]# useradd -r -M -s /sbin/nologin zabbix
[root@150 zabbix-5.2.0]# make install
//修改/usr/local/etc/zabbix_agentd.conf配置文件
[root@150 etc]# vim zabbix_agentd.conf
Server=192.168.11.150 //添加
ServerActive=192.168.11.159
//启动zabbix_agentd服务并查看端口
[root@150 zabbix-5.2.0]# zabbix_agentd
[root@150 zabbix-5.2.0]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:10050 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
[root@150 zabbix-5.2.0]#
//关闭防火墙和seliunx
[root@150 ~]# systemctl stop firewalld
[root@150 ~]# setenforce 0
[root@150 ~]# systemctl dis(/usr/local/etc/zabbix_proxy.conf)able firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
配置主机组
监控
创建主机群组
添加主机
点击配置——主机群组——创建主机群组,
模板与添加监控项
创建监控项
添加触发器
t@150 ~]# touch /etc/abc
[root@150 ~]# ll /etc/abc
-rw-r--r-- 1 root root 0 Nov 6 14:41 /etc/abc
[root@150 ~]# echo 'hell'>> /etc/a
abc aliases anacrontab authselect/
adjtime alternatives/ audit/
[root@150 ~]# echo 'hell'>> /etc/abc
[root@150 ~]# echo 'hell'>> /etc/abc
[root@150 ~]#