Files
portfolio/professional-infra/zabbix-monitoring-incident-response/scripts/validate_assets.py
T
Mateusz Suski 35e6b139fc
ci / validate (push) Failing after 1m8s
Initial CV-aligned infrastructure portfolio
Rework portfolio around Linux operations, Zabbix monitoring, migration validation, and ELK/Grafana log observability.

Add AAP-style LVM resize workflow, Zabbix server/proxy/agent automation assets, Linux/AIX monitoring templates, and updated validation CI.
2026-05-04 17:37:24 +00:00

50 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""Validate Zabbix portfolio template and sample assets."""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def load_json(path: Path) -> dict:
with path.open(encoding="utf-8") as handle:
return json.load(handle)
def validate_template(path: Path) -> None:
data = load_json(path)
for field in ["template", "items", "triggers"]:
if field not in data:
raise ValueError(f"{path}: missing {field}")
if not data["items"]:
raise ValueError(f"{path}: template must define at least one item")
for item in data["items"]:
for field in ["key", "name", "type", "value_type"]:
if field not in item:
raise ValueError(f"{path}: item missing {field}")
def validate_sample(path: Path) -> None:
data = load_json(path)
for field in ["host", "proxy", "mode", "checks"]:
if field not in data:
raise ValueError(f"{path}: missing {field}")
if data["mode"] not in ["active", "passive"]:
raise ValueError(f"{path}: mode must be active or passive")
if not data["checks"]:
raise ValueError(f"{path}: checks cannot be empty")
def main() -> None:
for path in sorted((ROOT / "templates").glob("*.json")):
validate_template(path)
for path in sorted((ROOT / "samples").glob("*.json")):
validate_sample(path)
print("Zabbix template and sample assets are valid")
if __name__ == "__main__":
main()