Git Product home page Git Product logo

switch_zabbix_proxy's Introduction

switch_zabbix_proxy

用于切换zabbix-proxy的脚本

脚本的实现思路:

  1. 通过传参获取故障proxy主机名称
  2. 根据故障proxy主机名称获取对应的备选proxy列表
  3. 获取备选proxy的nvps值,选取最小的来新的proxy
  4. 通过主机接口,筛选出关联在故障proxy上的主机
  5. 通过主机批量更新接口,更新相关主机的proxy到新的proxy上
  6. 通过命令更新zabbix-server的配置文件
  7. 通过脚本使新的proxy主动拉取zabbix-server上的配置文件

参考地址:

安装相关pip包

pip3 install pyzabbix

脚本安装路径:

/usr/lib/zabbix/externalscripts
# 权限信息
drwxr-xr-x 2 zabbix zabbix 4096 Dec  4 11:05 /usr/lib/zabbix/externalscripts/
-rw-rw-r-- 1 zabbix zabbix   49 Dec  4 11:05 2022-12-04_11-05-06-785002-host.txt
-rw-rw-r-- 1 zabbix zabbix 2664 Dec  4 11:05 switch_proxy.log
-rwxr-xr-x 1 zabbix zabbix 4977 Dec  4 10:11 switch_proxy.py*

效果图: 切换前 切换后 切换日志

switch_zabbix_proxy's People

Contributors

cplinux98 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.