Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/debugloop/moodledb_exporter
Minimal Prometheus Metrics for Moodle Databases
https://github.com/debugloop/moodledb_exporter
Last synced: about 1 month ago
JSON representation
Minimal Prometheus Metrics for Moodle Databases
- Host: GitHub
- URL: https://github.com/debugloop/moodledb_exporter
- Owner: debugloop
- Created: 2020-04-22T10:47:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-11T12:38:15.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T09:23:33.783Z (6 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a very simple exporter that connects to a local MySQL database on
scrape. It then looks for all databases matching the prefix filter which are
supposed to contain the typical Moodle tables. From these, a count of
non-deleted users is exported for each database.It is very simple, but it works well enough. It could also serve as a basis for
other SQL query based exporters, if necessary.| Option | Explanation |
|----------|-------------|
| `web.listen-address` | same as every other exporter out there, default is port `9720` |
| `web.telemetry-path` | same as every other exporter out there, default is `/metrics` |
| `mysql.prefix` | the prefix used to filter databases, as not every database contains a Moodle. We use a `db_` prefix to our `db_customername` scheme, so thats the default |Further, you'll have to set `DATA_SOURCE_NAME` to some [MySQL DSN
spec](https://github.com/go-sql-driver/mysql#dsn-data-source-name). You'll
likely use something like this invocation (SystemD Unit Sytnax) in the end:```
Environment="DATA_SOURCE_NAME=exporter:S0meS3curePass@(localhost:3306)/"
ExecStart=/opt/moodledb_exporter/moodledb_exporter --mysql.prefix="customer_"
```The output/the metrics will look like:
```
# HELP moodle_users_total Number of users found in a MoodleDB
# TYPE moodle_users_total gauge
moodle_users_total{dbname="customer_1"} 191
moodle_users_total{dbname="customer_2"} 10
...
```Along with the usual `promhttp` stuff.