Centos 7下搭建Zabbix监控软件 红太狼 2022-07-14 02:25 175阅读 0赞 # 环境说明 # Centos 7 Zabbix 3.2 # 操作步骤 # ## zabbix server安装配置 ## 我们先来看看zabbix server搭建步骤,这里是通过repository package进行安装 1.安装repository package #rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm 2.安装zabbix-server #yum install zabbix-server-mysql zabbix-web-mysql 3.安装mariadb数据库,在Centos7中默认安装的是mariadb,作为mysql的衍生版,同样可以作为zabbix-server的后端数据库使用。 #yum install mariadb-server 初始化mariadb #systemctl start mariadb #systemctl enable mariadb #mysqladmin -uroot password 123456 在mariadb中创建zabbix数据库 MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) 导入数据至zabbix数据库中 #zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uroot -p zabbix 4.修改zabbix-server的配置文件/etc/zabbix/zabbix\_server.conf,主要是数据库方面的修改 DBHost=localhost DBName=zabbix DBUser=root DBPassword=123456 5.修改httpd中zabbix配置文件/etc/httpd/conf.d/zabbix.conf,主要是timezone参数,默认情况下timezone参数是被注释掉的,要删除注释,并设置对应的timezone <Directory "/usr/share/zabbix"> Options FollowSymLinks AllowOverride None Require all granted <IfModule mod_php5.c> php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 php_value always_populate_raw_post_data -1 php_value date.timezone Asia/Shanghai </IfModule> </Directory> 6.启动zabbix-server以及httpd #systemctl start zabbix-server #systemctl enable zabbix-server #systemctl start httpd #systemctl enable httpd 7.在启动zabbix-server后,可以通过http://zabbix-server-ip/zabbix访问zabbix-server的web console,需要设置一些数据库用户名密码,设置完成后进入一下界面,默认用户名和密码为admin/zabbix ![Center][] 以上就完成后zabbix-server的安装配置,我们下面来看看zabbix-agent也就是被监控端的安装配置 ## zabbix-agent安装配 ## 我们安装zabbix-agent也是通过repository package进行安装 1.安装repository package #rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm 2.安装zabbix-agent #yum install zabbix-agent 3.修改zabbix-agent的配置文件/etc/zabbix/zabbix-agentd.conf,主要修改以下参数 Server以及Server Active中填写zabbix-Server的IP地址 Hostname中填写zabbix-agent的主机名,也就是本机的主机名 Server=10.10.200.193 Server Active=10.10.200.193 Hostname=zabbix-agent-1 4.启动zabbix-agent #systemctl start zabbix-agent #systemctl enable zabbix-agent 5.在zabbix-server webconsole中添加zabbix-agent,进入web console后点击configuration-->host ![Center 1][] 点击create host,主要填写如下红色标示的参数 ![Center 2][] 填写好host信息后,我们来选择监控的模板,点击Templates ![Center 3][] 选择模板,点击select,在这里我们可以看见很多模板,我们选择Template OS Linux,主要要点击两个Add按键,这个设计比较奇葩 ![Center 4][] 选择完成后,我们可以在Host主页看见已经添加的zabbix-agent,如果页面上提示有绿色的ZBX,则表示zabbix-agent已经添加成功了 ![Center 5][] OK,以上就是全部的zabbix-server&zabbix-agent的基本安装配置过程。 附录: 在安装过程中,碰到的问题比较少 Q1:安装完成后,进入web console,提示zabbix server is not running,the information displayed may not be current。 此时查看zabbix server中的10051端口以及zabbix server的进程都是正常状态,是selinux问题,需要关闭selinux \#setenforce 0 或者在/etc/sysconfig/selinux中设置selinux=disabled(需要重启服务器才能生效) [Center]: /images/20220714/352764e83fb9486f984665df0a19ade9.png [Center 1]: /images/20220714/c4e0699b0f454b5c94dc151f5c678e3a.png [Center 2]: /images/20220714/d50b726533f4475e9df4c98e7ce13e3d.png [Center 3]: /images/20220714/36409341ce6942aeb6004b010b045d58.png [Center 4]: /images/20220714/95dbce6a59724531b9e7314c9c40372c.png [Center 5]: /images/20220714/c59b77a7c53c4eefb62848e0b58e87b1.png
还没有评论,来说两句吧...