• zabbix-agent安装脚本


    ##!/bin/bash
    # file:ssh.sh 
    # author: pansn 
    # date:2020-07-17 15:02 
    # version 1.0  
    # description: Shell script 
    # @Copyright (c)  all right reserved 
    
    #IP=`ifconfig | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[04][0-9]|[01]?[0-9][0-9]?)"|grep -E '^10.|^172.|^192.'|head -n1`
    
    wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+xenial_all.deb
    
    dpkg -i zabbix-release_5.0-1+xenial_all.deb
    
    apt update
    
    echo "安装zabbix-agent"
    
    apt install zabbix-agent  -y
    #rm -rf zabbix-agent-4.2.6-1.el7.x86_64.rpm
    
    
    echo‘备份agent.conf配置文件‘ 
    cp  /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.bak
    
    echo '修改配置文件'
    sed -i 's/Server=127.0.0.1/Server=zbx.xxx.cn/' /etc/zabbix/zabbix_agentd.conf
    sed -i "s/Hostname=Zabbix server/Hostname=`hostname`/" /etc/zabbix/zabbix_agentd.conf
    sed -i 's/^ServerActive=127.0.0.1/ServerActive=zbx.xxx.cn/' /etc/zabbix/zabbix_agentd.conf
    sed -i 's/# HostMetadata=/HostMetadata=linux zabbix.oneplus/' /etc/zabbix/zabbix_agentd.conf
    
    systemctl start zabbix-agent && systemctl enable zabbix-agent
    
    #检测是否存在agent端口
    port=$(netstat -nlp|grep 10050|wc -l)
    if [ ${port} -ne 0 ];then
         echo "zabbix-agent安装成功"
       else
          echo "zabbix安装失败请检查"
    fi
    
    rm -rf zabbix-release_5.0-1+xenial_all.deb
    
    
  • 相关阅读:
    BZOJ3196: Tyvj 1730 二逼平衡树
    (转载)你真的会二分查找吗?
    Codeforces Round #259 (Div. 2)
    BZOJ1452: [JSOI2009]Count
    BZOJ2733: [HNOI2012]永无乡
    BZOJ1103: [POI2007]大都市meg
    BZOJ2761: [JLOI2011]不重复数字
    BZOJ1305: [CQOI2009]dance跳舞
    挖坑#4-----倍增
    BZOJ1042: [HAOI2008]硬币购物
  • 原文地址:https://www.cnblogs.com/pansn/p/13612057.html
Copyright © 2020-2023  润新知