From 2857ac042611545e7ceb6964f45df263246e6d53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franti=C5=A1ek=20=C5=98ezn=C3=AD=C4=8Dek?=
 <246254@mail.muni.cz>
Date: Wed, 30 Jun 2021 06:18:52 +0000
Subject: [PATCH] docs: added basic chapters

---
 README.md | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 5a54608..3e7cebb 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
-- 
GitLab