Monitoring APIs
Monitor your worker status and performance using HTTP endpoints. All endpoints are available at http://localhost:8081
.
Available Endpoints
/health
- Basic health check/worker
- Worker status/stats
- Detailed statistics/debug
- Configuration info/
- Web dashboard
Quick Health Check
curl http://localhost:8081/health
Response:
OK
Worker Status
curl http://localhost:8081/worker
Response:
{
"agent_id": "MyAgent",
"active_jobs": 3,
"connected": true,
"worker_id": "worker-123",
"worker_load": 0.3
}
Detailed Statistics
curl http://localhost:8081/stats
Response:
{
"worker_load": 0.3,
"current_jobs": 3,
"max_processes": 10,
"agent_id": "MyAgent",
"backend_connected": true,
"resource_stats": {
"total_resources": 10,
"available_resources": 7,
"active_resources": 3
}
}
Web Dashboard
Open http://localhost:8081/
in your browser for a visual interface showing:
- Real-time worker status
- Resource utilization
- Active jobs
- Performance metrics
Integration Examples
- Python
- JavaScript
import requests
def check_worker_health():
response = requests.get("http://localhost:8081/health")
return response.status_code == 200
def get_worker_stats():
response = requests.get("http://localhost:8081/stats")
return response.json()
# Usage
if check_worker_health():
stats = get_worker_stats()
print(f"Active jobs: {stats['current_jobs']}")
async function checkWorkerHealth() {
const response = await fetch("http://localhost:8081/health");
return response.ok;
}
async function getWorkerStats() {
const response = await fetch("http://localhost:8081/stats");
return response.json();
}
// Usage
if (await checkWorkerHealth()) {
const stats = await getWorkerStats();
console.log(`Active jobs: ${stats.current_jobs}`);
}
Common Use Cases
- Health monitoring: Use
/health
for load balancer checks - Performance tracking: Use
/stats
for resource monitoring - Debugging: Use
/debug
to verify configuration - Visual monitoring: Use web dashboard for real-time overview
Got a Question? Ask us on discord