An API binder to use Centreon metrics as a SimpleJson Grafana datasource.
Requires the installation of the SimpleJson Grafana plugin.
It relies on Transatel/lib-eloquent-centreon for accessing Centreon's dataabses and calling its internal REST API.
There is caching of the list of available metrics (i.e. services providing perf data).
To force the reconstruction of the cache, just send:
DELETE localhost:8000/grafana
Regex are supported when searching available series with the (POST /grafana/search
).
Copy the .env.example file into a new .env
file.
There are are the keys you might want to edit (if you changed default values).
After modifying them, one might want to do a php artisan config:clear
to ensure older cached values are purged.
Key | Description |
---|---|
CENTREON_INTERNAL_REST_API_URL | URL of Centreon internal REST API |
CENTREON_REST_API_USERNAME | Username for the internal REST API |
CENTREON_REST_API_PASSWORD | Password for the internal REST API |
Key | Description |
---|---|
DB_HOST_CENTREON_STORAGE | Domain Name or IP address to connect to the database |
DB_PORT_CENTREON_STORAGE | Port to connect to the database |
DB_DATABASE_CENTREON_STORAGE | Name of the schema |
DB_USERNAME_CENTREON_STORAGE | Username to connect to the database |
DB_PASSWORD_CENTREON_STORAGE | Password to connect to the database |
$ composer update
You can quick start.
$ php -S 0.0.0.0:8000 -t public
<VirtualHost *:8000>
ServerName grafana-simple-json-datasource-centreon
DocumentRoot "/opt/grafana-simple-json-datasource-centreon/public"
<Directory "/opt/grafana-simple-json-datasource-centreon/public/">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
GET localhost:8000/grafana
POST localhost:8000/grafana/search
Content-Type: application/json
{
"target": ""
}