Created
November 14, 2016 09:32
-
-
Save asraful/56b2f3aa1eeb0929b2e0241dde357e37 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def logIN(): | |
from zabbix_client import ZabbixServerProxy | |
request = ZabbixServerProxy('http://192.168.70.172/zabbix') | |
request.user.login(user='admin', password='zabbix') | |
data = request.host.get(output=['hostid', 'host']) | |
request.user.logout() | |
return data; | |
def writer(output_data): | |
import json | |
try: | |
with open('data.txt', 'w') as outfile: | |
json.dump(output_data, outfile) | |
except IOError: | |
print ("Error: can\'t write data") | |
else: | |
print ("Written content in the file successfully") | |
def execute(): | |
data = logIN() | |
writer(data) | |
execute() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment