Cron Execution History

Analyze performance and reliability of your crons over time

Execution history is the memory of your crons. Each execution is recorded with its timestamp, duration, and final status. This data forms a valuable timeline that allows analyzing performance, identifying trends, and anticipating problems before they impact production.

Without history, you navigate blindly. How do you know if a cron is taking longer and longer? How do you prove your SLAs are being met? How do you identify the correlation between a deployment and a series of failures? History answers all these questions with objective data.

MoniTao automatically collects the history of each heartbeat. Every received ping is timestamped and stored, creating a visual timeline of your executions. Aggregated metrics (success rate, average duration, trends) are calculated in real-time to facilitate analysis.

Key Metrics to Track

These indicators give you a complete view of your crons' health:

Benefits of History

Execution history offers concrete advantages for operational management:

MoniTao History Features

MoniTao provides comprehensive tools to leverage your cron history:

Enriching Pings Example

Add contextual data to your pings for richer history:

#!/bin/bash
# Script with enriched data for history

START_TIME=$(date +%s)

# Your business logic
/usr/bin/php /var/www/app/process.php
EXIT_CODE=$?
RECORDS_PROCESSED=$(cat /tmp/last_run_count)

END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME))

# Ping with enriched metrics
curl -fsS "https://api.monitao.com/ping/your-token" \
    -d "{
        \"status\": \"$([ $EXIT_CODE -eq 0 ] && echo success || echo failed)\",
        \"duration\": $DURATION,
        \"records\": $RECORDS_PROCESSED,
        \"exit_code\": $EXIT_CODE
    }" \
    -H "Content-Type: application/json"

This script measures execution duration and counts processed records. These metrics enrich MoniTao history, allowing correlation between performance and data volume. You can add any metric relevant to your context.

Useful Analyses to Perform

History enables many analyses to improve your crons:

History Management Checklist

  • Define retention period according to needs
  • Identify key metrics for each cron
  • Schedule monthly trend review
  • Configure trend-based alerts
  • Export regularly for long-term archiving
  • Document analyses and decisions made

Frequently Asked Questions

How long does MoniTao retain execution history?

Retention depends on your plan: Free keeps 7 days, Pro 30 days, Business 90 days. For longer history, regularly export your data via API or CSV and archive in your own system.

How do I detect a cron that's progressively slowing over time?

Compare the average duration of the last 7 days with the previous month. An increase over 20% deserves investigation. MoniTao also displays a trend graph that visualizes this evolution.

Can I export history to my existing monitoring system?

Yes, via MoniTao's REST API or CSV export from the dashboard. Data is compatible with Grafana, Datadog, New Relic, and any system accepting JSON or CSV.

My cron failed yesterday at 3am. How do I diagnose?

MoniTao history shows the exact failure time and status. For technical details (stack trace, error message), check your application logs. Correlated with history, you have a complete view.

How do I use history to optimize my crons?

Identify crons with max duration >> average duration (indicating outliers). Analyze these peaks: do they coincide with other heavy processes? Increased data volume? These insights guide optimization.

History shows gaps. What do they mean?

A gap in history means the cron didn't execute (or didn't ping). This is exactly what heartbeat monitoring detects. Check the cause: server down, modified crontab, script crashed before ping.

History as a Strategic Tool

Execution history transforms raw data into actionable insights. It enables moving from reactive management (waiting for incidents) to proactive management (anticipating problems). Teams that leverage their history detect degradations before they impact users.

With MoniTao, history is collected automatically with each ping. Start by exploring the history of your existing crons, identify patterns and anomalies, then establish baselines. These references will allow you to immediately detect any significant deviation.

Ready to Sleep Soundly?

Start free, no credit card required.