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
    
    
  • 相关阅读:
    SQL2008-显示表大小行数
    SQL2008-备份SQL数据库的语句
    SQL2008-截取字段函数
    SQL2008-字符转数字CAST和CONVERT
    SQL2008-查询库中是否存在某表
    SQLServer 2000个人版下载
    SQL2008-不同数据库之间的触发器
    SQL2008--行号的得到
    Microsoft Visual Stduio 2005 Ent安装报错解决方法
    zlib快速编译脚本
  • 原文地址:https://www.cnblogs.com/pansn/p/13612057.html
Copyright © 2011-2022 走看看