MySQL plugin

For more information about what this plugin does and the data streams it retrieves, see:

MySQL

The data source is available as a Cloud data source and also as an on-premises data source. This data source allows for the connection from the on-premises SquaredUp agent to any MySQL instance which is available to connect to with SQL Login.

How to add a MySQL data source

You will only need to configure and deploy an agent if you adding the MySQL on-premises data source. If you want to add the MySQL Cloud data source, you only need to follow the steps detailed in Add a MySQL data source in 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.

Add a MySQL data source in SquaredUp

  1. 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.

  2. Display Name:

    Enter a name for your data source. This helps you to identify this data source in the list of your data sources.

  3. 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 MySQL on-premises data source.

  4. Username:
    Enter the SQL login username
  5. Password:
    The SQL login password
  6. Server:
    The server address or IP which to connect to. Do not include a port with the SERVER value.

    If you are adding the MySQL on-premises data source, the server must be accessible from the machine running the SquaredUp on-premises agent.

  7. Database:
    The name of the database which to initially connect to. Any queries executed without a database explicitly set will be run against this database.
  8. Port:
    The port to use to connect to SQL. The default is 3306, but can be changed as needed.
  9. Object Query (optional):
    The MySQL Server Connection can create objects in the Knowledge Graph index and these can be used to create context sensitive objects and drill-downs.
  10. Relationship Query (optional):
    If you are creating objects with the Object Query set in the previous step, you can relate those objects in the Knowledge Graph.
  11. Optionally, select whether you would like to restrict access to this data source instance. By default, restricted access is set to off.

  12. 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.

When using the data source to create data streams you have the option to create three different query types, as detailed below. The use of dynamic {{mustache}} properties is supported and is detailed following the types.

Custom Table Query

This allows for any tabular data to be pulled into to SquaredUp and be displayed in a standard table.

Custom Metrics Query

This configurable data stream type allows for data to be displayed in a visual format, such as a line graph. When writing a query for use as a Metrics query, the below three columns are mandatory and all others will be ignored.

Column Name (case sensitive)
Content
label
The label for the value passed in, for example ‘Percent Utilization’. Each distinct ‘label’ value will get its own line color which includes only values for that label.
timestamp
A DateTime value of when this reading occurred
value
A numerical non-null value to be visualized

Custom State Query

This configurable data stream allows for data to be displayed as a state tile (Red, Yellow, or Green blocks). When writing a query for use in a State query the below three columns are mandatory and all others will be ignored.

Column Name (case sensitive)
Content
label
The label for the state passed in, for example ‘Deliveries’. These ‘label’ values must be distinct and will each produce their own status block
id
If this state will be tied to an object, then that object’s sourceId should be used, otherwise passing the ‘label’ value a second time will work effectively.
state
The state of the labeled object, options are ‘Success’, ‘Warning’, ‘Error’, and ‘Unknown’

Mustache parameters

A 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.

Check the relevant data source documentation to see which fields accept mustache parameters. See Data Sources

  • Only scoped data streams are able to insert properties from objects in scope, such as sourceIds, sourceId and targetNodes. They will also be able to use other properties such as timeframe.
  • Global data streams are able to use other properties, such as timeframe.

See Data Streams

Mustache parameters for unscoped and scoped data streams

timeframe

All of the properties in the calling event payload are passed through to the template builder with the addition of below three properties.

• durationSeconds

• durationMinutes

• durationHours

Example

Parameter
Replacement value
Type
{{timeframe.start}}
2022-03-13T19:45:00.000Z
string
{{timeframe.unixStart}}
1647200700
number
{{timeframe.end}}
2022-03-14T19:45:00.000Z
string
{{timeframe.unixEnd}}
1647287100
number
{{timeframe.enum}}
last24hours
string
{{timeframe.interval}}
PT15M
string
{{timeframe.durationSeconds}}
86400
number
{{timeframe.durationMinutes}}
1440
number
{{timeframe.durationHours}}
24
number

Select CustomerName, Order from dbo.Orders where orderDT > DateADD(mi, -{{timeframe.durationMinutes}},GetDate())

Mustache parameters for scoped data streams only

sourceIds

This is a unique property as some pre-processing occurs within the data source to modify the values. sourceIds will return a list of all the targeted nodes sourceId elements, concatenated with commas and string delimiters for TSQL friendly systems.

Example

Parameter
Replacement value
Type
{{sourceIds}}
'idOne','idTwo','idThree'
string

Select CustomerName, Order from dbo.Orders where customerId IN ({{sourceIds}})

sourceId

This will return the sourceId of the first target node in the query. While not as powerful as the sourceIds value, it works for systems that don't support TSQL syntax and will still allow drill-down behavior

Example

Parameter
Replacement value
Type
{{sourceId}}
idOne
string

Select CustomerName, Order from dbo.Orders where customerId = '{{sourceId}}'

targetNodes

This property represents the targetNodes on the calling event with the small addition of a first and last property on the respective nodes. This allows for Mustache templates to do a couple tricks, as noted below.

Example

Parameter
Replacement value
Type
{{targetNodes.0.sourceId}}
idOne
string
{{#targetNodes}}'{{sourceId}}'{{^last}},{{/last}}{{/targetNodes}}
'idOne','idTwo','idThree'
string

Select CustomerName, Order from dbo.Orders where customerId = '{{targetNodes.0.sourceId}}'

Select CustomerName, Order from dbo.Orders where customerId IN ({{#targetNodes}}'{{sourceId}}'{{^last}},{{/last}}{{/targetNodes}})

Was this article helpful?


Have more questions or facing an issue?