专属小白们的Zabbix部署详解

栏目: 数据库 · 发布时间: 7年前

内容简介:简介:zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。

简介:

zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。

zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。

zabbix由2部分构成,zabbix server与可选组件zabbix agent。

zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。

特点:

zabbix的主要特点:

  • 安装与配置简单,学习成本低
  • 支持多语言(包括中文)
  • 免费开源
  • 自动发现服务器与网络设备
  • 分布式监视以及WEB集中管理功能
  • 可以无agent监视
  • 用户安全认证和柔软的授权方式
  • 通过WEB界面设置或查看监视结果
  • email等通知功能
    功能:
  • CPU负荷
  • 内存使用
    -磁盘使用
  • 网络状况
  • 端口监视
  • 日志监视
    实验环境: CentOS7(两台:监控服务器、被监控端)
    编译包: 链接: https://pan.baidu.com/s/19DvMqz0s01ByYBQl79ptqw
    提取码:ha42
    具体实验步骤:
    搭建监控服务器:
    #关闭防火墙##
    [root@cacti ~]# systemctl stop firewalld.service
    [root@cacti ~]# systemctl disable firewalld.service
    Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
    Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
    [root@cacti ~]# setenforce 0

--------安装LAMP-------------------------------------------------------

[root@cacti ~]# yum install -y \

httpd \

mariadb-server mariadb \

php \

php-mysql \

php-gd \

libjpeg* \

php-ldap \

php-odbc \

php-pear \

php-xml \

php-xmlrpc \

php-mhash

[root@cacti ~]# vim /etc/httpd/conf/httpd.conf

ServerName www.yun.com:80 ##95行

DirectoryIndex index.html index.php ##164行

[root@cacti ~]# vim /etc/php.ini

date.timezone = PRC ##878行 设置中国时区(去掉分号,添加PRC)

[root@cacti ~]# systemctl start httpd.service

[root@cacti ~]# systemctl start mariadb.service

[root@cacti ~]# netstat -ntap | egrep '(3306|80)'

tcp 0 0 0.0.0.0:3306 0.0.0.0:

LISTEN 45660/mysqld

tcp6 0 0 :::80 :::

LISTEN 45388/httpd

[root@cacti ~]# mysql_secure_installation

y

abc123 (自己设置密码)

abc123

n

n

n

y

##进入数据库

[root@cacti ~]# mysql -uroot -p

Enter password: ##输入密码

MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT all privileges ON . TO 'zabbix'@'%' IDENTIFIED BY 'admin123';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

##测试

[root@cacti ~]# cd /var/www/html/

[root@cacti html]# vim index.php

<?php

phpinfo();

?>

##浏览器访问服务器:192.168.120.181

专属小白们的Zabbix部署详解

##测试完成后删除原来的测试语句

[root@cacti html]# vim index.php

<?php

$link=mysql_connect('192.168.120.181','zabbix','admin123');

if($link) echo "<h1>Success!!</h1>";

else echo "Fail!!";

mysql_close();

?>

##修改完成后,刷新网页

专属小白们的Zabbix部署详解

##网页是Success的可以跳过一下问题(如果是Faill,请按以下步骤操作)##

-------------解决本地无法登录问题(可忽略)---------------------------

[root@cacti html]# mysql -uzabbix -p

Enter password:

ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)

##出错##

##解决方案:

##进入root用户数据库

[root@cacti html]# mysql -uroot -p

MariaDB [(none)]> select user,host from mysql.user;

+--------+-----------+

| user | host |

+--------+-----------+

| zabbix | % |

| root | 127.0.0.1 |

| root | ::1 |

| | cacti |

| root | cacti |

| | localhost |

| root | localhost |

+--------+-----------+

##出现空用户,删除空用户

MariaDB [(none)]> drop user ''@localhost;

Query OK, 0 rows affected (0.02 sec)

MariaDB [(none)]> drop user ''@cacti;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> select user,host from mysql.user;

+--------+-----------+

| user | host |

+--------+-----------+

| zabbix | % |

| root | 127.0.0.1 |

| root | ::1 |

| root | cacti |

| root | localhost |

+--------+-----------+

##空用户已删除

[root@cacti html]# mysql -uzabbix -p

Enter password:

MariaDB [(none)]>

##登录成功

----------------以下开始部署zabbix Server-------

[root@cacti html]# yum install php-bcmath php-mbstring -y

