Database Custom Queries

Role: Standard Operation Environment, SREs (Site Reliability Engineers), and DB Administrator.

As a database user or developer, you can write database queries so that you can access and manipulate data which a standard query may not support.

You can write a custom query to execute on a database so that you can get a metric after execution.

The following databases are supported.

  • MySQL
  • MsSQL
  • PostgreSQL
  1. Navigate to Settings on the left pane from the SixthSense Observability portal page.
  2. Click the DB custom query tab.

A DB custom query screen similar to the following appears.

DB custom query

This screen lists the existing database queries already added along with its name. For more information about adding custom queries, see Adding custom queries

For more information about managing these queries, see Managing custom queries.

Adding custom queries

  1. Navigate to Settings on the left pane from the SixthSense Observability portal page.
  2. Click the DB custom query tab.
  3. Click + Add custom query.

The following DB custom query window appears.

Add DB custom query
  1. Fill in the following fields.
FieldDescription
Select databaseSelect a database type that you want to query on from the drop-down list. MySQL, MsSQL, and PostgresSQL databases are supported.
Select serviceSelect a database service available from the drop-down list.
Database nameEnter a database name.
NameEnter a new custom query name.
QueryEnter a custom query in the query box which must return and integrer only.
  1. Click Validate to validate the query.
  2. Click Save to save the query.

Managing custom queries

  1. Navigate to Settings on the left pane from the SixthSense Observability portal page.
  2. Click the DB custom query tab.
  3. Click the    icon next to any of the existing custom query in the DB custom query screen.

The following options appear.

Manage custom query
  1. Select any of the options, to edit, delete, run a query, add widget, and view alerts for a selected query.

Editing a query

  1. Click the Edit option from the drop-down list.
  2. In the DB custom query window, do the following:
  3. Edit the query in the Query box.
  4. Click Validate.
  5. Click Update.

Deleting a query

  1. Click the Delete option from the drop-down list. A confirmtion message appears to confirm deletion.
  2. Click Delete to confirm deleting the metric.
note

Alerts configured for this metric will be deleted and the corresponding widget will have no data.

Running a query

  1. Click the Run query option from the drop-down list.
  2. Click Validate the validate the query in the Query box.
  3. Click Run to run the query.

Adding a widget

  1. Click the Add widget option from the drop-down list. You will see a table with the message and timestamp displayed.
  2. Click the    icon against a message to expand the query and copy it.
  3. Click either the Line graph or Label from the Add widget pane on the right. The Add widget window appears.
Add widget
  1. Enter the following details if you want to add a widget to an existing dashboard.
FieldDescription
Existing dashboardSelect this radio button to add the widget to an existing dashboard
Widget nameEnter a name for the widget.
Select dashboardSelect an existing dashboard.

OR

Enter the following details if you want to add a widget to a new dashboard.

FieldDescription
New dashboardSelect this radio button to add the widget to a new dashboard
Widget nameEnter a name for the widget.
Dashboard nameName for the dashboard you want to create.
Copy templateAllows you to select an existing dashboard template.
  1. Click Create.

Viewing alerts

  1. Click the View alerts option from the drop-down list. The list of open alerts for the application are displayed.
note

If there are no open alerts, you can either go to the Configured alerts tab to update existing alerts, or click Add alert to add alerts.