Compare commits
3 Commits
3668563736
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
868b78f476 | ||
| 066033a4d6 | |||
| e4726a478e |
@@ -1,7 +1,7 @@
|
||||
# Contributor: Maksym Buz <maksym.buz@zabbix.com>
|
||||
# Maintainer: Maksym Buz <maksym.buz@zabbix.com>
|
||||
pkgname=zabbix
|
||||
pkgver=7.4.3
|
||||
pkgver=7.4.4
|
||||
pkgrel=0
|
||||
pkgdesc="Enterprise-class open source distributed monitoring solution"
|
||||
url="https://www.zabbix.com/"
|
||||
|
||||
@@ -37,37 +37,22 @@ def create_hosts():
|
||||
host_name = f"dummy-host-{i:04d}"
|
||||
host = {
|
||||
"host": host_name,
|
||||
"interfaces": [{
|
||||
"type": 1, # Zabbix agent
|
||||
"main": 1,
|
||||
"useip": 1,
|
||||
"ip": "127.0.0.1",
|
||||
"dns": "",
|
||||
"port": "10050"
|
||||
}],
|
||||
"groups": [{"groupid": GROUP_ID}],
|
||||
"templates": [{"templateid": "10048"}], # assign template ID 10048
|
||||
"templates": [{"templateid": "10048"}], # assign Proxy Health template
|
||||
"monitored_by": 2, # 2 = proxy group
|
||||
"proxy_groupid": PROXY_GROUP_ID, # your proxy group ID
|
||||
"items": [{
|
||||
"name": "Dummy metric",
|
||||
"key_": "dummy.value",
|
||||
"type": 2, # trapper
|
||||
"value_type": 0, # numeric float
|
||||
"delay": "60s"
|
||||
}]
|
||||
"proxy_groupid": PROXY_GROUP_ID # your proxy group ID
|
||||
}
|
||||
hosts.append(host)
|
||||
|
||||
for i in range(0, len(hosts), BATCH_SIZE):
|
||||
batch = hosts[i:i + BATCH_SIZE]
|
||||
print(f"Creating hosts {i+1}–{i+len(batch)}...")
|
||||
print(f"Creating hosts {i+1}-{i+len(batch)}...")
|
||||
try:
|
||||
resp = zbx_request("host.create", batch)
|
||||
created = len(resp.get("result", {}).get("hostids", []))
|
||||
print(f"✅ Created {created} hosts.")
|
||||
print(f"Created {created} hosts.")
|
||||
except Exception as e:
|
||||
print(f"❌ Error in batch {i+1}–{i+len(batch)}: {e}")
|
||||
print(f"Error in batch {i+1}-{i+len(batch)}: {e}")
|
||||
time.sleep(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user