LNMP安装zabbix

心已赠人 2022-11-25 00:51 275阅读 0赞

监控服务zabbix部署

    • 1.监控服务zabbix安装
    • 2.zabbix服务端web界面安装与配置
    • 3.网页安装zabbix

上篇lnmp部署
zabbix简介
zabbix自定义监控      














主机 IP
zyy180 192.168.30.150/24

1.监控服务zabbix安装

  1. 1.安装依赖包
  2. [root@zyy180 ~]#yum -y install net-snmp-devel libevent-devel
  3. 2.解压
  4. [root@zyy180 ~]#cd /usr/src/
  5. //将压缩包拖进来
  6. [root@zyy180 ~]#tar xf zabbix-5.0.1.tar.gz
  7. 3.创建用户
  8. [root@zyy180 ~]#useradd -r -M -s /sbin/nologin zabbix
  9. 4.恢复表结构,并创建一个数据库用户
  10. [root@zyy180 ~]#mysql -uroot -p mysql密码
  11. mysql> create database zabbix character set utf8 collate utf8_bin;
  12. mysql> grant all on zabbix.* to zabbix@localhost identified by 'zabbix123!';
  13. mysql> flush privileges;
  14. mysql> quit
  15. 5.使用备份
  16. [root@zyy180 ~]# cd /usr/src/zabbix-5.0.1/database/mysql/
  17. [root@zyy180 ~]#mysql -uzabbix -pzabbix123! zabbix < schema.sql
  18. [root@zyy180 ~]#mysql -uzabbix -pzabbix123! zabbix < images.sql
  19. [root@zyy180 ~]#mysql -uzabbix -pzabbix123! zabbix < data.sql
  20. 5.编译并安装
  21. [root@zyy180 mysql]# cd /usr/src/zabbix-5.0.1
  22. [root@localhost zabbix-5.0.1]# ./configure --enable-server \
  23. --enable-agent \
  24. --with-mysql \
  25. --with-net-snmp \
  26. --with-libcurl \
  27. --with-libxml2
  28. [root@zyy180 zabbix-5.0.1]# make install
  29. 6.修改zabbix信息
  30. [root@zyy180 zabbix-5.0.1]# cd /usr/local/etc/
  31. [root@zyy180 etc]# vim zabbix_server.conf
  32. DBPassword=zabbix123! 密码
  33. DBUser=zabbix //数据库用户
  34. DBName=zabbix //数据库名字
  35. DBHost=localhost //IP
  36. 7.启动服务
  37. [root@zyy180 etc]# zabbix_server
  38. [root@zyy180 etc]# zabbix_agentd
  39. [root@zyy180 ~]# ss -anlt
  40. State Recv-Q Send-Q Local Address:Port Peer Address:Port
  41. LISTEN 0 128 *:80 *:*
  42. LISTEN 0 128 *:22 *:*
  43. LISTEN 0 100 127.0.0.1:25 *:*
  44. LISTEN 0 128 *:10050 *:*
  45. LISTEN 0 128 *:10051 *:*
  46. LISTEN 0 128 *:9000 *:*
  47. LISTEN 0 128 :::22 :::*
  48. LISTEN 0 100 ::1:25 :::*
  49. LISTEN 0 80 :::3306 :::*

   

2.zabbix服务端web界面安装与配置

  1. 1.修改/etc/php.ini的配置并重启php-fpm
  2. [root@zyy180 ~]#sed -ri 's/(post_max_size =).*/\1 16M/g' /etc/php.ini
  3. [root@zyy180 ~]#sed -ri 's/(max_execution_time =).*/\1 300/g' /etc/php.ini
  4. [root@zyy180 ~]#sed -ri 's/(max_input_time =).*/\1 300/g' /etc/php.ini
  5. [root@zyy180 ~]#sed -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini
  6. [root@zyy180 lamp]# service php-fpm restart
  7. 2.创建zabbix网站
  8. [root@zyy180 ~]# mkdir /usr/local/nginx/html/zabbix
  9. [root@zyy180 ~]# cp -a /usr/src/zabbix-5.0.1/ui/* /usr/local/nginx/html/zabbix/
  10. [root@zyy180 ~]# chown -R nginx.nginx /usr/local/nginx/html
  11. 给权限
  12. [root@zyy180 ~]# chmod 777 /usr/local/nginx/html/zabbix/conf
  13. 3.修改nginx虚拟主机
  14. [root@zyy180 ~]# vim /usr/local/nginx/conf/nginx.conf
  15. location ~ \.php$ {
  16. root html/zabbix; ##确定网页目录根位置
  17. fastcgi_pass 127.0.0.1:9000;
  18. fastcgi_index index.php;
  19. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  20. include fastcgi_params;
  21. }
  22. location / {
  23. root html/zabbix; ##html/zabbix
  24. index index.php index.html index.htm;
  25. }
  26. 检查语法是否有错误
  27. [root@zyy180 zabbix-5.0.1]# nginx -t
  28. nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
  29. nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
  30. 重读配置文件
  31. [root@zyy180 ~]# nginx -s reload
  32. [root@zyy180 ~]# ss -anlt
  33. State Recv-Q Send-Q Local Address:Port Peer Address:Port
  34. LISTEN 0 128 *:80 *:*
  35. LISTEN 0 128 *:22 *:*
  36. LISTEN 0 100 127.0.0.1:25 *:*
  37. LISTEN 0 128 *:10050 *:*
  38. LISTEN 0 128 *:10051 *:*
  39. LISTEN 0 128 *:9000 *:*
  40. LISTEN 0 128 :::22 :::*
  41. LISTEN 0 100 ::1:25 :::*
  42. LISTEN 0 80 :::3306 :::*

   

3.网页安装zabbix

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述    

  1. 把权限还原
  2. [root@zyy180 ~]# chmod 755 /usr/local/nginx/html/zabbix/conf

发表评论

表情:
评论列表 (有 0 条评论,275人围观)

还没有评论,来说两句吧...

相关阅读