使用说明:
1,该服务部署在zabbix server主机上,或者其他可以正常访问zbabix server的主机上,服务需要调用zabbix server的API;
2,代码基于flask,可以监听在指定的端口上等待调用接口,建议通过supervisor进行管理;
3,接口说明:
curl -L http://192.168.12.175:10052/regist/<hostCreate>/<visiblename>
参数:
(1)hostCreate:Zabbix server端添加新host的界面,输入的Host name值,该值必须与zabbix_agentd.conf文件中配置的Hostname一致;
(2)visiblename:Zabbix server端添加新host的界面,输入的Visible name值;
(3)传递的上述两个参数的值如果已经存在于zabbix server端,则会因为重复而无法成功添加主机;
#-*- coding: utf-8 -*-
from flask import Flask, request,json
import requests,time
zabbixurl = "http://127.0.0.1/api_jsonrpc.php"
config = {
"jso