快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

【Zabbix】zabbix远程安装部署-创新互联

利用的脚本有之前介绍的python脚本: 【python】用python脚本实现ansible的推送、下载、上传文件功能  

创新互联从2013年成立,是专业互联网技术服务公司,拥有项目成都做网站、成都网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元金牛做网站,已为上家服务,为金牛各地企业和个人服务,联系电话:13518219792
  1. # ! / bin / bash

  2. IP = $ 1
  3. exceptip_file = "/opt/python/set_host_proxy_exceptip.txt"
  4. # check zabbix_agent is started
  5. stat_z = ` python / opt / python / paramiko - upload . py - H $IP - c 'ps -ef|grep zabbix_agentd|grep -v sh|grep -v grep>/dev/null;echo $?' | g
  6. rep - v "#" | grep - v IP | grep - v Perform | grep - v Script`
  7. echo $stat_z
  8. #exit 0

  9. if [ $stat_z - ne 0 ] ; then
  10.     # 得到操作系统的版本
  11.     OS_VERSION = ` python / opt / python / paramiko - upload . py - H $IP - c "cat /etc/redhat-release" | awk - F 'release' '{print $2}' | awk '{pr
  12. int $1}' | awk - F\ . '{print $1}' `
  13.     echo $OS_VERSION
  14.     # 开始安装
  15.     #如果操作系统的版本是6
  16.      if [ "$OS_VERSION" - eq 6 ] ; then
  17.         echo "centos 6"
  18.         python / opt / python / paramiko - upload . py - H $IP - s '/opt/python/zabbix_agentd' '/opt' zabbix - 2 . 4 . 3_centos6 . tar . gz
  19.         python / opt / python / paramiko - upload . py - H $IP - s '/opt/python/zabbix_agentd' '/opt' install_zabbix_agent_centos6 . sh
  20.         python / opt / python / paramiko - upload . py - H $IP - c 'sh /opt/install_zabbix_agent_centos6.sh'
  21.      #如果操作系统的版本是7
  22.     elif [ "$OS_VERSION" - eq 7 ] ; then
  23.         echo "centos 7"
  24.         python / opt / python / paramiko - upload . py - H $IP - s '/opt/python/zabbix_agentd' '/opt' zabbix - 2 . 4 . 3_centos7 . tar . gz
  25.         python / opt / python / paramiko - upload . py - H $IP - s '/opt/python/zabbix_agentd' '/opt' install_zabbix_agent_centos7 . sh
  26.         python / opt / python / paramiko - upload . py - H $IP - c 'sh /opt/install_zabbix_agent_centos7.sh'
  27.      #如果操作系统的版本是5
  28.      elif [ "$OS_VERSION" - eq 5 ] ; then
  29.     echo "centos 5"
  30.     python / opt / python / paramiko - upload . py - H $IP - s '/opt/python/zabbix_agentd' '/opt' zabbix - 2 . 4 . 3_centos5 . tar . gz
  31.     python / opt / python / paramiko - upload . py - H $IP - s '/opt/python/zabbix_agentd' '/opt' install_zabbix_agent_centos5 . sh
  32.     python / opt / python / paramiko - upload . py - H $IP - c 'sh /opt/install_zabbix_agent_centos5.sh'
  33.     fi
  34.     #升级zabbix的配置
  35.     sh / opt / python / yuanchen_update_zabbix_agent . sh $IP
  36. else
  37.     # updata zabbix_agent config
  38.     sh / opt / python / yuanchen_update_zabbix_agent . sh $IP
  39. fi

当前名称:【Zabbix】zabbix远程安装部署-创新互联
文章来源:http://6mz.cn/article/cdcees.html

其他资讯