Skip to content
sourabh mane

project / 04Network monitoring · Automation

AI-Powered Network Health Monitor

Live ICMP latency collection, Isolation Forest anomaly detection, and an LLM-written engineering review.

View source updated
Year
2026
Stack
  • Python
  • pandas
  • scikit-learn
  • Matplotlib
  • Groq API

Overview

A three-stage Python pipeline. It pings the default gateway, public DNS resolvers and a live host to log latency and packet loss, runs an Isolation Forest per target to flag abnormal spikes without fixed thresholds, charts the results, and sends the summary to Llama 3.3 70B via Groq for a prioritised troubleshooting review.

Problem

Fixed latency thresholds are either too noisy or too quiet, and a chart on its own doesn't tell you what to do next.

Approach

Collect real ICMP data, let an unsupervised model decide what counts as abnormal for each target, and have an LLM turn the summary into a short, prioritised engineering review.

Pipeline

1_ping_collector.py
Pings each target at intervals and logs latency and packet loss to network_log.csv
2_analyze_anomalies.py
Isolation Forest per target, anomaly summary CSV and chart
3_senior_engineer_review.py
Sends the summary to Llama 3.3 70B via the Groq API for a written review

Implementation

  • Cross-platform subprocess handling for ping, with results logged to CSV.
  • pandas for time-series processing; scikit-learn's IsolationForest adds an anomaly flag per row, per target.
  • Matplotlib plots latency over time per target with anomalies highlighted.
  • Prompt designed so the model responds like a senior network engineer: referencing the actual numbers, flagging risks and listing action items.
  • The Groq API key is read from an environment variable; the repo ships a .env.example rather than a key.

Key features

  • Collects latency and packet loss from gateway, Google and Cloudflare DNS, and a live host
  • Unsupervised anomaly detection per target with Isolation Forest
  • Latency-over-time chart with anomalies highlighted
  • LLM review that references the data and lists prioritised actions