一、zabbix的安装和使用 (一)、web环境的搭建 1、安装LAMP [root@localhost ~]# wget -P /etc/yum.repos.d http://mirrors.aliyun.com/repo/Centos-7.repo [root@localhost ~]# yum -y install mariadb mariadb-server php php-mysql httpd 2、配置Selinux与防火墙 [root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent success [root@localhost ~]# firewall-cmd --reload Success 3、测试apache [root@localhost ~]# systemctl start httpd [root@localhost ~]# systemctl enable httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. 4、配置数据库 [root@localhost ~]# systemctl enable mariadb Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service. [root@localhost ~]# systemctl start mariadb [root@localhost ~]# mysql_secure_installation 5、创建zabbix数据库及用户 [root@localhost ~]# mysql -uroot -p123456 -e "create database zabbix default character set utf8 collate utf8_bin;" [root@localhost ~]# useradd zabbix [root@localhost ~]# passwd zabbix [root@localhost ~]# mysql -uroot -p123456 -e "grant all on zabbix. * to 'zabbix'@'%' identified by 'zabbix';" [root@localhost ~]# mysql -uzabbix -pzabbix (二)、server端安装配置 1、软件包安装 [root@localhost~]#rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm [root@localhost ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get 2、配置数据库 [root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-3.0.32/ [root@localhost zabbix-server-mysql-3.0.32]# zcat create.sql.gz | mysql -uroot -p123456 zabbix [root@localhost ~]# cd /etc/zabbix [root@localhost zabbix]# vim zabbix_server.conf DBHost=localhost DBname=zabbix DBUser=zabbix DBpassword=itcast [root@localhost ~]# cd /etc/httpd/conf.d/ [root@localhost conf.d]# vim zabbix.conf php_value data.timezone Asia/Shanghai [root@localhost conf.d]# systemctl start zabbix-server [root@localhost conf.d]# systemctl enable zabbix-server 3、zabbix访问 启动: [root@localhost conf.d]# systemctl restart httpd 4、配置web界面 连接数据库: 端口号默认10051,名字为可选 总信息 如下显示及配置完成 管理员用户名为:Admin 密码:zabbix 二、如何使用zabbix (一)、Agent端安装配置 1、安装Agent [root@localhost ~]# yum -y install zabbix-agent 2、配置zabbix-agent [root@localhost ~]# vim /etc/zabbix/zabbix_agentd.conf 3、启动zabbix-agent [root@localhost ~]# systemctl start zabbix-agent [root@localhost ~]# systemctl enable zabbix-agent 4、配置防火墙与Selinux [root@localhost ~]# firewall-cmd --zone=public --add-port=10050/tcp –permanent (二)、测试连通性 [root@localhost ~]# zabbix_get -s 192.168.48.174 -k system.uname [root@localhost ~]# zabbix_get -s 192.168.48.174 -k system.cpu.load[all,avg15] (三)、创建zabbix用户 1、配置: Alias:chan。 Name:chan。 Surname:chan Group:Zabbix administrations。 Media:root@localhost.localdmi。 Permissions:ZabbixSuper Admin。 (四)、添加host 1、配置: Host name:Test_Host1 Groups In groups:Virtual machines IP address:192.168.48.174 Port:10050
(五)、配置Item 1、配置 Name:CPULoad Type:Zabbix agent Key:system.cpu.load[avg1] Host interface:192.168.48.174:10050 Type of information:Numeric(float)
(六)、创建Trigger 1、配置信息如下: Item:Test_Host1:CPULoad Function:Last(most recent)T value is = N N:2
(七)、设置Action
三、数据可视化 (一)图表的使用
(二)、分屏的实现
|
Zabbix部署
最新推荐文章于 2024-07-19 23:50:27 发布