zoukankan      html  css  js  c++  java
  • 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
    
    
  • 相关阅读:
    CF 441E Valera and Number
    CodeForces 1111E. Tree
    CodeForces 1098F. Ж-function
    CodeForces 1098E. Fedya the Potter
    CodeForces 1098D. Eels
    CodeForces 1103E. Radix sum
    CodeForces 1103D. Professional layer
    CodeForces 1103C. Johnny Solving
    CodeForces 1107F. Vasya and Endless Credits
    Hackerrank: Week of Code 36
  • 原文地址:https://www.cnblogs.com/pansn/p/13612057.html
Copyright © 2011-2022 走看看