Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cronjob Monitoring Script #215

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on May 11, 2024

  1. This script exposes the exit status of cronjobs.

    This script was born out of a desire to monitor and alert on cronjobs using
    Prometheus and Alertmanager.
    
    This script was inspired by https://janikvonrotz.ch/2020/09/07/monitor-cron-jobs-with-prometheus-grafana-and-node-exporter/
    
    As far as I'm aware there isn't another facility for exposing metrics related
    to this in Node Exporter.
    
    This script receives two arguments, the description of the cronjob as a string
    and the exit status of the previous command. It prints the metric to stdout.
    
    Usage:
    
    ```bash
    <command> ; cronjob "<description>" $?
    ```
    
    Example crontab entry:
    
    ```
    * * * * * echo "Hello world!"; cronjob "greeting" $? | sponge /var/lib/prometheus/node-exporter/cronjob_greeting.prom
    ```
    
    Example textfile:
    
    ```
    [vagrant@rocky8 ~]$ cat /var/lib/prometheus/node-exporter/cronjob_greeting.prom
    node_cronjob_status{user="vagrant", description="greeting"} 0
    ```
    
    Signed-off-by: Alex Kraker <[email protected]>
    Alex Kraker committed May 11, 2024
    Configuration menu
    Copy the full SHA
    6438025 View commit details
    Browse the repository at this point in the history

Commits on May 25, 2024

  1. Rename cronjob to cronjob_status

    Give this script a more descriptive name. This script will be seen in
    crontab files and this will be more descriptive of what the script is
    doing.
    
    Signed-off-by: Alex Kraker <[email protected]>
    Alex Kraker committed May 25, 2024
    Configuration menu
    Copy the full SHA
    77a77bb View commit details
    Browse the repository at this point in the history
  2. Update usage comments to reflect filename change

    Signed-off-by: Alex Kraker <[email protected]>
    Alex Kraker committed May 25, 2024
    Configuration menu
    Copy the full SHA
    2ca5217 View commit details
    Browse the repository at this point in the history