21 lines
463 B
Python
21 lines
463 B
Python
from PVEApi import PVEApi
|
|
import json
|
|
|
|
USERNAME = "zabbix@pve"
|
|
PASSWORD = "zabbix"
|
|
HOST = "172.16.3.11:8006"
|
|
NODE='h1'
|
|
|
|
conn = PVEApi(HOST, USERNAME, PASSWORD)
|
|
|
|
|
|
def get_vmnames(vmlist):
|
|
name_vmlist = [{"#VMNAME": vm.name} for vm in vmlist]
|
|
return name_vmlist
|
|
|
|
def listofdicts_to_zabbix_json(list):
|
|
# TODO wrap in "data:[]"
|
|
zabbixjson=json.dumps(list)
|
|
return zabbixjson
|
|
|
|
print listofdicts_to_zabbix_json(get_vmnames(conn.get_cluster_vmlist())) |