Last active
March 11, 2017 08:54
-
-
Save sky-joker/d1d69363df606f0b4f6eb86b8e44038e to your computer and use it in GitHub Desktop.
Zabbixにグループを追加
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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