erlang-seed
Seed application template for erlang application with monitoring, prometheus and grafana.
usage
$ make help
# -----------------------------------------------------------------------------
# Targets:
#
# clean : rm -rf ./out
# help : show this message
# gen PROJECTNAME=proj APPNAME=foo : generate project in ./out/PROJECTNAME
#
# end.
# -----------------------------------------------------------------------------
quick start
$ make clean
$ make gen PROJECTNAME=energy APPNAME=harbour
scaffolding
This generates scaffolding like this:
out
├── energy
│ ├── Dockerfile
│ ├── harbour
│ ├── Makefile
│ ├── monitor
│ └── README.md
└── temp
└── monitor
containers
And spins up the containers:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6d3065e5088c localtag/harbour "/bin/bash -l -c './…" 28 minutes ago Up 28 minutes 0.0.0.0:4444->4444/tcp monitor_harbour_1
1a5f1e7b1c07 prom/prometheus:v2.10.0 "/bin/prometheus --c…" 30 minutes ago Up 30 minutes 0.0.0.0:9090->9090/tcp monitor_prometheus_1
3557eeecb09b grafana/grafana:6.2.4 "/run.sh" 30 minutes ago Up 30 minutes 0.0.0.0:3000->3000/tcp monitor_grafana_1
f5b4a63b5d78 prom/node-exporter:v0.18.1 "/bin/node_exporter …" 30 minutes ago Up 30 minutes 0.0.0.0:9100->9100/tcp monitor_node-exporter_1
metrics
Take a look at the app metrics being served by mprom:
$ curl http://localhost:4444/metrics
Then take a look at the prometheus server that is aggregating those metrics. It's easier to see this in a browser at:
http://localhost:9090/targets
Finally, take a look at the grafana charts at:
http://localhost:3000
Remember the grafana login is 'admin/admin'.
cluster
To shutdown the cluster:
$ cd proj/foo
$ make cstop
To restart the cluster:
$ cd proj/foo
$ make cstart
To tail the cluster logs:
$ cd proj/foo
$ make tail
resources
monitoring
- http://zwrob.com/posts/monitoring-01/
- http://zwrob.com/posts/monitoring-02/
- http://zwrob.com/posts/monitoring-03/
- http://zwrob.com/posts/monitoring-04/
- http://zwrob.com/posts/erlang-01/
- https://github.com/ToddG/monitor/releases/tag/v0.1.0
- https://github.com/toddg/mprom