配置zabbix客户机

    技术2022-07-10  147

    配置zabbix客户机 1.1 问题 本例要求新准备一台CentOS 7虚拟机,作为zabbix客户机,完成下列任务:

    1)配置新虚拟机svr8

    主机名:svr8.123.cn,IP地址:192.168.10.8/24 在/etc/hosts中添加 zbx.123.cn、svr8.123.cn 的本地域名记录 关闭防火墙及SELinux保护机制 2)在svr8上部署zabbix-agent客户端服务

    安装zabbix-agent软件包 允许zabbix-server服务端采集数据 启动zabbix-agent服务 1.2 步骤 实现此案例需要按照如下步骤进行。

    步骤一:配置新虚拟机svr8

    1)配置主机名为svr8.123.cn

    [root@svr8 ~]# hostnamectl set-hostname svr8.123.cn //设置主机名

    2)配置IP地址192.168.10.8/24

    [root@svr8 ~]# nmcli device status //查看设备、连接名(比如ens33) [root@svr8 ~]# nmcli connection modify ens33 ipv4.method manual ipv4.addresses "192.168.10.8/24" connection.autoconnect yes //配置IP地址 [root@svr8 ~]# nmcli connection up ens33 //激活 连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/22)

    3)添加本机主机映射记录,方便快速访问

    /etc/hosts中添加 zbx.123.cn、svr8.123.cn 的本地域名记录。 [root@svr8 ~]# vim /etc/hosts //添加本地域名记录 .. .. 192.168.10.120 zbx zbx.123.cn 192.168.10.8 svr8 svr8.123.cn

    4)关闭防火墙和SELinux保护机制

    [root@svr8 ~]# systemctl stop firewalld //立即停止防火墙 [root@svr8 ~]# systemctl disable firewalld //禁止开机自动运行 [root@svr8 ~]# setenforce 0 //使SELinux失效 [root@svr8 ~]# vim /etc/selinux/config //开机时禁用 SENETSRV=disabled

    步骤二:在svr8上部署zabbix-agent客户端服务

    1)安装zabbix-agent软件包

    [root@svr8 ~]#rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm vim /etc/yum.repos.d/zabbix.repo [zabbix] name=Zabbix Official Repository - $basearch baseurl=http://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=http://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1 [root@svr8 ~]# yum -y install zabbix-agent.rpm //安装包

    2)配置zabbix-agent,允许zabbix服务器采集数据

    [root@svr8 ~]# vim /etc/zabbix/zabbix_agentd.conf .. .. Server=127.0.0.1,192.168.10.120 //添加Zabbix服务端的IP地址 ServerActive=127.0.0.1,192.168.10.120 //添加Zabbix服务端的IP地址 Hostname=svr8.123.cn //本机的主机名

    3)开启zabbix-agent服务

    [root@svr8 ~]# systemctl restart zabbix-agent //启动服务 [root@svr8 ~]# systemctl enable zabbix-agent //设置开机自运行
    Processed: 0.011, SQL: 9