Monitor your Python scripts, Celery jobs, and notebooks with MoniTao.
Python is ubiquitous in data processing, machine learning, and system scripting. Your critical Python jobs deserve reliable monitoring.
Here's how to integrate MoniTao heartbeat with the most common Python HTTP libraries.
The most popular and simple method:
import requests\n\n# Your processing\nprocess_data()\n\n# Ping MoniTao\nrequests.post('https://monitao.com/api/heartbeat/ping/YOUR_TOKEN')
If you don't want external dependencies:
from urllib import request\n\nreq = request.Request(\n 'https://monitao.com/api/heartbeat/ping/YOUR_TOKEN',\n method='POST'\n)\nrequest.urlopen(req)
seo.heartbeat_python.decorator_intro
seo.heartbeat_python.decorator_example
Add the ping at the end of your task, or use Celery's task_success signal to automatically trigger the ping after each successful task.
No, that's the intended behavior! Place the ping at the very end of the script. If the script crashes before, no ping = MoniTao alerts.
Measure time with time.time() and send it as a parameter: requests.post(url, json={"duration": elapsed_seconds})
Recommended: try/except with timeout. If MoniTao is unreachable, log the error but don't block your script.
Start free, no credit card required.