Skip to content

evanlow/ahsoo_pyalert

Repository files navigation

PyAhsoo Alerter

A Python monitoring script that checks database records for missing check-ins and sends SMS alerts when issues are detected.

Features

  • Monitors database check-in records for staleness (> 300 seconds)
  • Sends SMS notifications via OneWaySMS gateway when problems are detected
  • Prevents duplicate notifications with status tracking
  • Configurable database and SMS settings via separate config files

Setup

  1. Install dependencies:

    pip install -r requirements.txt
  2. Configure database connection:

    • Copy .dbconfig_ahsoo.template to .dbconfig_ahsoo
    • Update with your database credentials:
      hostname,username,password,database_name
      
  3. Configure SMS settings:

    • Copy .smsconfig_ahsoo.template to .smsconfig_ahsoo
    • Update with your SMS gateway credentials:
      api_username,api_password,mobile_number1,sender_id,mobile_number2
      

Usage

Run the script manually:

python pyalerter.py

Or set up as a cron job to run every 6 minutes:

*/6 * * * * /path/to/python /path/to/pyalerter.py

How it Works

  1. Connects to MySQL database using credentials from .dbconfig_ahsoo
  2. Updates records older than 300 seconds to 'NOK' status
  3. Resets notification flags for 'OK' records
  4. Checks for 'NOK' records that haven't been notified
  5. Sends SMS alert if issues found
  6. Updates notification status to prevent duplicates

Security

  • Database and SMS credentials are stored in separate config files
  • Config files are excluded from version control via .gitignore
  • Template files provided for easy setup without exposing sensitive data

Requirements

  • Python 3.x
  • MySQL database
  • OneWaySMS account (or compatible SMS gateway)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages