Submit a ticketCall us

Get a crash course on Network Monitoring delivered right to your inbox
This free 7-day email course provides a primer to the philosophy, theory, and fundamental concepts involved in IT monitoring. Lessons will explain not only how to perform various monitoring tasks, but why and when you should use them. Sign up now.

Home > Success Center > Server & Application Monitor (SAM) > Pull individual numeric values from a multi-value script

Pull individual numeric values from a multi-value script

Overview

You want to pull individual numeric values from a multi-value script.

Environment

All SAM versions

Resolution

The following function works for numeric data:

CREATE FUNCTION [dbo].[apm_Custom_GetMultiValueCurrentnumericdata] (
       @ComponentID int,
       @RowNumber int
 )
 RETURNS nvarchar(max)
 AS
 BEGIN
       DECLARE @result nvarchar(max)
       SELECT @result = Temp.NumericData FROM
       (
             SELECT RANK() OVER (ORDER BY DynEvDef.ID) AS Row, DynEvData.NumericData
             FROM dbo.APM_DynamicEvidence_DetailData AS DynEvData
             INNER JOIN dbo.APM_CurrentComponentStatus AS CCS
                 ON CCS.ComponentStatusID = DynEvData.ComponentStatusID
             INNER JOIN dbo.APM_DynamicEvidenceColumnSchema AS DynEvDef
                 ON DynEvDef.ID = DynEvData.ColumnSchemaID
             WHERE DynEvDef.[Type] = 1 AND CCS.ComponentID = @ComponentID
       ) Temp
       WHERE Temp.Row = @RowNumber
       RETURN @result
 END

At this point, you can use the following inline SQL macro in the Alert Manager to get the first value

${SQL:select dbo.apm_Custom_GetMultiValueCurrentnumericdata(${ComponentId}, 1)}

 

 

Last modified
21:36, 30 Nov 2016

Tags

Classifications

Public