This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Where is "No of CPUs" stored in the database?

Now that we are on Orion NPM 10.2.1 Orion shows "No of CPUs" in the Node Details resource on the node level view.  I am working on a report that will utilize that data and would like to know where that information is stored in the Orion database; I thought it would be in the Nodes table, either I was wrong or blind (either could be the case).

Thanks in advance for any help on this!

  • Hi,

    I am afraid this information is not stored in database directly but it is computed from table CPUMultiLoad_Detail. There are columns NodeID and CPUIndex - so number of distinct CPUIndex values for one NodeID is equal to number of CPUs on given node.

    Of course in order to get best performance it is good approach to get this information from last polled values for given NodeID.

  • I was afraid that is how it was being done.

    Would it be possible for you to provide me the query that is being used to generate this?

  • Hi,

    this query get number of CPUs for node with NodeID = 4:

    SELECT COUNT(DISTINCT CPUIndex) FROM CPUMultiLoad_Detail WITH(NOLOCK)
    WHERE
     NodeID = 4 AND TimeStampUTC = (SELECT MAX(TimeStampUTC) FROM CPUMultiLoad_Detail WITH(NOLOCK) WHERE NodeID = 4)

    It tries to get this information from last polled values on node. For common nodes number of CPUs is always constant so it should be normally no issue. If there were node with dynamic number of CPUs it is up to you how to compute, anyway last polled values should be considered to be valid. My query use CPUMultiLoad_Detail table which should be good enough. In theory correct query should use CPUMultiLoad view - but such query will be little bit slower - so again it is up to you. My version won't work only in situation when all data for given node from table CPUMultiLoad_Detail were removed.

    This query returns number of CPUs for all nodes. It doesnt use last polled values but it goes through all data (it is usually much more faster).
     
    SELECT NodeID, COUNT(DISTINCT CPUIndex) FROM CPUMultiLoad_Detail WITH(NOLOCK)
    GROUP BY
     NodeID

  • This is awesome, thank you so much!

  • FormerMember
    0 FormerMember in reply to byrona

    Hi Byron-

    Were you able to modify this to get a complete list of Nodes with their CPU count?  I cannot figure out how to inner join these with an existing report.

    Any help is appreciated! 

    Thanks,

    Mike

  • Here is what I was able to cobble together, let me know how this works out...

    SELECT N.Caption, COUNT(DISTINCT CPUIndex)

    FROM CPUMultiLoad_Detail CPU WITH(NOLOCK)

    JOIN Nodes N ON CPU.NodeID = N.NodeID

    GROUP BY

    N.Caption

    Order By

    N.Caption


    DISCLAIMER: I am not a SQL Guru, use this at your own risk.  emoticons_mischief.png

  • FormerMember
    0 FormerMember in reply to byrona

    You ROCK!  Works great, thanks Byron.