The following describes how to configure Prometheus and Grafana to gather metrics from Artifactory and Xray through the use of FluentD. The setup and configuration of Prometheus and Grafana uses Kubernetes and makes use of the Prometheus Operator.
- Kubernetes Cluster
- Artifactory and/or Xray installed via JFrog Helm Charts
- Helm 3
The Prometheus Operator allows the creation of Prometheus instances and includes Grafana. Install the Prometheus Operator via Helm:
helm install jfrog-prometheus stable/prometheus-operator
The following steps describe how to configure FluentD to gather metrics for Prometheus. Refer to the main README for more details.
- Install the FluentD Prometheus Plugin.
- Use the appropriate FluentD configuration file (*.prometheus) and copy it to /etc/td-agent/td-agent.conf.
- Restart td-agent.
- In order to expose the /metrics interface for Prometheus to scrape, apply the appropriate *-metrics-service.yaml.
eg.
kubectl apply -f artifactory-ha-member-metrics-service.yaml
The following steps using the Prometheus Operator to create a Prometheus instance and the ServiceMonitor to gather metrics. The ServiceMonitor resource tells Prometheus where the metrics service. This metrics service provides the metrics data for the Prometheus "scrapes".
- Create a new Prometheus instance.
kubectl apply -f prometheus-jfrog.yaml
- Apply the RBAC manifest to allow Prometheus to monitor for new ServiceMonitors.
kubectl apply -f prometheus-rbac.yaml
- Create the appropriate ServiceMonitor to gather metrics.
kubectl apply -f servicemonitor-*.yaml
eg.
kubectl apply -f servicemonitor-artifactory-ha-member.yaml
-
Go to the web ui of the Prometheus instance create in Step 1 and verify the Targets list shows the new ServiceMonitor.
-
Finally, go to Grafana to add your Prometheus instance as a datasource.
For testing purposes, you may want to expose Prometheus, Grafana and the FluentD Metrics interface. A test-only-expose.yaml provides an example of how to do this:
kubectl apply -f test-only-expose.yaml
An example dashboard is included in the grafana directory.
Partner Integration Test Framework can be used to generate data for metrics.