Skip to content

Instantly share code, notes, and snippets.

@sky-joker
Last active March 11, 2017 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sky-joker/d1d69363df606f0b4f6eb86b8e44038e to your computer and use it in GitHub Desktop.
Save sky-joker/d1d69363df606f0b4f6eb86b8e44038e to your computer and use it in GitHub Desktop.
Zabbixにグループを追加
#!/usr/bin/python3
from zabbix.api import ZabbixAPI
if __name__ == '__main__':
"""
Zabbixサーバにグループを追加するスクリプト例
追加するグループは `TESTグループ`
"""
# Zabbixサーバ情報
zabbix_url = 'http://ZabbixサーバIP/zabbix'
username = 'admin'
password = 'zabbix'
# グループ名
host_group = 'TESTグループ'
# Method設定
method = 'hostgroup.create'
# Query設定
zquery = {}
zquery = {'name':host_group}
# Zabbixサーバログイン
zapi = ZabbixAPI(url=zabbix_url, user=username, password=password)
# 実行
r = zapi.do_request(method, zquery)
print(r['result'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment