zoukankan      html  css  js  c++  java
  • isntall

    #! /bin/bash
    
    # zabbix server address
    zabbix='10.10.238.110'
    # repo address
    REPO='10.10.238.114:4507'
    
    if [ -f /etc/yum.repos.d/sdata.repo ];then
        echo 'no operation'
    else
        # check os version
        osmaster=`cat /etc/redhat-release |awk -F '.' '{print $1}' |awk '{print $NF}'`
        if [ $osmaster -eq 5 ];then
            # get repo config
            curl http://$REPO/repo/sdata5.repo -o /etc/yum.repos.d/sdata.repo
            # sudo file config
            echo '#includedir /etc/sudoers.d' >> /etc/sudoers
        else
            # get repo config
            curl http://$REPO/repo/sdata.repo -o /etc/yum.repos.d/sdata.repo
        fi
        # install zabbix agent
        yum --disablerepo=* --enablerepo=sdata -y install zabbix-agent
        
        # check install status
        pkg=`rpm -qa zabbix-agent| wc -l`
        
        if [ $pkg -ge 1 ];then
            echo get zabbix config
            curl http://$REPO/repo/zabbix_config.tar.gz -o /tmp/zabbix_config.tar.gz
            # config
            tar xf /tmp/zabbix_config.tar.gz -C /
            # 
            sed -i 's/HOSTNAME/'`hostname`'/g' /etc/sdata/zabbix/zabbix_agentd.conf
            sed -i 's/SERVER/'$zabbix'/g' /etc/sdata/zabbix/zabbix_agentd.conf
            chown sdata: -R /etc/sdata
        
        
            if [ $osmaster -eq 7 ];then
                systemctl enable zabbix-agent
                systemctl start zabbix-agent
            else
                service zabbix-agent start
                chkconfig --add zabbix-agent
                chkconfig zabbix-agent on
            fi
           
            rm -f /tmp/zabbix_config.tar.gz
            rm -f /tmp/install.sh
        else
            echo 'zabbix-agent install failed'
        fi
    fi
    
    
  • 相关阅读:
    001 Python网络爬虫与信息提取 课程前序
    004 JQuery (010
    Vuex的元素对象
    003 JQuery (009
    002 JQuery (004
    001 JQuery (001
    Vuex简介
    axios实例与模块封装
    axios拦截器
    015 Javascript(152
  • 原文地址:https://www.cnblogs.com/cizao/p/11689440.html
Copyright © 2011-2022 走看看