Install Prometheus using a Helm chart with the customized values.yaml. There are four components that will be installed with this chart: Prometheus server, Alertmanager, node-exporter, and kube-state-metrics.
Create a new namespace monitoring
.
kubectl create ns monitoring
Deploy the PV and PVC YAML files.
kubectl apply -f prometheus/persistence.yaml
kubectl apply -f prometheus/alert-persistence.yaml
Install the Prometheus chart. In this sample we will use version 17.0.0.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts --force-update
helm install prometheus prometheus-community/prometheus --namespace monitoring --values prometheus/values.yaml --version 17.0.0 --wait
Note that in the customized values.yaml
file, we added a new job wls-domain1 to scrape data from the WebLogic domain created in the previous step.
Wait until all the Prometheus pods are running and ready.
kubectl -n monitoring get pod -l app=prometheus
output
NAME READY STATUS RESTARTS AGE
prometheus-alertmanager-7456cdb5b8-9vfmd 2/2 Running 0 1h
prometheus-kube-state-metrics-dbfff5557-f22xx 1/1 Running 0 1h
prometheus-node-exporter-6n7rj 1/1 Running 0 1h
prometheus-server-5789fffc86-mmh8f 2/2 Running 0 1h
Check the Prometheus sevices.
kubectl -n monitoring get svc -l app=prometheus
output
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
prometheus-alertmanager NodePort 10.108.31.234 <none> 80:32000/TCP 1h
prometheus-kube-state-metrics ClusterIP None <none> 80/TCP 1h
prometheus-node-exporter ClusterIP None <none> 9100/TCP 1h
prometheus-server NodePort 10.103.186.222 <none> 80:30000/TCP 1h
Now you can access the Prometheus web UI in your browser with the URL http://<HostIP>:30000
.
In the top menu, click Status
and then Targets
. The target page is displayed. Go to the bottom of the page; you'll find that the two targets of wls-domain1
are up and healthy.
In the top menu, click Graph
. The graph page is displayed. Enter the expression wls_jvm_uptime
that is one of the WebLogic metrics, and click Execute
. There will be two results displayed as shown below. This means that the Prometheus server can scrape metrics from WebLogic Servers successfully.
We'll talk about Alertmanager in a later step.
Next: Setting up Grafana