SURFscz / SRAM-deploy

Deploy scripts for the SCZ
Apache License 2.0
5 stars 5 forks source link

Backup van Zabbix templates #344

Closed baszoetekouw closed 2 years ago

baszoetekouw commented 2 years ago
#!/usr/bin/env python3

from pyzabbix import ZabbixAPI
from pprint import pprint
from sys import exit

zapi = ZabbixAPI(server="https://zabbix.sram.surf.nl/")
zapi.login(user="backup", password="s3cr1t")

# first fetch list of all templates
result = zapi.do_request('template.get', { "output": ["templateid","name" ] } )

# then dump the templates to stdout
template_ids = [t['templateid'] for t in result['result']]
result= zapi.do_request('configuration.export', {
    "options": {"templates": template_ids},
    "format": "yaml"
})
print(result["result"])

exit(0)
mrvanes commented 2 years ago

Community.zabbix development: https://github.com/ansible-collections/community.zabbix

mrvanes commented 2 years ago

https://github.com/SURFscz/SRAM-deploy/pull/355

baszoetekouw commented 2 years ago

nog wel uitrollen naar bhr2