Submit a ticketCall us

Solarwinds & Cisco Live! Barcelona
Join us from the 29th of January to the 2nd of February at Cisco Live 2018 in Barcelona, where we will continue to show how monitoring the network with SolarWinds will keep you ahead of the game. At our booth (WEP 1A), we will demonstrate how SolarWinds network solutions can help. As a bonus, we are also hosting a pre-event webinar - Blame the Network, Hybrid IT Edition with our SolarWinds Head Geek™, Patrick Hubbard on January 24th - GMT (UTC+0): 10:00 a.m. to 11:00 a.m. There's still time to RSVP.

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: 3,123 Votes: 1 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

Tags

Classifications

Public