1.zabbix是一款开源监控工具,可监控对象众多,使用者较多。下面我们来安装zabbix
在安装zabbix之前,提前部署好LAMP或者LNMP。
zabbix可以在官网中获取,地址:http://www.zabbix.com/download
zabbix官网为我们提供了三种安装方式:
(1)源码编译安装
# tar -zxvf zabbix-3.2.1.tar.gz 同时安装server和agent,并支持将数据放入mysql数据中,可使用类似如下配置命令: ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-ssh2 如果仅安装server,并支持将数据放入mysql数据中,可使用类似如下配置命令: ./configure --enable-server --with-mysql --with-net-snmp --with-libcurl 如果仅安装proxy,并支持将数据放入mysql数据中,可使用类似如下配置命令: ./configure --prefix=/usr --enable-proxy --with-net-snmp --with-mysql --with-ssh2 如果仅安装agent,可使用类似如下配置命令: ./configure --enable-agent 而后编译安装zabbix即可: # make # make install
(2)配置yum源安装
[[email protected] ~]# wget http://repo.zabbix.com/zabbix/2.2/rhel/7/x86_64/zabbix-release-2.2-1.el7.noarch.rpm [[email protected] ~]# rpm -ivh zabbix-release-2.2-1.el7.noarch.rpm
[[email protected] ~]# yum clean all 已加载插件:fastestmirror, langpacks 正在清理软件源: base extras updates zabbix zabbix-non-supported Cleaning up everything Cleaning up list of fastest mirrors [[email protected] ~]# yum makecache
(3)rpm包下载安装
2.配置zabbix-database,以mysql为例,可使用mysql和pgsql
MariaDB [(none)]> create database zabbix character set utf8; MariaDB [(none)]> grant all on zabbix.* to ‘zbxuser‘@‘localhost‘ identified by ‘zbxpass‘; MariaDB [(none)]> grant all on zabbix.* to ‘zbxuser‘@‘192.168.%.%‘ identified by ‘zbxpass‘; MariaDB [(none)]> flush privileges; #连接测试 [[email protected] ~]# mysql -uzbxuser -hlocalhost -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 5.5.50-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. MariaDB [(none)]> \q Bye
3.安装zabbix
[[email protected] ~]# yum install zabbix zabbix-agent zabbix-get zabbix-sender zabbix-server zabbix-server-mysql zabbix-web zabbix-web-mysql #在httpd中生成zabbix的配置文件 [[email protected] zabbix]# systemctl restart httpd.service [[email protected] zabbix]# ls /etc/httpd/conf.d/ autoindex.conf php.conf README userdir.conf welcome.conf zabbix.conf 创建用户: [[email protected] ~]# groupadd zabbix [[email protected] ~]# useradd -g zabbix zabbix 注意:同时安装了server和agent的节点上,建议其运行用户不要相同。 source /usr/local/src/zabbix-3.0.1/database/mysql/schema.sql #导入脚本文件到zabbix数据库 source /usr/local/src/zabbix-3.0.1/database/mysql/images.sql #导入脚本文件到zabbix数据库 source /usr/local/src/zabbix-3.0.1/database/mysql/data.sql #导入脚本文件到zabbix数据库
时间: 2024-10-22 17:41:39