Download the PHP package makinacorpus/monitoring-bundle without Composer
On this page you can find all versions of the php package makinacorpus/monitoring-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download makinacorpus/monitoring-bundle
More information about makinacorpus/monitoring-bundle
Files in makinacorpus/monitoring-bundle
Package monitoring-bundle
Short Description Simple monitoring tooling and Symfony bundle
License GPL-2.0-or-later
Homepage http://github.com/makinacorpus/monitoring-bundle
Informations about the package monitoring-bundle
Simple monitoring tooling for Symfony
This API provides simple and easy to use interfaces for building supervision probes that you can run to check sanity of your application.
It provides a Symfony >= 4.4 compatible bundle for registering your custom probes into a Symfony application.
Features:
- Build probes that restitute an output similar to commonly used supervision tools, such as Nagios or Centreon.
- Build more advanced information collectors for building advanced status reports.
- Provide an easy to use probe and info collectors registry.
- Provide a few console commands to run probes or build status reports.
- When used via the Symfony bundle, provide easy probes registration and HTTP endpoints for querying probes: easy to use with supervision tools.
Installation
Install it using composer:
Symfony bundle
Installation
Then register the bundle in your app/bundles.php
:
Configuration
Optionnaly copy the src/Bridge/Symfony/Resources/config/packages/monitoring.yaml
file into your app config/packages/
folder.
Register HTTP status endpoint (recommended)
Status endpoint will always return plain text responses, Nagios parser compatible, which means that almost every open source supervision tool will understand those status reports.
A custom route loader will generate one route per probe. In order to register those
routes, add into your config/routes.yaml
the following code:
For those routes to respond, you need to generate an access token for users:
Follow the instructions on screen, it will display the new token and new probes URL: you can copy/paste the newly generated token into your environment variables:
Note that you can run the command as many times as you wish in order to be able to copy/paste probes URLs, the command will never modify your application configuration.
If your site is protected by a firewall, you may add the following into
config/packages/security.yaml
:
Register admin report screen (optional)
A basic HTML report controller and template is provided, you may add it
into your config/routes.yaml
configuration file:
Please note that it is not security checked, you must manually configure your firewall to protect it.
Building your own probes and reports
Build a simple probe
Implement the \MakinaCorpus\Monitoring\Probe
interface.
Build a simple report generator
Implement the \MakinaCorpus\Monitoring\InfoCollector
interface:
Combining both
Just implement both interfaces, they are compatible and won't conflict.
Notes about reports and tags
Each InfoCollector
implementation has a getTags(): iterable
method, each tag
is a tag name string. Beware that you probably want to group associated reports
altogether for building your UI.
Registering them into Symfony
For any probe or info collector class, register them into your container and add
the monitoring_plugin
tag:
Cron script
If you don't have a supervision tool to parse status endpoint, you can use a simple check command run by a cron to perform status check.
Configuring your cron
If you don't have any external software to read your probes, you can plug-in the default (very naive) version of monitoring daemon into your crontab:
Pluging reactions to errors
Per default, the check command won't do anything, you must manually write handlers for reacting upon broken probes.
Fetching nagios-compatible result using the command line
This will output a Nagios parser compatible text.