Prometheus plugin
The Prometheus plugin enables you to query data from your Prometheus environment for use in your dashboards, analytics and monitoring.
For more information about what this plugin does and the data streams it retrieves, see:
The data source supports the following types of data streams:
- PromQL
- Simple query (an easy-to-use alternative to PromQL for common queries)
- Alerts
- Status of the Prometheus instance
In addition to data streams, the data source can index labels in your Prometheus database as objects in SquaredUp. Indexing objects makes it easier to query data, correlate Prometheus data with other data sources, and explore the data interactively. Object indexing is explained further here.
To add a data source click on the + next to Data Sources on the left-hand menu in SquaredUp. Search for the data source and click on it to open the Configure data source page.
You can also add a data source by clicking Add data source on the Settings > Data Sources page, but pre-built dashboards are not added when using this method.
Before you start
The Prometheus plugin is a "hybrid" plugin, meaning it is available in SquaredUp as both a cloud and an on-prem plugin.
- Use the cloud plugin if your Prometheus instance is available on the internet. You do not need to configure a relay agent.
- Use the on-prem plugin to access a Prometheus instance that is on a private network and is not publicly accessible. You will need to configure a relay agent before you configure the Prometheus on-prem plugin.
An on-prem data source connects SquaredUp to a service running on your internal network. It needs a relay agent to be installed on a server on your internal network that has access to your data source.
Configuring and deploying an agent
For an on-prem plugin you will need a relay agent that can access the server hosting your on-prem data source. You do not need a relay agent for cloud plugins.
If you have already created a relay agent in SquaredUp that can access this data source, then you can skip this step and choose the agent group you want to use while Configuring the data source.
See one of the following, depending on your platform type:
Object Indexing
Prometheus time series are described by a set of labels. These labels can be indexed by SquaredUp to make it easier to query, explore and correlate metrics.
The indexed labels are stored in SquaredUp as objects. For example, when (at a minimum) the job label is indexed an object is created for each unique value, such as prometheus-local
.
If Index Open Telemetry Semantic Convention labels is selected when you Add a Prometheus data source to SquaredUp, then additional labels that conform to the Open Telemetry Semantic Conventions for resources are also indexed. For example, the k8s_pod_name
label will be indexed as Kubernetes Pod
objects. See https://opentelemetry.io/docs/specs/semconv/resource/ for more examples of resource labels.
These objects can then be selected in the tile editor when using the object-aware version of the PromQL and Simple Query data streams. When selected, the data streams are automatically scoped to the required label values, so there is no need to create "label matcher" expressions in PromQL.
They can also be viewed in the map, and you can even configure custom correlations between Prometheus objects and objects form other data sources, for example the Kubernetes Pod
objects, with other data source objects, for example AWS EKS Kubernetes Pod
objects.
To index custom labels that are not automatically indexed with Open Telemetry Semantic Conventions, use the Index custom labels option when you Configure the data source.
Configuring the data source
- Display Name:
Enter a display name for the data source. If connecting to multiple Prometheus instances, you may want to give this data source a more descriptive name such asPrometheus Prod
. Agent Group:
Select the Agent Group that contains the agent(s) you want to use.This field will only appear if you are adding the on-prem plugin.
- Prometheus URL:
Enter the URL of your Prometheus instance. Use the On-prem version to access a Prometheus instance that is not publicly accessible. - Authentication Type:
Select one of the following authentication types, used to access your server, from the Query Type field:- None: No authentication is required.
- API Token: You must enter the API authentication token in the API Token field.
- Basic Authentication: You must enter a Username and Password in the corresponding fields.
Ignore Certificate errors:
If you activate this checkbox the data source will ignore certificate errors when accessing the server. This is useful if you have self-signed certificates.
- Import Semantic Conventions compatible labels:
Select whether to index Open Telemetry Semantic Conventions labels. For example, thek8s_pod_name
label will be indexed asKubernetes Pod
objects. - Enable object indexing:
Select whether to index labels as objects. Indexing labels as objects makes it easier to correlate, explore and query your Prometheus data (see Object indexing) Selecting this option will, at a minimum, index Prometheus jobs (the "job" label). Selecting this option reveals additional indexing options. - Index Open Telemetry labels:
Select whether to index Open Telemetry Semantic Conventions labels. For example, thek8s_pod_name
label will be indexed asKubernetes Pod
objects. For more information on Open Telemetry Semantic Conventions, see https://opentelemetry.io/docs/specs/semconv/resource/. - Index custom labels:
Select whether to index custom labels. These are additional labels that will be indexed as objects in SquaredUp.- Click Add a custom index.
- Enter one of more labels to index as an object. For example
app_instance
. Use commas to separate multiple labels, for exampleapp_instance_namespace, app_instance_id
. - Enter the type of object that will be created by the index, for example
App Instance
. - Click Add another custom index to add further indexes.
Restrict access to this data source:
You can enable this option if you only want certain users or groups to have access to the data source, or the permission to link it to new workspaces. See data source access control for more information.The term data source here really means data source instance. For example, a user may configure two instances of the AWS data source, one for their development environment and one for production. In that case, each data source instance has its own access control settings.
By default, Restrict access to this data source is set to off. The data source can be viewed, edited and administered by anyone. If you would like to control who has access to this data source, switch Restrict access to this data source to on.
Use the Restrict access to this data source dropdown to control who has access to the workspace:
- By default, the user setting the permissions for the data source will be given Full Control and the Everyone group will be given Link to workspace permissions.
- Tailor access to the data source, as required, by selecting individual users or user groups from the dropdown and giving them Link to workspace or Full Control permissions.
- If the user is not available from the dropdown, you are able to invite them to the data source by typing in their email address and then clicking Add. The new user will then receive an email inviting them to create an account on SquaredUp. Once the account has been created, they will gain access to the organization.
- At least one user or group must be given Full Control.
- Admin users can edit the configuration, modify the Access Control List (ACL) and delete the data source, regardless of the ACL chosen.
See Access control for more information.
Click Test and add to validate the data source configuration. SquaredUp will now attempt to connect to SquaredUp using the provided authentication method.
- Testing passed – a success message will be displayed and then the configuration will be saved.
- Testing passed with warnings – warnings will be listed and potential fixes suggested. You can still use the data source with warnings. Select Save with warnings if you believe that you can still use the data source as required with the warnings listed. Alternatively, address the issues listed and then select Rerun tests to validate the data source configuration again. If the validation now passes, click Save.
- Testing Failed – errors will be listed and potential fixes suggested. You cannot use the data source with errors. You are able to select Save with errors if you believe that a system outside of SquaredUp is causing the error that you need to fix. Alternatively, address the issues listed and then select Rerun tests to validate the data source configuration again. If the validation now passes, click Save.
You can edit any data source configurations at any time from Settings > Data Sources.
Next steps
PromQL vs Simple Query
PromQL is commonly used for querying Prometheus and there are many resources available that include tutorials and example queries. PromQL can be difficult to get right however, even for experienced users.
The Simple Query data streams offer an alternative, easier-to-use method of querying Prometheus data for common queries.
Simple Query is the recommended data stream for non-experience PromQL users.
Global vs object-aware
The PromQL and Simple Query data streams both have global and object-aware versions. Object-aware versions use the objects indexed from the database labels to make it easier to scope your queries to the required labels. For example, an object-aware simple query can be scoped to Kubernetes Nodes by browsing and selecting the nodes during the Objects step of the tile editor.
Object-aware versions are recommended.
Using object-aware data streams requires "Enable object indexing" to be configured.
Query results
With the exception of the Alerts data stream, all data streams return data in a tabular format, with the following columns:
Timestamp
: timestamp of the metric value. If single values are requests (typically an ‘instant’ query) the the timestamp should be the current time. For ‘range’ queries, the timestamps will be at regular intervals across the configured timeframe.Value
: the metric value. This is displayed with 5 decimal places by default. Use the Columns step of the tile editor to change the number of decimal places.Auto Label
: this is a column automatically created by the data stream to be used as a series label on graphs and other visualizations. It is constructed from the labels that uniquely identify a distinct time series in the returned data. This columns is not stored in Prometheus and cannot be used for aggregations and filtering.Labels
: the remaining columns are all the labels for the Prometheus time series.
Troubleshooting query timeouts
It can be common for queries to timeout if they attempt to return a large dataset. To reduce the chance of timeouts, follow these best practices:
- Scope queries to only the required labels. Use object selections (with object-aware data streams) and label filters to filter the query to the data of interest.
- Aggregate by labels. A common cause of timeouts is a query that attempts to return a large number of unique time series. For example, a query for an HTTP response time may try to return a time series for each unique client IP address. Aggregating by the client IP address will reduce the number of time series returned
- Increase the time interval. If queries are still causing timeouts, try increasing the time interval to reduce the number of data points returned.
If the query causes a timeout and you are not sure why, try changing the query to an "instant" or "single value" query that returns just the latest data point for each time series. Use this to filter and aggregate labels to reduce the number of time series returned by the query.
Data streams
Data streams standardize data from all the different shapes and formats your tools use into a straightforward tabular format.
While creating a tile you can tweak data streams by grouping or aggregating specific columns.
Depending on the kind of data, SquaredUp will automatically suggest how to visualize the result, for example as a table or line graph.
Data streams can be either global or scoped:
- Global data streams are unscoped and return information of a general nature (e.g. "Get the current number of unused hosts").
- A scoped data stream gets information relevant to the specific set objects supplied in the tile scope (e.g. "Get the current session count for these hosts").
See Data Streams for more information.
The following data streams are installed with this plugin.
Configurable data streams
The following data streams have configurable Parameters.