Submit a ticketCall us

Welcome to the NEW Success Center. Search all resources (documentation, videos, training, knowledge base articles) or browse resources by product. If you are unable to find what you are looking for, please contact us at customersuccess@solarwinds.com

 

 

 

 

Home > Success Center > Network Performance Monitor (NPM) > Add SQL queries to alert email notification

Add SQL queries to alert email notification

Created by Mariusz Handke, last modified by MindTouch on Jun 23, 2016

Views: 1,889 Votes: 0 Revisions: 4

Overview

This article provides information on adding SQL queries to the alert email notification.

Environment

All Orion Platform

Details

Orion Alerting Engine provides one macro which allows to execute SQL query and returns results. Basic syntax is as folows:

${SQL: SQL-QUERY}

where SQL-QUERY can be replaced by any (possibly) SQL statement. For example:

SELECT REPLACE('abcdefghicde','cde','xxx')

SELECT @@VERSION

SELECT SERVERPROPERTY('productversion')

SELECT SERVERPROPERTY('productlevel')

SELECT SERVERPROPERTY('edition')

The equivalent to be used in the alert email body:

${SQL: SELECT REPLACE('abcdefghicde','cde','xxx')}

${SQL: SELECT @@VERSION}

${SQL: SELECT SERVERPROPERTY('productversion')}

${SQL: SELECT SERVERPROPERTY('productlevel')}

${SQL: SELECT SERVERPROPERTY('edition')}

and the final result in the email alert:

abxxxfghixxx

Microsoft SQL Server 2014 - 12.0.4213.0 (X64)
Jun 9 2015 12:06:16
Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor)

12.0.4213.0

SP1

Enterprise Edition (64-bit)

 

Notes:

  • If the SQL-QUERY returns multiple records, only the first one (top-most) will be displayed as a result.
  • If the SQL-QUERY returns multiple columns, only the first one (left-most) will be displayed as a result.
  • If the SQL-QUERY returns multiple records and multiple columns, only the top-left-most will be displayed as a result.

 

 

 

Last modified
21:40, 22 Jun 2016

Tags

Classifications

Public