CPU Count SQL Query

Version 1

    Here is a query which you can use in a stored procedure or other method which counts the # of CPU's per node, and updates a custom property called "CPU_Count" with that number. You can set this up as a nightly job, and then use the CPU_Count field in alert triggers that depend on knowing the number of CPU's in each node.

     

    update nodes

    Set nodes.CPU_Count=c2.CPUCOunt

    from

    (select c1.NodeID, COUNT(c1.CPUIndex) as CPUCount

       from (select DISTINCT CPUMultiLoad.NodeID, CPUMultiLoad.CPUIndex

       from CPUMultiLoad) c1

       group by c1.NodeID ) c2

    where nodes.NodeID = c2.NodeID

     

    use SolarWindsOrion

     

    Select nodes.NodeID, nodes.CPU_Count from nodes 

    use SolarWindsOrion;

    update nodes

    Set nodes.CPU_Count=c2.CPUCOunt

    from

    (select c1.NodeID, COUNT(c1.CPUIndex) as CPUCount

       from (select DISTINCT CPUMultiLoad.NodeID, CPUMultiLoad.CPUIndex

       from CPUMultiLoad) c1

       group by c1.NodeID ) c2

    where nodes.NodeID = c2.NodeID

     

    use SolarWindsOrion

    Select nodes.NodeID, nodes.CPU_Count from nodes