Zabbix
目录
rpm安装
Install zabbix from package rpm安装按照官方文档一步步就好了
https://www.zabbix.com/download
zabbix sources源码安装(centos7)
源码安装只要提前安装好lamp然后编译源码包就可以了.
https://www.zabbix.com/download_sources
lamp最好也是使用源码安装,如果使用yum安装apache, php,mysql:
yum install httpd httpd-devel php php-devel php-mysql mariadb mariadb-server mariadb-devel -y
前提: 源码安装好apapche, php, mysql
下载zabbix版本
https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.2.1/zabbix-4.2.1.tar.gz/download
zabbix server端和zabbix agent执行如下代码
yum install curl curl-devel net-snmp net-snmp-devel perl-DBI -y
创建zabbix用户和组
grouopadd zabbix; useradd -g zabbix zabbix; usermod -s /sbin/nologin zabbix
或:
groupadd --system zabbix
useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix
解压源码并编译
tar -zxvf zabbix-4.2.1.tar.gz
./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
make -j$(grep processor /proc/cpuinfo | wc -l)
make install
ln -s /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/
创建mysql用户并在源码包里面导入zabbix的sql语句
shell> mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> quit;
shell> cd database/mysql
shell> mysql -uzabbix -p<password> zabbix < schema.sql
# stop here if you are creating database for Zabbix proxy
shell> mysql -uzabbix -p<password> zabbix < images.sql
shell> mysql -uzabbix -p<password> zabbix < data.sql
配置php
#把源码包里面frontends目录下的所有php文件拷贝到apache的站点目录
mkdir <htdocs>/zabbix #这里使用了子目录zabbix,不用也可以
cd frontends/php
cp -a . <htdocs>/zabbix
管理启动服务
cd zabbix-4.2.1
cp misc/init.d/tru64/zabbix_server /etc/init.d/zabbix_server
chmod 700 /etc/init.d/zabbix_server
chkconfig zabbix_server on