Django ऐप्स के लिए स्टेटस पेज और अपटाइम मॉनिटरिंग
Django views, database, Celery workers, और cache मॉनिटर करें। Latency बढ़ने या workers के रुकने पर alerts। Hosted स्टेटस पेज या API के माध्यम से headless।
Django के लिए स्टेटस पेज लॉन्च करने के तीन तरीके
नियंत्रण का स्तर चुनें — zero-code, low-code, या पूर्ण headless।
Hosted
अपना Django endpoint जोड़ें, CNAME को status.yourdomain.com पर point करें, हो गया। 5 मिनट में।
Headless
Public API का उपयोग करके अपनी Django ऐप के अंदर अपनी UI बनाएं। डिज़ाइन और ब्रांडिंग पर पूरा नियंत्रण।
API देखेंएम्बेडेड badges
अपने README या landing page में SVG uptime और status badges डालें। हर 5 मिनट में auto-update।
इस health endpoint को अपनी Django ऐप में जोड़ें
Copy, paste, PulseAPI को URL पर point करें। स्वस्थ पर 200, degraded पर 503 return करता है।
from django.db import connection
from django.http import JsonResponse
from django.core.cache import cache
from django.views.decorators.http import require_GET
@require_GET
def health(request):
checks = {}
try:
with connection.cursor() as cur:
cur.execute("SELECT 1")
checks["database"] = "ok"
except Exception:
checks["database"] = "fail"
try:
cache.set("health-probe", "1", 5)
checks["cache"] = "ok" if cache.get("health-probe") == "1" else "fail"
except Exception:
checks["cache"] = "fail"
healthy = all(v == "ok" for v in checks.values())
return JsonResponse(
{"status": "healthy" if healthy else "degraded", **checks},
status=200 if healthy else 503,
)urls.py में view को /health/ से जोड़ें। Authentication middleware से exclude करें। PulseAPI JSON response parse करता है और assert कर सकता है कि specific fields "ok" हैं।
Django ऐप्स में क्या टूटता है — और कैसे पकड़ें
आधी-अधूरी migrations
Deploy पर विफल migration ऐप को अजीब state में छोड़ देती है। Live /health endpoint check यह तुरंत पकड़ लेता है।
चुप हो चुके Celery workers
Workers बिना crash के consume करना बंद कर सकते हैं। एक health endpoint बनाएं जो no-op task queue करे — PulseAPI respond न करने पर alert करता है।
Connection pool खत्म होना
लंबी queries pool को खाली कर देती हैं और नए requests timeout देते हैं। Response-time assertions यूज़र्स को पता चलने से पहले ये दिखाते हैं।
हमारा स्टेटस पेज पसंद नहीं? Django में अपना बनाएं।
हमारी API वही data लौटाती है जो हमारी hosted UI उपयोग करती है। पूर्ण OpenAPI spec यहां api.pulseapi.tech/docs.
import requests
from django.shortcuts import render
def status_view(request):
data = requests.get(
"https://api.pulseapi.tech/status/acme", timeout=5,
).json()
return render(request, "status.html", {"data": data})Django मॉनिटरिंग — FAQ
क्या यह Django REST framework, Django Channels, या plain Django के साथ काम करता है?
सबके साथ। PulseAPI दिए गए URL को call करके response पर assert करता है। Internal stack मायने नहीं रखता।
Celery workers कैसे मॉनिटर करूं?
.delay() से trivial task dispatch करने वाला health endpoint बनाएं और short timeout से result पढ़ें। Task complete न हो तो 503 return करें।
क्या staging के साथ use कर सकता हूं?
हां। हर environment के लिए एक endpoint बनाकर tag करें। Public status page से staging endpoints छिपा सकते हैं, alerts बने रहेंगे।
क्या Django के अंदर स्टेटस पेज self-host कर सकता हूं?
हां — headless API वही data देती है जो hosted page use करता है। View में fetch करें, template को pass करें, हो गया।
अपनी Django ऐप की मॉनिटरिंग 5 मिनट में शुरू करें
मुफ्त tier, कोई credit card नहीं। अपना endpoint जोड़ें और टूटने पर alerts पाएं।