##会自动生成yum源文件,保证系统可以上网

[root@cacti html]# rpm -ivh http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm

##安装

[root@cacti yum.repos.d]# yum install zabbix-server-mysql zabbix-web-mysql -y

##生成数据库文件,注意密码不要输成root的(是之前设置的admin123)

[root@cacti yum.repos.d]# zcat /usr/share/doc/zabbix-server-mysql-4.0.0/create.sql.gz | mysql -uzabbix -p zabbixEnter password:

[root@cacti yum.repos.d]# grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf

38:LogFile=/var/log/zabbix/zabbix_server.log

49:LogFileSize=0

72:PidFile=/var/run/zabbix/zabbix_server.pid

82:SocketDir=/var/run/zabbix

101:DBName=zabbix

117:DBUser=zabbix

357:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log

475:Timeout=4

518:AlertScriptsPath=/usr/lib/zabbix/alertscripts

529:ExternalScripts=/usr/lib/zabbix/externalscripts

565:LogSlowQueries=3000

[root@cacti yum.repos.d]# vim /etc/zabbix/zabbix_server.conf

DBPassword=admin123 ##125行

[root@cacti yum.repos.d]# vim /etc/httpd/conf.d/zabbix.conf

php_value date.timezone Asia/Shanghai ##20行(修改时区)

------------------修正图表中文乱码---------------------

[root@cacti yum.repos.d]# vim /usr/share/zabbix/include/defines.inc.php

##shift:输入

:%s /graphfont/kaiti/g

##挂载软件包

[root@cacti yum.repos.d]# mkdir /abc

[root@cacti yum.repos.d]# mount.cifs //192.168.100.10/rhel7 /abc

Password for root@//192.168.100.10/rhel7:

[root@cacti yum.repos.d]# cd /abc/zabbix/

[root@cacti zabbix]# ls

php-bcmath-5.4.16-42.el7.x86_64.rpm php-mbstring-5.4.16-42.el7.x86_64.rpm STKAITI.TTF

[root@cacti zabbix]# cp STKAITI.TTF /usr/share/zabbix/fonts/

##启动服务

[root@cacti zabbix]# systemctl start zabbix-server.service

[root@cacti zabbix]# systemctl enable zabbix-server.service

Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.

[root@cacti zabbix]# netstat -anpt | grep zabbix

tcp 0 0 0.0.0.0:10051 0.0.0.0:

LISTEN 46594/zabbix_server

LISTEN 46594/zabbix_server

[root@cacti zabbix]# systemctl restart httpd.service

http://192.168.120.181/zabbix/ //安装后登录 用户名Admin 密码:zabbix

专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解

设置中文环境

Administrator-Users-点击用户-语言中设置

专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解

======配置代理端-就是被控服务器----如果服务器也需要被自己监控也需要安装--zabbix-agent=====

[root@localhost ~]# systemctl stop firewalld.service

[root@localhost ~]# systemctl disable firewalld.service

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@localhost ~]# setenforce 0

##安装yum源

[root@localhost ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm

[root@localhost ~]# yum install -y zabbix-agent

[root@localhost ~]# vim /etc/zabbix/zabbix_agentd.conf

Server=192.168.120.181 ##98行(IP为之前的监控服务器)

ServerActive=192.168.120.181 ##139行

Hostname=abc ##150行(名字自定义)

##启动服务

[root@localhost ~]# systemctl start zabbix-agent.service

[root@localhost ~]# systemctl enable zabbix-agent.service

Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.

[root@localhost ~]# netstat -ntap | grep 10050

tcp 0 0 0.0.0.0:10050 0.0.0.0:

LISTEN 45402/zabbix_agentd

tcp6 0 0 :::10050 :::

LISTEN 45402/zabbix_agentd

到网页设置 http://192.168.120.181/zabbix/

专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解

选择监控http、ssh(具体监控什么,自己定义)

专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解 专属小白们的Zabbix部署详解

搭建Zabbix及如何设置监控就详解到这了。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Introduction to Computation and Programming Using Python

Introduction to Computation and Programming Using Python

John V. Guttag / The MIT Press / 2013-7 / USD 25.00

This book introduces students with little or no prior programming experience to the art of computational problem solving using Python and various Python libraries, including PyLab. It provides student......一起来看看 《Introduction to Computation and Programming Using Python》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码