Installing Prometheus and Grafana

Most Kubernetes environments offer a Prometheus and Grafana stack, often disabled by default.

To install Prometheus yourself, first create a prom-values.yaml file:

grafana:
  adminPassword: admin
  service:
    port: 3000
kubelet:
  serviceMonitor:
    https: false
prometheus:
  prometheusSpec:
    serviceMonitorSelectorNilUsesHelmValues: false
alertmanager:       # Optional setting
  persistentVolume:  
    storageClass: gp2
server:            # Optional settings  
  persistentVolume: 
    storageClass: gp2
Note: Make sure to set serviceMonitorSelectorNilUsesHelmValues: false to prevent Prometheus from using tags to select services.

Perform an installation based on these settings with the following commands:

helm repo update
kubectl create namespace monitoring 
helm install kube-prometheus prometheus-community/kube-prometheus-stack \
  -n monitoring \
  -f prom-values.yaml
Note: If Prometheus is installed using Helm, services include the Prometheus release name as a prefix, for example, svc/prom-kube-prometheus-stack-prometheus and svc/prom-grafana.

SNMP statistics from MATRIXX Engine are imported into Prometheus with the SNMP Exporter. A custom SNMP Exporter image is created with the SNMP configuration based on MATRIXX SNMP Management Information Base (MIB) files and installed in the matrixx Kubernetes namespace. The ServiceMonitors for engine components are then configured to scrape the SNMP exported statistics. The SNMP Exporter descriptors are installed in the matrixx namespace by Helm.

Prometheus can be configured with the following scrape_configs if Prometheus and the application are running outside Kubernetes. The configuration is different for services running in Kubernetes that are configured using the Prometheus Operator ServiceMonitor:

scrape_configs:
  - job_name: 'spring'
    metrics_path: '/actuator/prometheus'
    static_configs:
      - targets: ['localhost:8080']

For information about how to access the various web-based dashboards, see the discussions about the Prometheus metrics dashboard and Grafana.