Skip to content

feat: health check suite — CPU, memory, interface errors, log alerts#16

Merged
kayodebristol merged 2 commits intomainfrom
copilot/add-health-check-suite
Mar 24, 2026
Merged

feat: health check suite — CPU, memory, interface errors, log alerts#16
kayodebristol merged 2 commits intomainfrom
copilot/add-health-check-suite

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 24, 2026

Adds composable, vendor-aware health checks (CPU, memory, interface error counters, log scanning) with JSON output for monitoring integration, runnable against a single host or an inventory group.

Bug fix

  • netops/parsers/nokia_sros.py: __all__ was placed between the function signature and its docstring, causing an IndentationError that broke the entire parsers module and all dependent tests.

New: netops/parsers/health.py

Pure-text parsers for health telemetry across two vendor families:

Parser Command Vendor
parse_cpu_cisco / parse_cpu_nokia show processes cpu / show system cpu Cisco / Nokia
parse_memory_cisco / parse_memory_nokia show processes memory / show system memory-pools Cisco / Nokia
parse_interface_errors_cisco / parse_interface_errors_nokia show interfaces / show port detail Cisco / Nokia
parse_logs_cisco / parse_logs_nokia show logging / show log 99 Cisco (sev 0–3) / Nokia (CRITICAL/MAJOR)

New: netops/check/health.py

Composable check functions wired into run_health_check(), which returns a structured result with per-check alert: bool and a rolled-up overall_alert. Supports both single-host and inventory-based execution.

# Inventory group with custom thresholds
python -m netops.check.health --inventory inv.yaml --group core --threshold cpu=80,mem=85

# JSON output for monitoring integration
python -m netops.check.health --host 10.0.0.1 --vendor cisco_ios --json

# Exit 1 on any alert (CI/alerting pipelines)
python -m netops.check.health --inventory inv.yaml --fail-on-alert

New: tests/test_health.py

105 unit tests covering all parsers, check helpers (via _MockConn), threshold parsing, and run_health_check() with monkeypatched DeviceConnection.

Original prompt

This section details on the original issue you should resolve

<issue_title>feat: health check suite — CPU, memory, interface errors, log alerts</issue_title>
<issue_description>Composable health checks that work across vendors.

  • CPU utilization check with threshold alerting
  • Memory utilization check
  • Interface error counter check (CRC, input/output errors, drops)
  • Log scanning for critical/major events
  • JSON output for monitoring integration
python -m netops.check.health --inventory inv.yaml --group core --threshold cpu=80,mem=85
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Add composable health check suite for monitoring feat: health check suite — CPU, memory, interface errors, log alerts Mar 24, 2026
Copilot AI requested a review from kayodebristol March 24, 2026 04:30
@kayodebristol kayodebristol marked this pull request as ready for review March 24, 2026 04:33
@kayodebristol kayodebristol merged commit d35fac9 into main Mar 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: health check suite — CPU, memory, interface errors, log alerts

2 participants