zoukankan      html  css  js  c++  java
  • 大数据技术之Zabbix

     

    第1章 Zabbix入门

    1.1 Zabbix概述

    Zabbix是一款能够监控各种网络参数以及服务器健康性和完整性的软件。Zabbix使用灵活的通知机制,允许用户为几乎任何事件配置基于邮件的告警。这样可以快速反馈服务器的问题。基于已存储的数据,Zabbix提供了出色的报告和数据可视化功能。

    1.2 Zabbix 基础架构

     

    第2章 Zabbix部署

    2.1 集群规划

    节点

    服务

    hadoop102

    zabbix-server、zabbix-agent、MySQL、zabbix-web

    hadoop103

    zabbix-agent

    hadoop104

    zabbix-agent

    2.2 准备工作

    2.2.1 关闭防火墙(3台节点,已关闭)

    sudo service iptables stop

    sudo chkconfig iptables off

    2.2.2 关闭SELinux(hadoop102)

    1) 修改配置文件/etc/selinux/config

    sudo vim /etc/selinux/config

     

    # This file controls the state of SELinux on the system.

    # SELINUX= can take one of these three values:

    #     enforcing - SELinux security policy is enforced.

    #     permissive - SELinux prints warnings instead of enforcing.

    #     disabled - No SELinux policy is loaded.

    SELINUX=disabled

    # SELINUXTYPE= can take one of these two values:

    #     targeted - Targeted processes are protected,

    #     mls - Multi Level Security protection.

    SELINUXTYPE=targeted

    2)重启服务器

    sudo reboot

    2.3 配置Zabbix yum源(3台节点)

    2.3.1 安装yum源

    执行以下命令安装yum源

    sudo rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

    2.3.2 修改为阿里云镜像

    1)查看原始zabbix.repo文件

    sudo cat /etc/yum.repos.d/zabbix.repo

    内容如下

    [zabbix]

    name=Zabbix Official Repository - $basearch

    baseurl=http://repo.zabbix.com/zabbix/4.4/rhel/7/$basearch/

    enabled=1

    gpgcheck=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

     

    [zabbix-debuginfo]

    name=Zabbix Official Repository debuginfo - $basearch

    baseurl=http://repo.zabbix.com/zabbix/4.4/rhel/7/$basearch/debuginfo/

    enabled=0

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

    gpgcheck=1

     

    [zabbix-non-supported]

    name=Zabbix Official Repository non-supported - $basearch

    baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/

    enabled=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX

    gpgcheck=1

    2)执行以下命令完成全局替换

    sudo sed -i 's/http://repo.zabbix.com/https://mirrors.aliyun.com/zabbix/g' /etc/yum.repos.d/zabbix.repo

    3)查看修改之后的zabbix.repo文件

    sudo cat /etc/yum.repos.d/zabbix.repo

    内容如下

    [zabbix]

    name=Zabbix Official Repository - $basearch

    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/

    enabled=1

    gpgcheck=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

     

    [zabbix-debuginfo]

    name=Zabbix Official Repository debuginfo - $basearch

    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/debuginfo/

    enabled=0

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

    gpgcheck=1

     

    [zabbix-non-supported]

    name=Zabbix Official Repository non-supported - $basearch

    baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/

    enabled=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX

    gpgcheck=1

    2.4 安装Zabbix

    在三台节点分别执行以下安装命令

    [atguigu@hadoop102 ~]$ sudo yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

     

    [atguigu@hadoop103 ~]$ sudo yum install zabbix-agent

     

    [atguigu@hadoop104 ~]$ sudo yum install zabbix-agent

    2.5 配置Zabbix

    2.5.1 创建zabbix数据库

    [atguigu@hadoop102 ~]$ mysql -uroot -p123456 -e"create database zabbix character set utf8 collate utf8_bin"

    2.5.2 导入Zabbix建表语句

    [atguigu@hadoop102 ~]$ zcat /usr/share/doc/zabbix-server-mysql-4.4.8/create.sql.gz | mysql -uroot -p123456 zabbix

    2.5.3 配置Zabbix_Server(hadoop102

    修改zabbix-server配置文件

    sudo vim /usr/local/etc/zabbix_server.conf

     

    DBHost=hadoop102

    DBName=zabbix

    DBUser=root

    DBPassword=123456

    2.5.4 配置Zabbix_Agent(三台节点)

    修改zabbix-agent配置文件

    sudo vim /usr/local/etc/zabbix_agentd.conf

     

    Server=hadoop102

    #ServerActive=127.0.0.1

    #Hostname=Zabbix server

    2.5.5 配置Zabbix_Web时区

    修改/etc/httpd/conf.d/zabbix.conf文件

    sudo vim /etc/httpd/conf.d/zabbix.conf

     

     

    #

    # Zabbix monitoring system php web frontend

    #

     

    Alias /zabbix /usr/share/zabbix

     

    <Directory "/usr/share/zabbix">

        Options FollowSymLinks

        AllowOverride None

        Require all granted

     

        <IfModule mod_php5.c>

            php_value max_execution_time 300

            php_value memory_limit 128M

            php_value post_max_size 16M

            php_value upload_max_filesize 2M

            php_value max_input_time 300

            php_value max_input_vars 10000

            php_value always_populate_raw_post_data -1

            php_value date.timezone Asia/Shanghai

        </IfModule>

    </Directory>

    2.3.6 启动Zabbix

    [atguigu@hadoop102 ~]$ sudo systemctl start zabbix-server zabbix-agent httpd

    [atguigu@hadoop102 ~]$ sudo systemctl enable zabbix-server zabbix-agent httpd

     

    [atguigu@hadoop103 ~]$ sudo systemctl start zabbix-agent

    [atguigu@hadoop103 ~]$ sudo systemctl enable zabbix-agent

     

    [atguigu@hadoop104 ~]$ sudo systemctl start zabbix-agent

    [atguigu@hadoop104 ~]$ sudo systemctl enable zabbix-agent

    2.3.7 配置Zabbix_Web数据库

    1)浏览器访问http://hadoop102/zabbix

     

    2)检查配置

     

    3)配置数据库

     

    4)配置zabbix-server

     

    第4章 Zabbix使用

    4.1 Zabbix术语

    3.1.1 Host(主机)

    一台你想监控的网络设备,用IP或域名表示。

    3.2.1 Item(监控项)

    你想要接收的主机的特定数据,一个度量数据。

    3.2.2 Trigger(触发器)

    一个被用于定义问题阈值和“评估”监控项接收到的数据的逻辑表达式。

    3.2.3 Action(动作)

    一个对事件做出反应的预定义的操作,比如邮件通知。

    4.2 Zabbix实战

    4.2.1 创建Host

    1)点击Configuration/Hosts/Create host

     

    2)配置Host

     

    3)查看新增Host

     

    4.2.2 创建Item

    1)点击Items

     

    2)点击Create item

     

    3)配置Item

     

    4)查看创建的Item

     

    5)查看Item最新数据

     

    4.2.3 创建Trigger

    1)点击Conguration/Hosts/Triggers

     

    2)点击Create Trigger

     

    3)编辑Trigger

     

    4)测试Trigger

    关闭集群中的HDFS,会有如下效果

     

    4.2.4 创建Media type

    1)点击Administration/Media types/Email

     

    2)编辑Email

     

    3)测试Email

     

    4)Email绑定收件人

     

    4.2.4 创建Action

    1)点击Configuration/Actions/Create action

     

    2)编辑Action

     

     

     

     

    3)测试

    重新启动HDFS,再关闭HDFS时,即可收到邮件通知

  • 相关阅读:
    分布式ID方案
    架构、分布式、微服务
    hexo+GithubPages创建自己的blog
    网络管理基本命令
    jvm-内存模型和一些eclipse调优参数
    JVM-运行时数据区
    JVM-类加载机制
    互联网架构演变过程
    jdk 1.7 新增
    【王的技法0001】机器数、真值、原码、反码、补码总结
  • 原文地址:https://www.cnblogs.com/shan13936/p/13940106.html
Copyright © 2011-2022 走看看