被监控主机安装zabbix-agent
启动zabbix-agent并且设置开机自启zabbix-get安装zabbix-get软件zabbix server可以去agent获取数据--》pull 拉zabbix-agent上授权zabbix-server可以过来拉数据在被监控主机上关闭防火墙和selinux在zabbix server上执行。
·
zabbix-agent
下载zabbix-agent
[root@zabbix-agentd-1 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
获取https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
警告:/var/tmp/rpm-tmp.NrXaKd: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:zabbix-release-5.0-1.el7 ################################# [100%]
[root@zabbix-agentd-1 ~]# yum install zabbix-agent -y
启动zabbix-agent并且设置开机自启
[root@zabbix-agentd-1 ~]# service zabbix-agent start
Redirecting to /bin/systemctl start zabbix-agent.service
[root@zabbix-agentd-1 ~]# systemctl enable zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@zabbix-agentd-1 ~]# ps aux|grep zabbix
zabbix 7236 0.0 0.0 78596 1272 ? S 10:49 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
zabbix 7237 0.0 0.0 78596 1340 ? S 10:49 0:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 7238 0.0 0.0 78596 1820 ? S 10:49 0:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 7239 0.0 0.0 78596 1820 ? S 10:49 0:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 7240 0.0 0.0 78596 1820 ? S 10:49 0:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 7241 0.0 0.1 78596 2212 ? S 10:49 0:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 7249 0.0 0.0 112724 988 pts/0 S+ 10:50 0:00 grep --color=auto zabbix
zabbix-get
安装zabbix-get软件
zabbix server可以去agent获取数据--》pull 拉
[root@zabbix ~]# yum install zabbix-get -y
[root@zabbix ~]# zabbix_get -s 192.168.102.140 -p 10050 -k "system.cpu.load[all,avg1]"
zabbix_get [18708]: Check access restrictions in Zabbix agent configuration
zabbix-agent上授权zabbix-server可以过来拉数据
[root@zabbix-agentd-1 zabbix]# pwd
/etc/zabbix
[root@zabbix-agentd-1 zabbix]# vim zabbix_agentd.conf
##### Passive checks related
### Option: Server
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
# Incoming connections will be accepted only from the hosts listed here.
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
# and '::/0' will allow any IPv4 or IPv6 address.
# '0.0.0.0/0' can be used to allow any IPv4 address.
# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes, if StartAgents is not explicitly set to 0
# Default:
# Server=
Server=127.0.0.1,192.168.102.135
##### Active checks related
### Option: ServerActive
# Zabbix server/proxy address to get active checks from.
# Server/proxy address is IP address or DNS name and optional port separated by colon.
# Multiple Zabbix servers and Zabbix proxies can be specified, separated by comma.
# More than one Zabbix proxy should not be specified from each Zabbix server.
# If Zabbix proxy is specified then Zabbix server for that proxy should not be specified.
# Multiple comma-delimited addresses can be provided to use several independent Zabbix servers in parallel. Spaces are allowed.
# If port is not specified, default port is used.
# IPv6 addresses must be enclosed in square brackets if port for that host is specified.
# If port is not specified, square brackets for IPv6 addresses are optional.
# If this parameter is not specified, active checks are disabled.
# Example: ServerActive=127.0.0.1:20051,zabbix.example.com,[::1]:30051,::1,[12fc::1]
#
# Mandatory: no
# Default:
# ServerActive=
ServerActive=127.0.0.1,192.168.102.135 #允许的ip地址,过来拿数据
[root@zabbix-agentd-1 zabbix]# service zabbix-agent restart
Redirecting to /bin/systemctl restart zabbix-agent.service
在被监控主机上关闭防火墙和selinux
[root@centos-LB-1 zabbix]# service firewalld stop
Redirecting to /bin/systemctl stop firewalld.service
[root@centos-LB-1 zabbix]# getenforce
Disabled
在zabbix server上执行
[root@zabbix ~]# zabbix_get -s 192.168.102.140 -p 10050 -k "system.cpu.load[all,avg1]"
0.000000
添加被监控主机
步骤
点配置--》主机--》创建主机
主机: 被zabbix-server监控的主机 。
模板: template 里面已经集合了很多的好用的应用集,专门针对web的模板,MySQL的模板。
cpu,disk(filesystem),memory,interface traffic等。
应用集: 各种各样的应用的集合,zabbix对应用进行分类: web,database,ssh,traffic,cpu,memory,disk等,各种监控项的集合。
监控项: 被监控的某个项目,例如cpu的使用率, cpu的负载等,网络的流量 针对某个具体的功能进行的监控。
监控项--》应用集---》模板: 针对某类型的应用配置好了很多的应用集,应用集有很多的监控项。
使用模板的好处就是简单,快速的添加监控项
常见的key
net.if.out["ens33"]
net.if.in["ens33"]
vfs.fs.size[/,used]
system.cpu.util[,system]
system.cpu.util[,user]
vm.memory.size[pavailable]
更多推荐
所有评论(0)