Prometheus plugin
Visit our website to see the data that you can access if you use this plugin to add the data source to SquaredUp:
The data source lets you monitor any metrics from your Prometheus environment using custom PromQL queries.The data source is available as a Cloud data source and also as an on-premises data source.
An on-premises data source connects a service running in your internal network to SquaredUp. They require an agent installed on a machine that has access to your internal network.
Note: This data source is of great use in addition to other data sources. It enables you to get different kinds of data and insights about objects that have been indexed by other data sources.
How to add a Prometheus data source
You will only need to configure and deploy an agent if you adding the Prometheus on-premises data source. If you want to add the Prometheus Cloud data source, you only need to follow the steps detailed in Add a Prometheus data source to SquaredUp.
Configure and deploy an agent
If you have already created an agent in SquaredUp that you can use for this data source, you can skip this step and choose the agent group you want to use while adding the data source.
Create a unique API key for your agent and add the agent to an agent group in SquaredUp.
You create an API key by creating an agent in SquaredUp:
Go to Settings > Relay and add an Agent.
Give the new agent a name and a description that helps you identify where the agent is installed. For example:
Name: server1.domain.localDescription: Test server in production domain
Choose the Agent Group for this agent:
If you already have agent groups, assign it to an existing group and click create.
If you don't have any agent groups yet or want to assign the new agent to a new group, leave the Agent Groups field empty and click create. Then create the agent group by clicking on Add Agent Group and select the new agent in the Agents field for the new group.
After you created the agent, the API key for this agent will be shown to you. Copy the key and store it until you inserted the key into the configuration of the agent you want to deploy on your machine.
The API key will only be displayed to you once. If you lose this API key, you need to generate a new one (by creating a new agent) and any references to the old API key in the configuration of the agent you deployed on your machine will need to be updated.
- The agent status will show as gray until the next stage of configuring the service is completed successfully.
Deploy the agent on a machine that has access to the service the data source connects to.
Download the latest release of the SquaredUp agent zip file, by clicking the download icon under Options next to the agent you have just added.
Prerequisites for agentsThe agent needs to run on a Windows machine that has access to the entry point for the on-premises data source
Make sure the agent is able to make outbound connections on port 443 (no inbound required) to SquaredUp, *.amazonaws.com and Microsoft APIs (Azure Relay).
Optional DNS-based restrictions: *.servicebus.windows.net
For information about Relay Agent versions see Release Notes - Relay Agent
On a Windows machine, with access to the entry point your data source needs to use, extract the downloaded zip file.
In the folder of the extracted zip file, open PowerShell as an administrator and run the following command:
Copy./Install-SQUPAgent.ps1 -ApiKey "key" -AsService -ServiceSuffix "name" -ServiceAccount domain\username
Parameters to replace:
-ApiKey "key"
Mandatory Replace key
with the API key you created for the agent in SquaredUp-AsService
Recommended Run the agent as a service on the machine -ServiceSuffix "name"
Optional To change the default service name of squpagent replace name
with your new service name.-ServiceAccount domain\username
Optional To run the agent as a domain service account (for example, for the SCOM data source), provide the username as domain\username
and it will prompt for the password when it sets up the service-InstallPath
Optional Specify a folder location for where the agent will be installed. If this is not specified then the agent will be installed in the folder where the zip file is extracted. Consider restricting access to the folder where the agent is installed to prevent anyone from updating or viewing the configuration files.
Configure a domain service account using the installation script, for example:
./Install-SQUPAgent.ps1 -ApiKey "key" -AsService -ServiceAccount domain\username
where
key
is the API key, anddomain\username
is the domain service accountAlternatively, in Services > SquaredUp Cloud Agent > Properties select the account on the Log On tab.
Use a dedicated user account for the agent's service identity. Create a special service account for this domain service account, do not use an existing user account.
The account (typically a service account) needs to have the log on as a service permission.
Adjust any permissions for the service and start the service.
How to start the agent serviceYou can start the agent service from Services > SquaredUp Cloud Agent, or using PowerShell using either:
Start-Service -Name <ServiceName>
Where
<ServiceName>
should be replaced with the service name shown in brackets in the upgrade script output (or Properties of the service).For example:
Start-Service -Name squpagent
or
Start-Service -DisplayName <DisplayName>
Where
<DisplayName>
should be replaced with the service name shown before the brackets in the upgrade script output (or Properties of the service).How to find the agent folder location or Service name in PropertiesLook at the Properties of the SquaredUp Cloud Agent service:
On the server running the agent, open Services
Scroll down to the SquaredUp Cloud Agent in the list
Right-click on the SquaredUp Cloud Agent service and then Properties
Here you can see the Service name, Display name and Path to the agent folder.
You can also start or stop the service from here.
- Check the agent status in SquaredUp Settings > Relay
Running the agent as a domain service accountBy default, the SquaredUp agent service uses the local system identity, but this can be changed to a domain service account if required, for example for the SCOM data source.
Add a Prometheus data source to SquaredUp
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.
Enter the URL of your Prometheus instance.
Enter the API Token if it is required to access your server.
Select the agent Group from the list.
This is only required if you are configuring the Prometheus on-premises data source.
Optionally, select whether you would like to restrict access to this data source instance. By default, restricted access is set to off.
Restrict access to this data sourceThe 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.
Data source access levelsAccess Level:
Link to workspace
- User can link the data source to any workspace they have at least Editor permissions for.
- Data from the data source can then be viewed by anyone with any access to the workspace.
User can share the data source data with anyone they want.
User cannot configure the data source in any way, or delete it.
Full Control - User can change the data source configuration, ACL, and delete the data source.
See Access control for more information.
Click Add.
You can also add a data source from Settings > Data Sources > Add data source, but sample dashboards are not added when using this method.
Using the Prometheus 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").
How to create a data stream for this data source:
Creating a data stream using the configurable data stream (simplest option) see Creating a data stream using the configurable data stream
Write a custom data stream (advanced use) see Writing a custom data stream (advanced users)
Creating a data stream using the configurable data stream
A configurable data stream allows you to easily create new data streams specific to your needs, by entering information into a form, such as metric names or queries. Configurable data streams have a cog icon next to their name in the tile editor.
Any data stream you create can be edited by clicking the edit button (pencil) next to it in the tile editor, and also from Settings > Advanced > Data Streams.
PromQL
This data stream calls the /api/v1/query
endpoint, and allows you to enter a custom query.
In the tile editor, filter by the Prometheus data source, select the PromQL data stream and then click Next.
You can either select the scoped PromQL data stream or the global PromQL data stream.
If you selected the scoped Prom QL data stream, select the objects you want to use and then click Next.
You do not need to do this if you have selected the global PromQL data stream.
Enter a Query, for example:
sum by (instance) (rate(kubedns_probe_dnsmasq_latency_ms_sum[1m])) / sum by (instance) (rate(kubedns_probe_dnsmasq_latency_ms_count[1m]))
Mustache parameters are supported when scoped to an object.
Supports mustache parametersA mustache parameter is a dynamic value, the actual value will be inserted to replace the field in curly braces. For example,
{{timeframe.start}}
will insert the start time based on the timeframe configured within the tile, or{{name}}
will insert the name of the object(s) in scope.This data stream supplies scoped objects individually for mustache parameters. When there are multiple objects in scope this data source will send the query multiple times, once for each object. The results are then displayed together, for example in a single table.
You can use properties of objects and write them in between curly braces e.g
{{name}}
to use them as mustache parameters. Whenever you use mustache parameters, you need to use a scope of objects that contain the property you're referencing.For example, if objects of type "host" have a property called
name
, you can use{{name}}
. This will resolve{{name}}
to the value of the name property of the different "host" objects used in the scope.Ignore Timeframe:
Tick this checkbox if you wish to return a single scalar value rather than a table of results.
Click Save.
Writing a custom data stream (advanced users)
Go to Settings > Data Streams.
Click Add new Data Stream.
Enter a display name for your Data Stream.
Note: The display name is the name that you use to identify your Data Stream in SquaredUp. It has no technical impact and doesn't need to be referenced in the Data Stream's code.
Choose the Data Source this Data Stream is for.
After you've chosen the data source a new field Entry Point appears.
Entry point and code:
What is an entry point?Each data stream uses an entry point, which can either be global (unscoped) or scoped, and this determines whether the data stream uses the tile scope.
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").
To find out which entry point to select and get code examples for the Code field, see the help below.
Click Save to save your Data Stream.
Example 1: Using a Prometheus query
Which data stream do I have to select?
Prometheus Query (Unscoped)
Display Name
Mandatory
The internal name of the data stream. Can be used the refer to this data stream in a tile's JSON instead of using the data stream's internal ID.
dataSourceConfig
Parameters
Query | Mandatory
Note: You can't use mustache parameters in the query since it doesn't use the |
Ignore Timeframe | Optional You can add the What is the dashboard timeframe? The dashboard timeframe is the current timeframe setting for a dashboard. Users can change the dashboard timeframe to see data for a different time span, for example, instead of showing data from "the last 12 hours" it can be changed to show data from "the last 7 days". Tiles can be configured to:
Tip: Indicate with the name of a tile if the tile's timeframe can be changed. For example, naming a tile "Performance during the last week" tells users that this tile always shows data for the last week. Naming a tile just "Performance" indicates to users that changing the dashboard timeframe will change the data. |
Example 2: Get CPU usage for a selected object from a GCP cluster
Note: This Data Stream requires a Google Cloud Platform data source which has to be configured to return information from a cluster.
Which entry point do I have to select from the dropdown?
Prometheus Query (Scoped)
Display Name
Mandatory
The internal name of the data stream. Can be used the refer to this data stream in a tile's JSON instead of using the data stream's internal ID.
dataSourceConfig
Parameters
Query | Mandatory You can use mustache parameters in the query.
What is a mustache parameter? A mustache parameter is a dynamic value, the actual value will be inserted to replace the field in curly braces. For example, This data stream supplies scoped objects individually for mustache parameters. When there are multiple objects in scope this data source will send the query multiple times, once for each object. The results are then displayed together, for example in a single table. You can use properties of objects and write them in between curly braces e.g For example, if objects of type "host" have a property called |
Ignore Timeframe | You can add the What is the dashboard timeframe? The dashboard timeframe is the current timeframe setting for a dashboard. Users can change the dashboard timeframe to see data for a different time span, for example, instead of showing data from "the last 12 hours" it can be changed to show data from "the last 7 days". Tiles can be configured to:
Tip: Indicate with the name of a tile if the tile's timeframe can be changed. For example, naming a tile "Performance during the last week" tells users that this tile always shows data for the last week. Naming a tile just "Performance" indicates to users that changing the dashboard timeframe will change the data. |