监控服务zabbix
程序员文章站
2022-03-10 23:04:38
监控服务zabbix部署[root@zyy180 ~]#yum -y install net-snmp-devel libevent-devel[root@zyy180 ~]#cd /usr/src/ //将压缩包拖进来tar xf zabbix-4.0.3.tar.gz[root@zyy180 ~]#useradd -r -g zabbix -M -s /sbin/nologin zabbix...
监控服务zabbix部署
主机 | IP |
---|---|
zyy180 | 192.168.30.202 |
1.安装依赖包
[root@zyy180 ~]#yum -y install net-snmp-devel libevent-devel
2.解压
[root@zyy180 ~]#cd /usr/src/
//将压缩包拖进来
[root@zyy180 ~]#tar xf zabbix-5.0.1.tar.gz
3.创建用户
[root@zyy180 ~]#useradd -r -g zabbix -M -s /sbin/nologin zabbix
4.恢复表结构,并创建一个数据库用户
[root@zyy180 ~]#mysql -uroot -p mysql密码
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all on zabbix.* to zabbix@localhost identified by 'zabbix123!';
mysql> flush privileges;
mysql> quit
5.使用备份
[root@zyy180 ~]# cd /usr/src/zabbix-5.0.1/database/mysql/
[root@zyy180 ~]#mysql -uzabbix -pzabbix123! zabbix < schema.sql
[root@zyy180 ~]#mysql -uzabbix -pzabbix123! zabbix < images.sql
[root@zyy180 ~]#mysql -uzabbix -pzabbix123! zabbix < data.sql
5.编译并安装
[root@zyy180 mysql]# cd /usr/src/zabbix-5.0.1
[root@localhost zabbix-5.0.1]# ./configure --enable-server \
--enable-agent \
--with-mysql \
--with-net-snmp \
--with-libcurl \
--with-libxml2
[root@zyy180 zabbix-5.0.1]# make install
6.修改zabbix信息
[root@zyy180 zabbix-5.0.1]# cd /usr/local/etc/
[root@zyy180 etc]# vim zabbix_server.conf
DBPassword=zabbix123! 密码
DBUser=zabbix //数据库用户
DBName=zabbix //数据库名字
#DBHost=localhost //IP
7.启动服务
[root@zyy180 etc]# zabbix_server
[root@zyy180 etc]# zabbix_agentd
[root@zyy180 etc]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 *:10050 *:*
LISTEN 0 128 *:10051 *:*
LISTEN 0 128 *:9000 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 80 :::3306 :::*
zabbix服务端web界面安装与配置
1.修改/etc/php.ini的配置并重启php-fpm
[root@zyy180 ~]#sed -ri 's/(post_max_size =).*/\1 16M/g' /etc/php.ini
[root@zyy180 ~]#sed -ri 's/(max_execution_time =).*/\1 300/g' /etc/php.ini
[root@zyy180 ~]#sed -ri 's/(max_input_time =).*/\1 300/g' /etc/php.ini
[root@zyy180 ~]#sed -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini
[root@zyy180 lamp]# service php-fpm restart
2.创建zabbix网站
[root@zyy180 lamp]# cd /usr/src/zabbix-5.0.1
[root@zyy180 zabbix-5.0.1]# mkdir /usr/local/apache/htdocs/zabbix
[root@zyy180 zabbix-5.0.1]# cd /usr/src/zabbix-5.0.1/ui
[root@zyy180 zabbix-5.0.1]#cp -a /usr/src/zabbix-5.0.1/ui/* /usr/local/apache/htdocs/zabbix/
chown -R apache.apache /usr/local/apache/htdocs
给权限
[root@zyy180 ui]# chmod 777 /usr/local/apache/htdocs/zabbix/conf
3.修改apache虚拟主机
[root@zyy180 etc]# vim /etc/httpd24/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/usr/local/apache/htdocs/zabbix"
ServerName zabbix.zyy.com
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/zabbix/$1
<Directory "/usr/local/apache/htdocs/zabbix">
Options none
AllowOverride none
Require all granted
</Directory>
</VirtualHost>
5.重启服务
[root@zyy180 ui]# apachectl -t
Syntax OK
[root@zyy180 ui]# apachectl stop
[root@zyy180 ui]# apachectl start
如果想使用域名来登录的话
[root@zyy180 ui]# chmod 777 /usr/local/apache/htdocs/zabbix/conf
在本机hosts文件添加
192.168.30.202 zabbix.zyy.com //在本机hosts文件添加
chmod 755 /usr/local/apache/htdocs/zabbix/conf //恢复权限
zabbix默认用户 | 密码 |
---|---|
Admin | zabbix |
本文地址:https://blog.csdn.net/zyy130988/article/details/107335149
推荐阅读