Juju Charm/Operator for Prometheus on Kubernetes
Click on each badge for more details.
git submodule update --init --recursive sudo snap install juju --classic sudo snap install microk8s --classic sudo microk8s.enable dns dashboard registry storage sudo usermod -a -G microk8s $(whoami)
Log out then log back in so that the new group membership is applied to your shell session.
juju bootstrap microk8s mk8s
Optional: Grab coffee/beer/tea or do a 5k run. Once the above is done, do:
juju create-storage-pool operator-storage kubernetes storage-class=microk8s-hostpath juju add-model lma juju deploy . --resource prometheus-image=prom/prometheus:latest
juju status shows that the prometheus app has a status of active.
Preview the Prometheus GUI
kubectl -n prometheus port-forward svc/prometheus 9090:9090
The above assumes you're using the default value for
you customized this value from 9090 to some other value, change the command
Now browse to http://localhost:9090/
The default prometheus.yml includes a configuration that scrapes metrics from Prometheus itself. Execute the following query to show TSDB stats:
For more info on getting started with Prometheus see its official getting started guide.
Use Prometheus as a Grafana Datasource
Refer to the Grafana Operator Quick Start guide to learn how to use Prometheus with Grafana.
Running the Unit Tests on Your Workstation
To run the test using the default interpreter as configured in
If you want to specify an interpreter that's present in your workstation, you may run it with:
tox -e py37
To view the coverage report that gets generated after running the tests above, run:
The above command should output the port on your workstation where the server is
listening on. If you are running the above command on Multipass,
first get the Ubuntu VM's IP via
multipass list and then browse to that IP and
the abovementioned port.
NOTE: You can leave that static server running in one session while you continue
tox on another session. That server will pick up any new changes to
the report automatically so you don't have to restart it each time.
Relying on More Comprehensive Unit Tests
To ensure that this charm is tested on the widest number of platforms possible, we make use of Travis CI which also automatically reports the coverage report to a publicly available Coveralls.io page. To get a view of what the state of each relevant branch is, click on the appropriate badges found at the top of this README.
Much of how this charm is architected is guided by the following classic references. It will do well for future contributors to read and take them to heart: