Monitors the Andrews & Arnold (AAISP) status Atom feed and posts new incidents, updates, and closures to a Discord channel using a webhook.
Go to file
2025-11-20 15:37:58 +00:00
aastatus_to_webhook.py All feed entries processed instead of only the first. Sorted by published timestamp (oldest first) to maintain correct chronological order in Discord. PEW colour rules still apply (Open/Planned → 0x51D3D4). State saved per incident so only updates/new incidents are posted. One post per incident — the latest update for an incident is posted. 2025-11-20 15:37:58 +00:00
LICENSE Initial commit 2025-11-17 12:28:06 +00:00
README.md Updated README.md for mistake on license section 2025-11-17 12:36:08 +00:00
requirements.txt Added script, requirements and README.md 2025-11-17 12:31:52 +00:00

🛰️ AAISP Status Feed → Discord Webhook Notifier

Monitors the Andrews & Arnold (AAISP) status Atom feed and posts new incidents, updates, and closures to a Discord channel using a webhook.

This script:

  • ✔ Detects new incidents
  • ✔ Detects updates to existing incidents
  • ✔ Detects severity changes
  • ✔ Detects status changes (Open → Closed)
  • ✔ Tracks each incident separately
  • ✔ Sends color-coded Discord embeds

📌 Features

🔍 Intelligent Feed Monitoring

The script constantly fetches the official AAISP Atom feed:

https://aastatus.net/atom.cgi

It tracks each incident by ID and detects:

  • New incidents
  • Updated incidents
  • Edited content
  • Status changes
  • Severity changes
  • Updated timestamps

🎨 Color-Coded Notifications

The Discord embed color reflects the current status and severity

Status / Severity Colour Meaning
Closed 🟩 Green Issue resolved
Open 🔵 Blue Active incident
Minor 🟨 Yellow Low-impact issue
MSO 🔴 Red Major service outage
PEW 🟦 Cyan Planned engineering work
Default Grey Unknown/other

📦 Persistent State Tracking

Unlike simple "new entry only" scripts, this version uses:

/tmp/aaisp_atom_state.json

The state file stores:

{
  "<incident-id>": {
    "status": "...",
    "severity": "...",
    "updated": "...",
    "content": "..."
  }
}

This allows the script to detect:

  • “Open → Closed”
  • Severity changes (Minor → MSO)
  • New updates in the AAISP feed content
  • Edits made to existing entries

📣 Clean Discord Notifications

Each message includes:

  • Title with status/severity
  • Full link to the AAISP page
  • Markdown-formatted update content
  • Timestamps
  • Status, severity, and categories

Example:

[Closed] BT: Some BT lines dropped (Status changed Open → Closed)

🛠️ Installation

1. Clone or download the script

git clone https://git.ncltech.co.uk/phil/aastatus-to-discord
cd aastatus-to-discord

2. Install dependencies

pip install -r requirements.txt

Requirements:

  • requests

3. Edit your Discord webhook URL

Open the script and set:

WEBHOOK_URL = "https://discord.com/api/webhooks/XXXXXXX"

🚀 Running the Script

Manual run:

python3 aastatus_to_discord.py

Run automatically every 5 minutes (cron)

*/5 * * * * /usr/bin/python3 /path/to/aastatus_to_discord.py

State is preserved between runs because it stores incident data in:

/tmp/aaisp_atom_state.json

🔧 Configuration

If you want to override the state file path, edit:

STATE_FILE = Path("/tmp/aaisp_atom_state.json")

You can place it anywhere—e.g., /var/lib/aaisp/state.json.


🧪 Testing

You can simulate feed updates by:

  • Editing timestamps in the XML
  • Changing "Open" → "Closed"
  • Adding a dummy category/status element
  • Modifying content

The script will immediately detect the change and fire a Discord message.


🛡️ Error Handling & Logging

The script logs all operations:

  • Feed fetch attempts
  • Parsing failures
  • State changes
  • Discord webhook failures

Logs appear on stdout and are suitable for systemd or cron.


❤️ Contributing

Pull requests welcome!

Ideas to add:

  • Support for multiple Discord channels
  • HTML → Markdown improvements
  • Option to track all entries, not just the newest
  • A simple GUI or web dashboard

📜 License

See LICENSE file