mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Docs: Edit prometheus data source doc (#23760)
* Update prometheus.md * Editing * Update prometheus.md * Update add-a-data-source.md * Update prometheus.md Co-authored-by: Daniel Lee <dan.limerick@gmail.com>
This commit is contained in:
parent
f48ba11d4c
commit
737f629145
@ -12,6 +12,8 @@ weight = 2
|
||||
|
||||
Before you create your first dashboard, you need to add your data source. Following are the list of instructions to create one.
|
||||
|
||||
> Only users with the Admin role can add data sources.
|
||||
|
||||
1. Move your cursor to the cog on the side menu which will show you the configuration menu. If the side menu is not visible click the Grafana icon in the upper left corner. Click on **Configuration** > **Data Sources** in the side menu and you'll be taken to the data sources page
|
||||
where you can add and edit data sources. You can also click the cog.
|
||||
{{< docs-imagebox img="/img/docs/v52/sidemenu-datasource.png" max-width="250px" class="docs-image--no-shadow">}}
|
||||
@ -24,6 +26,6 @@ Before you create your first dashboard, you need to add your data source. Follow
|
||||
|
||||
{{< docs-imagebox img="/img/docs/v52/datasource-settings.png" max-width="700px" class="docs-image--no-shadow">}}
|
||||
|
||||
1. In the **Type**, select the type of data source. See [Supported data sources]({{< relref "../../features/datasources/#supported-data-sources/" >}}) for more information and how to configure your data source.
|
||||
1. In the **Type**, select the type of data source. See [Supported data sources]({{< relref "../../features/datasources/#supported-data-sources/" >}}) for more information and how to configure your data source settings.
|
||||
|
||||
1. Click **Save & Test**.
|
||||
|
@ -10,20 +10,13 @@ parent = "datasources"
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
# Using Prometheus in Grafana
|
||||
# Prometheus data source
|
||||
|
||||
Grafana includes built-in support for Prometheus.
|
||||
Grafana includes built-in support for Prometheus. This topic explains options, variables, querying, and other options specific to the Prometheus data source. Refer to [Add a data source]({{< relref "add-a-data-source.md" >}}) for instructions on how to add a data source to Grafana.
|
||||
|
||||
## Adding the data source
|
||||
## Prometheus settings
|
||||
|
||||
1. Open the side menu by clicking the Grafana icon in the top header.
|
||||
2. In the side menu under the `Dashboards` link you should find a link named `Data Sources`.
|
||||
3. Click the `+ Add data source` button in the top header.
|
||||
4. Select `Prometheus` from the _Type_ dropdown.
|
||||
|
||||
> NOTE: If you're not seeing the `Data Sources` link in your side menu it means that your current user does not have the `Admin` role for the current organization.
|
||||
|
||||
## Data source options
|
||||
To access Prometheus settings, click the **Configuration** (gear) icon, then click **Data Sources**, and then click **Prometheus**.
|
||||
|
||||
| Name | Description |
|
||||
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
@ -35,9 +28,9 @@ Grafana includes built-in support for Prometheus.
|
||||
| _User_ | User name for basic authentication. |
|
||||
| _Password_ | Password for basic authentication. |
|
||||
| _Scrape interval_ | Set this to the typical scrape and evaluation interval configured in Prometheus. Defaults to 15s. |
|
||||
| _Custom Query Parameters_ | Add custom parameters to the Prometheus query URL. For example `timeout`, `partial_response`, `dedup` or `max_source_resolution`. Multiple parameters should be concatenated together with an '&'. |
|
||||
| _Custom Query Parameters_ | Add custom parameters to the Prometheus query URL. For example `timeout`, `partial_response`, `dedup`, or `max_source_resolution`. Multiple parameters should be concatenated together with an '&'. |
|
||||
|
||||
## Query editor
|
||||
## Prometheus query editor
|
||||
|
||||
Open a graph in edit mode by click the title > Edit (or by pressing `e` key while hovering over panel).
|
||||
|
||||
@ -47,7 +40,7 @@ Open a graph in edit mode by click the title > Edit (or by pressing `e` key whil
|
||||
| Name | Description |
|
||||
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| _Query expression_ | Prometheus query expression, check out the [Prometheus documentation](http://prometheus.io/docs/querying/basics/). |
|
||||
| _Legend format_ | Controls the name of the time series, using name or pattern. For example `{{hostname}}` will be replaced with label value for the label `hostname`. |
|
||||
| _Legend format_ | Controls the name of the time series, using name or pattern. For example `{{hostname}}` is replaced with the label value for the label `hostname`. |
|
||||
| _Min step_ | An additional lower limit for the [`step` parameter of Prometheus range queries](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) and for the `$__interval` variable. The limit is absolute and not modified by the _Resolution_ setting. |
|
||||
| _Resolution_ | `1/1` sets both the `$__interval` variable and the [`step` parameter of Prometheus range queries](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) such that each pixel corresponds to one data point. For better performance, lower resolutions can be picked. `1/2` only retrieves a data point for every other pixel, and `1/10` retrieves one data point per 10 pixels. Note that both _Min time interval_ and _Min step_ limit the final value of `$__interval` and `step`. |
|
||||
| _Metric lookup_ | Search for metric names in this input field. |
|
||||
@ -55,12 +48,11 @@ Open a graph in edit mode by click the title > Edit (or by pressing `e` key whil
|
||||
| _Instant_ | Perform an "instant" query, to return only the latest value that Prometheus has scraped for the requested time series. Instant queries return results much faster than normal range queries. Use them to look up label sets. |
|
||||
| _Min time interval_| This value multiplied by the denominator from the _Resolution_ setting sets a lower limit to both the `$__interval` variable and the [`step` parameter of Prometheus range queries](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries). Defaults to _Scrape interval_ as set in the data source options. |
|
||||
|
||||
> NOTE: Grafana slightly modifies the request dates for queries to align them with the dynamically calculated step.
|
||||
> This ensures consistent display of metrics data but can result in a small gap of data at the right edge of a graph.
|
||||
> **Note:** Grafana modifies the request dates for queries to align them with the dynamically calculated step. This ensures consistent display of metrics data, but it can result in a small gap of data at the right edge of a graph.
|
||||
|
||||
### Instant queries
|
||||
|
||||
The Prometheus datasource allows you to run "instant" queries, which queries only the latest value.
|
||||
The Prometheus data source allows you to run "instant" queries, which query only the latest value.
|
||||
You can visualize the results in a table panel to see all available labels of a timeseries.
|
||||
|
||||
Instant query results are made up only of one data point per series but can be shown in the graph panel with the help of [series overrides]({{< relref "../panels/graph/#series-overrides" >}}).
|
||||
@ -97,7 +89,7 @@ For details of _metric names_, _label names_ and _label values_ are please refer
|
||||
|
||||
> Support for `$__range`, `$__range_s` and `$__range_ms` only available from Grafana v5.3
|
||||
|
||||
It's possible to use some global built-in variables in query variables; `$__interval`, `$__interval_ms`, `$__range`, `$__range_s` and `$__range_ms`, see [Global built-in variables]({{< relref "../../reference/templating/#global-built-in-variables" >}}) for more information. These can be convenient to use in conjunction with the `query_result` function when you need to filter variable queries since
|
||||
You can use some global built-in variables in query variables; `$__interval`, `$__interval_ms`, `$__range`, `$__range_s` and `$__range_ms`, see [Global built-in variables]({{< relref "../../reference/templating/#global-built-in-variables" >}}) for more information. These can be convenient to use in conjunction with the `query_result` function when you need to filter variable queries since
|
||||
`label_values` function doesn't support queries.
|
||||
|
||||
Make sure to set the variable's `refresh` trigger to be `On Time Range Change` to get the correct instances when changing the time range on the dashboard.
|
||||
@ -140,17 +132,17 @@ Prometheus supports two ways to query annotations.
|
||||
|
||||
The step option is useful to limit the number of events returned from your query.
|
||||
|
||||
## Getting Grafana metrics into Prometheus
|
||||
## Get Grafana metrics into Prometheus
|
||||
|
||||
Grafana exposes metrics for Prometheus on the `/metrics` endpoint. We also bundle a dashboard within Grafana so you can get started viewing your metrics faster. You can import the bundled dashboard by going to the data source edit page and click the dashboard tab. There you can find a dashboard for Grafana and one for Prometheus. Import and start viewing all the metrics!
|
||||
|
||||
For detailed instructions, refer to [Internal Grafana metrics]({{< relref "../../administration/metrics.md">}}).
|
||||
|
||||
## Configure the data source with provisioning
|
||||
## Provision the Prometheus data source
|
||||
|
||||
It's now possible to configure data sources using config files with Grafana's provisioning system. You can read more about how it works and all the settings you can set for data sources on the [provisioning docs page]({{< relref "../../administration/provisioning/#datasources" >}})
|
||||
You can configure data sources using config files with Grafana's provisioning system. Read more about how it works and all the settings you can set for data sources on the [provisioning docs page]({{< relref "../../administration/provisioning/#datasources" >}})
|
||||
|
||||
Here are some provisioning examples for this data source.
|
||||
Here are some provisioning examples for this data source:
|
||||
|
||||
```yaml
|
||||
apiVersion: 1
|
||||
|
Loading…
Reference in New Issue
Block a user