Version 1

    HI,

    Solarwinds  tech Support does not support this sql script.

    But it will work!

    Save it to a Report Writer or Custom SQL Web Report...

    You will need to modify the Where command..

     

    Here is examples showing SQL to allow you to compare value between either previous or next records value in custompoller table.

    Again, you must change the where condition to make it work.

    -------------------------------------------------------

    -- Example 1: show how to display records before and after in table
    --
    SELECT
    --top 1
    DateTime,
    CustomPollerAssignmentID,

    COALESCE(p.RawStatus - (Lead(p.RawStatus) over (order by p.RawStatus desc)),0) AS rawdiff,

    -- use next 3 calculated fields for reference * NOT needed *
    lag(p.RawStatus) over (order by p.RawStatus desc) PreviousStatus,
    p.RawStatus,
    Lead(p.RawStatus) over (order by p.RawStatus desc) NextStatus
    --

    FROM [dbo].[CustomPollerStatistics] p
    Where CustomPollerAssignmentID = 'c23ac991-22e8-4df2-a5e9-6836ca84812c'

    -------------------------------------------------------

     

     

    example 2 - rewritten to show who to use JOIN command

    Solarwinds  tech Support does not support this sql script.

    But it will work!

    Save it to a Report Writer or Custom SQL Web Report...

    You will need to modify the Where command..

    -- ---------------------------------------------------------

     

    -- !SQL Custom Poller - Value - Previous Value Report
    SELECT TOP 1
    -- *
    cpav.CustomPollerName,
    n.caption as NodeName,
    cps.DateTime,
    COALESCE((Lead(cps.DateTime) over (order by cps.DateTime desc)),0) AS ChangefrPrevTime,
    rawstatus as CustomPollerValue,
    COALESCE(cps.RawStatus - (Lead(cps.RawStatus) over (order by cps.DateTime desc)),0) AS ChangefrPrev

    FROM CustomPollerAssignmentView as cpav
    inner join NodesData AS n
      on cpav.NodeID = n.NodeID
    inner join CustomPollerStatistics as cps
      on cps.CustomPollerAssignmentID  = cpav.CustomPollerAssignmentID
    --
    where cpav.CustomPollerName ='hrSystemUptime'
    --
    order by cps.DateTime Desc

     

    -- ---------------------------------------------------------