locked
Retrieving lots of performance counters from SCOM via SDK seems to be slow RRS feed

  • Question

  • Hi,

    We're trying to use the SCOM SDK (2007 at the moment, but moving to 2012, soon) to retrieve a lot of performance counter data from SOM, so we can correlate it with other data and visualize it. We're doing something like this:

                var criteria = new MonitoringPerformanceDataCriteria(
                    @"ObjectName = 'Memory' OR ObjectName = 'Processor' OR ObjectName = 'LogicalDisk' OR ObjectName = 'PhysicalDisk'");
    using (var reader = m_Group.GetMonitoringPerformanceDataReader(criteria)) { while (reader.Read()) { var perfData = reader.GetMonitoringPerformanceData(); using (var valueReader = perfData.GetValueReader(m_Start, m_End)) { while (valueReader.Read()) { var perfValue = valueReader.GetMonitoringPerformanceDataValue(); var metric = perfValue.ConvertToMetric(perfData); if (metric != null) { OnMetricRetrieved(metric); } } } } }

    The problem we're having is that this seems to be slow. To retrieve data for the last 60 seconds takes between 60 and 300 seconds depending on the criteria. Even if we only retrieve four categories we are getting back 6000+ counters and it takes 70+ seconds to retrieve the values. Is there a faster way of doing this? Would the data warehouse be suitable for this?

    Another problem is that a lot of counters haven't recorded a value in the time interval we're interested in, the last minute, say. Is there a way of querying only the counters that have recorded a value in a given time interval? It seems to be possible for events, but not for counters.

    Thanks a lot in advance for any help,

    Tilman

    Tuesday, January 29, 2013 6:00 PM

Answers

  • Hi Andreas,

    Our goal is to correlate the infrastructure data we collect via SCOM with business/application metrics. We decided we didn't want to collect the business/application metrics in SCOM, as we found the performance counters/events data model too restrictive. So we had to pull the data out of SCOM.

    Anyway, it looks like we got the DWH to work for us. This link helped a lot:

    http://technet.microsoft.com/en-us/library/gg508713.aspx

    We're now doing something like

    SELECT        *
    FROM        Perf.vPerfRaw AS vpr
    JOIN          dbo.vPerformanceRuleInstance AS vpri
    ON            vpr.PerformanceRuleInstanceRowId = vpri.PerformanceRuleInstanceRowId
    JOIN          dbo.vPerformanceRule AS vpr2
    ON             vpri.RuleRowId = vpr2.RuleRowId
    WHERE        DateTime > DATEADD(minute, -1, SYSDATETIME())
    ORDER BY    DateTime DESC

    Which gives us just the values that have changed, together with the instance data.

    It seems, this data is up to the minute. Don't know if that can be configured to be even more up to date?

    It's fast, too :)

    Thanks again for the help,

    Tilman


    • Marked as answer by Tilman3 Thursday, January 31, 2013 11:39 AM
    • Edited by Tilman3 Thursday, January 31, 2013 11:40 AM
    Thursday, January 31, 2013 11:39 AM

All replies

  • Well you are querying 6000+ counters as you said, I'd say the issue is your criteria. Why don't you refine it? Valid properties would be:
    Id
    MonitoringObjectId
    ClassId
    MonitoringObjectName
    MonitoringObjectDisplayName
    MonitoringObjectPath
    MonitoringObjectFullName
    RuleId
    InstanceName
    ObjectName
    CounterName
    HasSignature
    LearningRuleId
    LastSampledValue

    As for your last minute issue, counters aren't written every minute so you'd have to be lucky to grab one. Unfortunately the LastSampledValue property doesn't do anything in my experience, so that's not an option either.
    LastSampledValue can also be used in the criteria, maybe you could play around with that a bit

    What you have to keep in mind as well is that you have to use UTC when making calls as that's how performance data is stored: System.DateTime.UtcNow

    I'm currently working on pulling data from the DWH for a project I'm working on. Using the Operational Database for my purposes would affect performance quite a lot on it. Will let you know how that worked out.

    Wednesday, January 30, 2013 11:01 AM
  • Hi Andreas,

    Thanks for the reply.

    >Well you are querying 6000+ counters as you said, I'd say the issue is your criteria. Why don't you refine it?

    I guess i wasn't completely accurate, it's actually 6000+ instances, not counters. That's from these criteria

    "ObjectName = 'Memory' OR ObjectName = 'Processor' OR ObjectName = 'LogicalDisk' OR ObjectName = 'PhysicalDisk'"

    which, tbh, we hoped to expand on, rather than to restrict them further

    >As for your last minute issue, counters aren't written every minute so you'd have to be lucky to grab one.

    Doesn't that depend on how the rule is configured?

    >Unfortunately the LastSampledValue property doesn't do anything in my experience, so that's not an option either.
    LastSampledValue can also be used in the criteria, maybe you could play around with that a bit

    Yes, we had a look at that, too, but it didn't seem to do anything.

    I started looking at the DWH, now, and i managed to find some pretty up to date perf values, but i'm struggling to link them back counters.

    Wednesday, January 30, 2013 1:42 PM
  • May i ask what the ultimate goal is? I just don't see why you'd query all counters of these categories including their values at once.

    Wednesday, January 30, 2013 1:52 PM
  • Hi Andreas,

    Our goal is to correlate the infrastructure data we collect via SCOM with business/application metrics. We decided we didn't want to collect the business/application metrics in SCOM, as we found the performance counters/events data model too restrictive. So we had to pull the data out of SCOM.

    Anyway, it looks like we got the DWH to work for us. This link helped a lot:

    http://technet.microsoft.com/en-us/library/gg508713.aspx

    We're now doing something like

    SELECT        *
    FROM        Perf.vPerfRaw AS vpr
    JOIN          dbo.vPerformanceRuleInstance AS vpri
    ON            vpr.PerformanceRuleInstanceRowId = vpri.PerformanceRuleInstanceRowId
    JOIN          dbo.vPerformanceRule AS vpr2
    ON             vpri.RuleRowId = vpr2.RuleRowId
    WHERE        DateTime > DATEADD(minute, -1, SYSDATETIME())
    ORDER BY    DateTime DESC

    Which gives us just the values that have changed, together with the instance data.

    It seems, this data is up to the minute. Don't know if that can be configured to be even more up to date?

    It's fast, too :)

    Thanks again for the help,

    Tilman


    • Marked as answer by Tilman3 Thursday, January 31, 2013 11:39 AM
    • Edited by Tilman3 Thursday, January 31, 2013 11:40 AM
    Thursday, January 31, 2013 11:39 AM