PHPackages                             pierre-tranchard/cron-monitor-api-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. pierre-tranchard/cron-monitor-api-bundle

ActiveSymfony-bundle[Logging &amp; Monitoring](/categories/logging)

pierre-tranchard/cron-monitor-api-bundle
========================================

The server side for exposing an API to monitor your cron via the cron-monitor-bundle

10PHP

Since Nov 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pierre-tranchard/cron-monitor-api-bundle)[ Packagist](https://packagist.org/packages/pierre-tranchard/cron-monitor-api-bundle)[ RSS](/packages/pierre-tranchard-cron-monitor-api-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Cron Monitor API Bundle
=======================

[](#cron-monitor-api-bundle)

This package is the server side for the cron monitor system.

Install the bundle in your server app as you're used to do and declare the configuration like the following.

Configuration
-------------

[](#configuration)

```
parameters:
    mailer_default_sender: "no-reply@your-mta"

tranchard_cron_monitor_api:
    secret: '%cron-monitor-secret%'
    user_provider: YOUR-SERVICE-ID
    notification_system: YOUR-NOTIFICATION-SYSTEM-SERVICE-ID
    monitoring:
        Dummy-Project:
            environments:
                prod:
                    cron:
                        default:
                            checkers:
                                threshold:
                                    max_failed: 1
                                    duration_interval: 3600
                                duration:
                                    max_execution_duration: ~
                                    duration_interval: 3600
                                lock:
                                    use_cron_tokens: true
                                    duration_interval: 3600
                                critical:
                                    enabled: true
                staging:
                    cron:
                        default:
                            checkers:
                                threshold:
                                    max_failed: 1
                                    duration_interval: 7200
                                duration:
                                    max_execution_duration: ~
                                    duration_interval: 7200
                                lock:
                                    use_cron_tokens: true
                                    duration_interval: 900
                                critical:
                                    enabled: true
```

- As you may have noticed, the project name declared in the client must match the node name under the monitoring node.
- Foreach environment, you declare every single command you want to monitor and you specify a default setting as fallback.
- You also need to import some routes to make it works

```
tranchard_cron_monitor_api:
    resource: "@TranchardCronMonitorApiBundle/Resources/routing/public.yaml"
    prefix:   /api

tranchard_cron_monitor_internal:
    resource: "@TranchardCronMonitorApiBundle/Resources/routing/internal.yaml"
    prefix:   /internal
```

- The first route are public route, the other one should only be available through your private network. It's a route to get the status
- You must create a user provider that implements the `UserProviderInterface`, and your user entity class must implement `UserInterface`. These two interfaces are provided in the bundle.
- Finally, you need to declare a default sender email and provide a service that implements the `NotificationSystemInterface`. The bundle provides a mailer with the service id `Tranchard\CronMonitorApiBundle\Services\Notification\Mailer`
- Optional: the secret node is to secure the exchange between the client and the server. It's nullable.

Checkers
--------

[](#checkers)

4 checkers are provided by default, and each of them has its own configuration settings.

- DurationChecker is designed to be notified if the cron has taken more than a specified amount of time (+ eventually a % of tolerance), or you can choose to auto monitor the duration (using the cron tokens or not).

Here's the full configuration for this checker

```
duration:
    auto_monitor_duration: true|false # Enable the auto monitor duration
    use_cron_tokens: true|false # Refine or not the auto monitor duration based on the command tokens
    duration_tolerance: 0 # 0.10 for 10% for tolerance margin
    max_execution_duration: ~ # if null, the you must set the auto monitor duration to true
    duration_interval: 7200 # meantime between 2 notifications sent
```

- ThresholdChecker is designed to be notified if a cron has failed more than a defined time during a given interval.

Here's the full configuration for this checker

```
threshold:
    max_failed: 1 # 1 fail allowed
    duration_interval: 3600 # in 3600 seconds
```

- LockChecker is designed to be notified when a cron is locked.

Here's the full configuration for this checker

```
lock:
    use_cron_tokens: true|false # Refine or not the check based on the command tokens
    duration_interval: 900 # meantime between 2 notifications sent
```

- CriticalChecker is designed to be notified when a cron has a specific exit code. You'll be notified systematically, no matters you were notified 10 minutes before.

Here's the full configuration for this checker

```
critical:
    enabled: true|false # activate this check on this cron or not
```

Create your own checker
-----------------------

[](#create-your-own-checker)

- Create a service that implements `CheckerInterface` and extends `Checker` abstract class.
- Tag this service with the following tag `tranchard.cron_monitor_api.checkers`. You can set a priority too.
- Declare the new event in `CheckEvents` class
- Update the CheckSubscriber to subscribe to the new event
- If it needs a new status, declare it in the client bundle `CronReporter` model and in the `CronReporter` document in this bundle.
- Add the new status to the enumeration to make it valid during form validation
- Update the edit action of the `CronReporterController` to use your new event.
- Describe the new checker configuration into the bundle configuration

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/360b56a77426e282759aafb6f43ac6bfa48548719494c36ec750c5d21a760476?d=identicon)[pierre-tranchard](/maintainers/pierre-tranchard)

---

Top Contributors

[![pierre-tranchard](https://avatars.githubusercontent.com/u/1912299?v=4)](https://github.com/pierre-tranchard "pierre-tranchard (22 commits)")

---

Tags

apicronmongodbmonitoring

### Embed Badge

![Health badge](/badges/pierre-tranchard-cron-monitor-api-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/pierre-tranchard-cron-monitor-api-bundle/health.svg)](https://phpackages.com/packages/pierre-tranchard-cron-monitor-api-bundle)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
