Skip to content

Latest commit

 

History

History
72 lines (48 loc) · 3.14 KB

File metadata and controls

72 lines (48 loc) · 3.14 KB

Python Examples

Python scripts for monitoring cron jobs with DeadManPing.

Quick Start

  1. Install dependencies: pip install requests
  2. Replace YOUR_MONITOR_ID in each script with your actual monitor ID from deadmanping.com
  3. Make script executable: chmod +x script.py
  4. Add to crontab: 0 3 * * * /usr/bin/python3 /path/to/script.py

Examples

Basic Monitoring

Error Detection

Silent Failures

Backup Monitoring

API Response Validation

Output Validation

Advanced

Best Practices

  1. Use try-finally - Ensure ping is sent even on exception
  2. Check results - Don't just trust exit codes, verify actual results
  3. Handle exceptions - Catch and report errors properly
  4. Use subprocess.run() - Better control over exit codes than os.system()
  5. Validate JSON - Always validate JSON responses before using

Dependencies

All examples require:

pip install requests

Documentation

See deadmanping.com for detailed documentation on each problem and solution.