diff --git a/README.md b/README.md index 5a54608fcd776c4f104e49f9c2bf128328a0ac45..3e7cebbea33b27ecaa94df14f2fd2b363d68b7d7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,32 @@ # custom-metrics-generator -Pluggable cron-like prometheus textform metrics generator for node-exporter textfile collector. \ No newline at end of file +Pluggable cron-like prometheus textform metrics generator for node-exporter textfile collector. + +## Use-case + +Each node may need to export custom runtime metrics like: + * S.M.A.R.T. disk statistics + * puppet state + * container restarts + * node role + +Those metrics are generated by jobs (scripts) and text-file metrics representation is then fed to [Prometheus node-exporter](https://github.com/prometheus/node_exporter) which is able to periodically read text-file metrics using its [textfile collector](https://www.robustperception.io/using-the-textfile-collector-from-a-shell-script). + +This approach allows add export custom metrics to node-exporter. +Although every custom metrics may have its dedicated prometheus exporter, [Prometheus node-exporter textfile collector](https://www.robustperception.io/using-the-textfile-collector-from-a-shell-script) approach helps to reduce and maintain reasonable number of prometheus targets. + +### How to run custom-metrics-generator + +```sh +docker run -it --rm --privileged \ + -v /var/run/docker.sock:/var/run/docker.sock + -v /etc/node-exporter/node-role.prom:/etc/node-exporter/node-role.prom:ro + -v /opt/puppetlabs/puppet/cache/state/last_run_summary.yaml:/var/lib/puppet/state/last_run_summary.yaml:ro \ + -v /var/run/node-exporter:/opt/custom-metrics-generator/out-metric-dir \ + -e 'CMG_EXEC_MODULES=smartmon dockermon puppetmon noderolemon' \ + registry.gitlab.ics.muni.cz:443/cloud/custom-metrics-generator:latest +``` + +### Debugging + +TODO