Exporting metrics with an existing Prometheus server
Use an existing Prometheus server to export metrics.
After configuring DSE Metrics Collector, you can export metrics to an existing Prometheus server. These steps use Prometheus as the monitoring solution and Grafana as the dashboard. However, other monitoring and visualization tools can be used with DSE Metrics Collector.
If you already have a Prometheus server running, this method of exporting and visualizing metrics enables use of the existing server.
Prerequisites
- If necessary, download and install DataStax Enterprise (DSE 6.7.0 or later | 6.0.5 or later | 5.1.14 or later).
- Download and install Prometheus, which is used as the monitoring solution, or use an existing Prometheus server.
- Download and install Grafana, which is used as the visualization dashboard.
- Download the prometheus.yml file from GitHub and
save it in a directory on the server where Prometheus is running.
The prometheus.yml file is preconfigured to scrape metrics reported by DSE Metrics Collector. Each metric uses a specific regex for the metric type.
Note: If you are already using a prometheus.yml, integrate themetric_relabel_configs:
block, which is where DSE metrics are relabelled using regular expressions in your existing prometheus.yml file. - Download the tg_dse.json file and save it in the
same directory as the prometheus.yml file.
The prometheus.yml file references this file to obtain the IP addresses for each cluster node.
- To use preconfigured Grafana dashboards from DataStax, download the JSON files from GitHub to your local machine. Place these files in a local directory that is accessible.
Procedure
- On the server where Prometheus is running, ensure the prometheus.yml and tg_dse.json files are collocated in the same directory.
-
On the DSE cluster that DSE Metrics Collector reads from, create a
/collectd directory:
- Package installations: Create the /etc/dse/collectd directory on all nodes in the cluster and set the required user permissions.
- Tarball installations: The installation_location/resources/dse/collectd/etc/collectd exists by default.
-
Configure the Prometheus server from which the DSE Metrics Collector
reads.
-
Ensure collectd is listening on port 9103, in addition to the typical DSE
ports:
netstat -lnt
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 10.100.176.166:9042 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 10.100.176.166:7000 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:7199 0.0.0.0:* LISTEN tcp 0 0 10.100.176.166:8609 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:39940 0.0.0.0:* LISTEN tcp6 0 0 :::9103 :::* LISTEN tcp6 0 0 10.100.176.166:61621 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN
Note: If collectd is not listening on port 9103, ensure libaio is installed and Epoll is working. The collectd daemon will not start if Epoll is not working. -
Modify the downloaded tg_dse.json file to include the IP
address of each node in the cluster under
"targets"
.The list of IP addresses is comma-delimited. Enclose each IP address in double quotation marks. -
Start Prometheus with the --config option to specify the
prometheus.yml file you downloaded from the DSE Metrics
Collector Dashboards repository.
For example, if you saved the prometheus.yml file in the /etc/dse/tmp directory, the command would look like this:
./prometheus --config.file=/etc/dse/tmp/prometheus.yml
-
Verify the Prometheus and Grafana targets:
- To view the Prometheus dashboard, which displays each DSE node as a target, open a browser and navigate to http://prometheus_server_IP_address:9090, where prometheus_server_IP_address is the IP address where the Prometheus server is running, and 9090 is the default port where Prometheus runs.
- To view the targets that Prometheus is monitoring, open a browser and navigate to http://prometheus_server_IP_address:9090/targets. Each of the nodes specified in the tg_dse.json file displays as an endpoint, with the current status and last scrape time.
What's next
Creating a Grafana dashboard using the Prometheus data source
Steps to create a Grafana dashboard when an existing Prometheus server is used to export DSE metrics.
You can create a Grafana dashboard to visualize metrics. The Prometheus plugin is included with Grafana. These steps apply when an existing Prometheus server exports DSE metrics.
Prerequisites
Procedure
-
Start Grafana and enable the Prometheus plugin, which is included with Grafana
by default.
Note: You must have admin privileges for your organization to add data sources in Grafana.
- Log in to your Grafana instance at http://grafana_server_IP_address:3000, where grafana_server_IP_address is the IP address where your Grafana server is running.
- Open the side menu by selecting the Grafana icon in the upper left.
- In the side menu, select .
- On the Configuration page, select Add data source.
- Enter a name for your data source.
- Select Prometheus as the data source Type.
- Enter the URL where your Prometheus server is running.
- Select Server or Browser, depending on where your Prometheus instance is running.
- Select Save & Test.
-
Create a Grafana dashboard using the Prometheus data source.