# πŸ›°οΈ 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: ```json { "": { "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 ```bash pip install -r requirements.txt ``` Requirements: * `requests` ### 3. Edit your Discord webhook URL Open the script and set: ```python 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 GPL β€” free to modify and use. ---