1
Bazar / Re:Predám 2× ProLiant ML310e Gen8 v2
« kdy: 16. 08. 2022, 15:25:00 »AK máte niekto záujem, ale cena sa Vám javí ako prestrelená, navrhnite cenu.
Tato sekce Vám umožňuje zobrazit všechny příspěvky tohoto uživatele. Prosím uvědomte si, že můžete vidět příspěvky pouze z oblastí Vám přístupných.
Nazov servera | Pocet problemov |
Server1 | 2 |
Server2 | 3 |
Nazov servera | Popis problemu problemu | Vyskyt problemu |
Server1 | More than 100 items having missing data for more than 10 minutes | 2 |
Server2 | Zabbix agent on Server2is unreachable for 5 minutes | 3 |
ListenIP=94.127.11.11,10.0.104.15,2a22:432:0:6::2
Chceš udělat něco jako tohle:Kód: [Vybrat]final = list()
container = dict()
basic = dict()
tech = dict()
container['Basic info'] = basic
container['Technical info'] = tech
final.append(container)
#Human readable format of partition's and memory size
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(size_bytes, 1024)))
power = math.pow(1024, i)
size = round(size_bytes / power, 2)
return "{} {}".format(size, size_name[i])
#Collect all values of available partitions:
def disk_sizes():
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']] = (convert_size(var_disk_size))
#Collect RAM size:
def ram_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']] = (convert_size(var_memory_size))
#Query:
for hlist in zapi.host.get(output=["hostid","name","host"],limit="15"):
dict = (hlist)
disk_sizes()
ram_size()
data_json = json.dumps(dict, indent = 4, sort_keys = True)
print(data_json)
final_dict = {'Basic Info': {'HostID':(dict['hostid']),'Name':(dict['host']),'Visible Name':(dict['name'])},'Technical info':{'Total memory RAM':(dict['Total memory'])}}
data_json = json.dumps(dict, indent = 4, sort_keys = True)
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)
#!/usr/bin/env python3.6
#Import libraries
from pyzabbix import ZabbixAPI
import math
#Basic configuration
zapi = ZabbixAPI("https://ulr.zabbix.api.tld")
zapi.login("test123", "test123")
###Definition custom functions
#Human readable unit's
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(size_bytes, 1024)))
power = math.pow(1024, i)
size = round(size_bytes / power, 2)
return "{} {}".format(size, size_name[i])
############################################
#Query:
for hlist in zapi.host.get(output="extend"):
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'])
print(hlist['hostid'],hlist['host'],hlist['name'],itd['name'],(convert_size(var_disk_size)),sep=";")
apt-get autoremove