Add A Prometheus Dashboard To Grafana
Grafana is the governing graph and dashboard builder for visualizing time series structure and application metrics, but many use it in other domains including industrial devices, environment automation, weather, and processes regulate. It provides a strong and elegant path to create, explore, and share dashboards and data with your group and the experience.
In this tutorial, you will learn how to add Prometheus as a data source to your Grafana example and install a pre-configured Prometheus Server Statistics Dashboard.
To follow this tutorial, you will need:
- Ubuntu 14.04 machine
- User with sudo access (see the first Server Setup with Ubuntu 14.04 tutorial for details)
- Prometheus and Grafana 2.5+ installed with the instructions from How To Install Prometheus using Docker on Ubuntu 14.04
Step 1 Adding Prometheus as a Grafana Data Source
In this portion, we will configure Grafana to access your Prometheus server as a data source. Each Prometheus server is an apart data source, and if you are configuring more than one Prometheus server, tell this portion for each.
Go to the Grafana important view at
http://your_server_ip:3000/, and log into your admin account.
Click the Grafana symbol in the top left corner to show the important menu. appoint Data Sources to navigate to the data source database page. Click Add brand-new in the top navigation bar. You should see the following:
Use the following belief Synonyms/Hypernyms to create a brand-new data source:
url: http://<your_server_ip>:9090, (failure port is 9090)
Basic Auth: Enabled or unfit, as your Prometheus server is configured.
Click Add to add your data source, and then click experiment Connection to verify everything is working properly. If boffo, move on to the next step to import your dashboard.
Step 2 Importing the Prometheus Stats Dashboard
This part will download an official, pre-built Prometheus Stats Dashboard and inform you on how to import it into Grafana.
Download the current Prometheus Dashboard one of two ways:
- Right click and save the following link: Prometheus Stats - failure Grafana Dashboard
- Navigate your browser directly to the dashboard JSON register:
The import view can be found at the Dashboard Picker dropdown, next to the brand-new Dashboard and Playlist badges.
To import a dashboard from a local JSON register, click the specify register badge in the Import register part. Find the transferred
prometheus-dash.json on your local register system, and import it.
Note: If you have labelled
your data source something other than
Prometheus, you will need to do a find and replace the data source name in the
.json register. ajar it with:
- nano prometheus-dash.json
Find the following, and action the data source name from Prometheus to whatever you labelled it:
After importing the Prometheus Dashboard, you will immediately be taken to the Prometheus Stats Dashboard, and if everything is properly configured, you will begin to see statistics from your Prometheus server.
all-important: Click the Save badge in the top menu to save your dashboard within your Grafana instance. If you do not save your dashboard, it will not appear in your Grafana after you close your browser.
Step 3 Viewing the Prometheus Stats Dashboard
Upon a boffo import, you will immediately be taken to your brand-new, unsaved dashboard. This dashboard was built with the support of the Prometheus faction, highlighting on the basic metrics commonly used to troubleshoot your Prometheus server.
The single bodies and informed metrics are as follows:
Single Stat Graphs
Uptime: This single stat graph is the uptime, or the time since the Prometheus server was brought online. At a glance, this stat is useful to know if your server has recently restarted.
Local Storage Memory Series: This panel displays the current number of series held in memory, as of the
Fromvalue specified on the dashboard time range. By default, this is
Internal Storage Queue Length: Ideally, this queue length should be Empty (0) or a low number.
Sample Ingested: This graph displays the count of samples ingested by the Prometheus server, as measured over the last 5 minutes, per time series in the range vector. When troubleshooting an issue on IRC or Github, this is often the first stat requested by the Prometheus team. This number should align with the number of metrics you believe you are ingesting.
The Samples Ingested query is as follows:
Prometheus scrapes metrics from instrumented jobs, either directly or via an intermediary push gateway for short-lived jobs. The Target Scrapes graph will show how frequently targets are rubbed as measured over the last 5 minutes, per time series in the range vector. The Scrape time graph will show how long the scrapes are taking with percentiles accessible as series. The scrape time shows the 50th percentile (0.5), 90th percentile (0.9). and 99th percentile (0.99) as three apart series to assist identify deviations that may be reorienting the data.
The Target Scrapes query is as follows:
The Scrape time query is as follows:
Rule Eval Duration
This graph body stories the time for all evaluations to kill. The 50th percentile (0.5), 90th percentile (0.9), and 99th percentile (0.99) are shown as three apart series to aid identify deviations that may be reorienting the data.
Step 4 Analyzing the Data from the Prometheus Dashboard
For a newly running Prometheus server, your graphs should be beautiful even and little.
Long statement, these graphs will vary greatly being on your specific use case and workloads. In general, you want all of these graphs to be stable. If more targets are being rubbed and/or they commence exporting more metrics, the number of ingested samples, memory series, and target scrapes per ordinal will increase that is to be expected.
If your target scrapes descent unexpectedly or the scrape latency goes up, you should determine the cause. For instance, a case can commence exporting 1 million metrics instead of the usual 10 thousand metrics or someone can export a time series with a dissimilar description for each user. Both of these would cause an increase in scrape latency. So, when a graph suddenly goes up, you should investigate whether an application was just measured up significantly or whether it might be instrumented badly.
sedate rule evaluation is also a good indicator that the node on which the Prometheus server runs is simply not sufficient to handle the load.
Step 5 Customizing Graphs and Metrics
You now have a prometheus Dashboard increased to your Grafana example with a set of pre-configured Prometheus server statistics.
Grafana gives you the energy to visualize any metric accessible on your Prometheus server all accessible within a differentiated Prometheus Query editor. To access the query editor on any body, click the body title location to show the body menu. Click Edit. The Metrics tab will be pre-selected for you, and give direct access to the query and accessible actions for the Prometheus data source.
As actions are made in the query editor, the graph will instantly modify to show your edits.
For a full database of accessible metrics, you can navigate to http://
<your_server_ip>:9090/metrics (port 9090 is the failure).
Any of these metrics can be copy and attached into the Grafana query editor, and until you save your dashboard, none of your edits will overwrite the existing dashboard.
So test, have entertaining, and commence visualizing!