zoukankan      html  css  js  c++  java
  • zabbix服务的布置(脚本)

    一,服务端配置

    #!/bin/bash
    #clsn

    #设置解析 注意:网络条件较好时,可以不用自建yum源
    # echo '10.0.0.1 mirrors.aliyuncs.com mirrors.aliyun.com repo.zabbix.com' >> /etc/hosts
    # 参考 https://www.cnblogs.com/clsn/p/7885990.html#auto_id_16
    #安装zabbix源、aliyun YUM源
    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    # rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
    rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

    #安装zabbix
    yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y

    #安装启动 mariadb数据库
    yum install -y  mariadb-server
    systemctl start mariadb.service
    systemctl enable mariadb.service

    #创建数据库
    mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
    mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'

    #导入数据
    zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix

    #配置zabbixserver连接mysql
    sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf

    #添加时区
    sed -i.ori '18a php_value date.timezone  Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf

    #解决中文乱码
    yum -y install wqy-microhei-fonts
    cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf

    #启动服务
    systemctl restart zabbix-server zabbix-agent httpd
    systemctl enable zabbix-server zabbix-agent httpd

    #输出信息
    echo "浏览器访问 http://`hostname -I|awk '{print $1}'`/zabbix"

    二,客户端配置

    #!/bin/bash
    #clsn

    #设置解析
    #安装zabbix源、aliyu nYUM源
    rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

    #安装zabbix客户端
    yum install zabbix-agent -y
    sed -i.ori 's#Server=127.0.0.1#Server=192.168.100.210#' /etc/zabbix/zabbix_agentd.conf
    systemctl start  zabbix-agent.service

    #写入开机自启动
    systemctl start zabbix-agent.service
    systemctl enable zabbix-agent.service

  • 相关阅读:
    SQL server 2008 建立新用户
    2021.3.22-刷题 (移位)
    2021.3.17刷题-分割回文串
    2021.3.16 刷题--组合总和||(一种组合下元素不可重复选取)
    2021.3.15刷题-组合总和(元素可重复选取)
    2021.3.14刷题-设计哈希映射
    2021.3.13刷题-用拉链法设计哈希集合
    2021.3.12刷题-验证二叉树的前序序列化
    2021.3.11刷题-(删除二叉搜索树中的节点)
    2021.2.28刷题 回溯-电话字母组合
  • 原文地址:https://www.cnblogs.com/lixaingyang/p/12133960.html
Copyright © 2011-2022 走看看