@ Standa Blábol : Vdaka za pomoc a komentar. Niekedy jednoducho pomoze jedna/dve vety a hned sa cloveku lahsie rozmysla.
Teraz to vyzera ovela lepsie a este som tam pridal aj kolko ma server RAM:
dict = {}
for hlist in zapi.host.get(output="extend"):
dict = (hlist)
# print(dict)
for itd in zapi.item.get(output="extend",hostids=(hlist['hostid']),searchWildcardsEnabled="true",search={"name":"*Total disk space*" }):
for itdval in zapi.history.get(output="extend",hostids=(hlist['hostid']),itemids=(itd['itemid']),limit="1"):
var_disk_size = int(itdval['value'])
dict[itd['name']] = var_disk_size
for itm in zapi.item.get(output="extend",hostids=(hlist['hostid']),searchWildcardsEnabled="true",search={"name":"*Total memory*" }):
for mmval in zapi.history.get(output="extend",hostids=(hlist['hostid']),itemids=(itm['itemid']),limit="1"):
var_memory_size = int(mmval['value'])
dict[itm['name']] = var_memory_size
print(dict)
Vystup je krasny. Da sa s nim lepsie pracovat ako si spominal:
{'hostid': '10414', 'proxy_hostid': '10411', 'host': 'server1.domain.sk', 'status': '0', 'disable_until': '0', 'error': '', 'available': '0', 'errors_from': '0', 'lastaccess': '0', 'ipmi_authtype': '-1', 'ipmi_privilege': '2', 'ipmi_username': '', 'ipmi_password': '', 'ipmi_disable_until': '0', 'ipmi_available': '0', 'snmp_disable_until': '0', 'snmp_available': '0', 'maintenanceid': '0', 'maintenance_status': '0', 'maintenance_type': '0', 'maintenance_from': '0', 'ipmi_errors_from': '0', 'snmp_errors_from': '0', 'ipmi_error': '', 'snmp_error': '', 'jmx_disable_until': '0', 'jmx_available': '0', 'jmx_errors_from': '0', 'jmx_error': '', 'name': 'server1.domain.sk', 'flags': '0', 'templateid': '0', 'description': '', 'tls_connect': '1', 'tls_accept': '1', 'tls_issuer': '', 'tls_subject': '', 'tls_psk_identity': '', 'tls_psk': '', 'proxy_address': '', 'auto_compress': '1', 'Total disk space on C:': 598903615488, 'Total disk space on D:': 2399258275840, 'Total disk space on H:': 1000169533440, 'Total memory': 33790238720}
{'hostid': '10415', 'proxy_hostid': '10411', 'host': 'zabbix.domain.sk', 'status': '0', 'disable_until': '0', 'error': '', 'available': '1', 'errors_from': '0', 'lastaccess': '0', 'ipmi_authtype': '-1', 'ipmi_privilege': '2', 'ipmi_username': '', 'ipmi_password': '', 'ipmi_disable_until': '0', 'ipmi_available': '0', 'snmp_disable_until': '0', 'snmp_available': '0', 'maintenanceid': '0', 'maintenance_status': '0', 'maintenance_type': '0', 'maintenance_from': '0', 'ipmi_errors_from': '0', 'snmp_errors_from': '0', 'ipmi_error': '', 'snmp_error': '', 'jmx_disable_until': '0', 'jmx_available': '0', 'jmx_errors_from': '0', 'jmx_error': '', 'name': 'zabbix.domain.sk', 'flags': '0', 'templateid': '0', 'description': 'Test1', 'tls_connect': '1', 'tls_accept': '1', 'tls_issuer': '', 'tls_subject': '', 'tls_psk_identity': '', 'tls_psk': '', 'proxy_address': '', 'auto_compress': '1', 'Total disk space on /': 59743842304, 'Total disk space on /boot': 1023303680, 'Total disk space on /home': 56272654336, 'Total memory': 8033837056}