"Rosetta Stone" for UCS Central Statistics

Document created by jesilber on Sep 19, 2013Last modified by jesilber on Oct 10, 2013
Version 4Show Document
  • View in full screen mode

Okay, let’s say you installed the UCS Central Stats DB Appliance and now want to talk to it.     First, you’d want to connect to it:


su – postgres

psql –d centralstats


 

Next, you might want to know are the “names” of the database tables that are available, which can be obtained from the “\dt” command:


centralstats=# \dt

                      List of relations

Schema |              Name               | Type  | Owner

--------+---------------------------------+-------+----------

public | adaptorHBAVnicStats             | table | postgres

public | adaptorNICVnicStats             | table | postgres

public | adaptorVnicStats                | table | postgres

public | affectedId2Dn                   | table | postgres

public | computeMbPowerStats             | table | postgres

public | computeMbTempStats              | table | postgres

public | equipmentChassisStats           | table | postgres

public | equipmentFanStats               | table | postgres

public | equipmentNetworkElementFanStats | table | postgres

public | etherRxStats                    | table | postgres

public | etherTxStats                    | table | postgres

public | fcStats                         | table | postgres

public | processorEnvStats               | table | postgres

(13 rows)

 

Most of the names are fairly intuitive.   “etherRxStats”, “etherTxStats”, and “fcStats”, are all with respect to the ports on the fabric interconnects.  This list will be extended in future UCS Central versions to include broader statistics coverage as well.  To display the columns for an individual table, you’ll have to quote the table “name”:

 

centralstats=# \d "computeMbTempStats"

Table "public.computeMbTempStats"

Column       |       Type        | Modifiers

-------------------+-------------------+-----------

affectedId        | integer           | not null

timeCollected     | bigint            | not null

timeRecorded      | bigint            | not null

clientId          | integer           | not null

recordType        | integer           | not null

fmTempSenIo       | double precision  | not null

fmTempSenIoAvg    | double precision  | not null

fmTempSenIoMax    | double precision  | not null

[...]

thresholded       | character varying | not null

update            | integer           | not null

Indexes:

"ucomputembtempstats" UNIQUE, btree ("affectedId", "clientId", "recordType", "timeRecorded")

"i-computeMbTempStats-affectedId" btree ("affectedId")

"i-computeMbTempStats-clientId" btree ("clientId")

"i-computeMbTempStats-recordType" btree ("recordType")

"i-computeMbTempStats-timeCollected" btree ("timeCollected")

"i-computeMbTempStats-timeRecorded" btree ("timeRecorded")

Foreign-key constraints:

"computeMbTempStats_affectedId_fkey" FOREIGN KEY ("affectedId") REFERENCES "affectedId2Dn"("affectedId")

 

Now armed with enough information to be dangerous, a simple query might look like this:

 

centralstats=# select "affectedId", "clientId", "timeCollected", "consumedPower"

                   from "computeMbPowerStats";


affectedId | clientId | timeCollected |  consumedPower

------------+----------+---------------+------------------

         12 |     1007 | 1373980665948 | 302.391998291016

         15 |     1007 | 1373980665817 | 76.4972991943359

         18 |     1007 | 1373980665880 |  37.209300994873

         19 |     1007 | 1373980665706 |                0

         20 |     1007 | 1373980665552 |                0

         21 |     1007 | 1373980665664 | 361.598999023438

         12 |     1007 | 1373980945914 | 251.460006713867

         15 |     1007 | 1373980945876 | 20.7604007720947

         18 |     1007 | 1373980945854 | 275.127014160156

 

 

But then how do you decode “affectedId” and “clientId”?

affectedId” has its own mapping table:

 

centralstats=# select * from "affectedId2Dn";

affectedId  |                                     dn                                                 | className                       |  contextClass

--------------+------------------------------------------------------------------+------------------------------+--------------

  1               | compute/sys-1007/chassis-1/stats                                 | equipmentChassisStat    | equipmentChassis

  2               | compute/sys-1007/rack-unit-2/board/cpu-1/env-stats    | processorEnvStats        | processorUnit

  3               | compute/sys-1007/rack-unit-1/board/cpu-2/env-stats    | processorEnvStats        | processorUnit

  4               | compute/sys-1007/rack-unit-1/board/cpu-1/env-stats    | processorEnvStats        | processorUnit

  5               | compute/sys-1007/rack-unit-2/board/cpu-2/env-stats    | processorEnvStats        | processorUnit

  6               | compute/sys-1007/chassis-1/blade-3/board/temp-stats | computeMbTempStats    | computeBoard

[. . .]

 

 

So you could use this relation to decode the output:

centralstats=# select "dn", "clientId", "timeCollected", "consumedPower"

                  from "computeMbPowerStats" a , "affectedId2Dn" b

                  where a."affectedId" = b."affectedId"

                  order by dn;


                          dn                                                               | clientId |    timeCollecte    |  consumedPower

---------------------------------------------------------------------+----------+-------------------+------------------

compute/sys-1007/chassis-1/blade-1/board/power-stats |     1007 | 1373980945914 | 251.460006713867

compute/sys-1007/chassis-1/blade-1/board/power-stats |     1007 | 1373980665948 | 302.391998291016

compute/sys-1007/chassis-1/blade-1/board/power-stats |     1007 | 1373981845909 | 99.5687026977539

compute/sys-1007/chassis-1/blade-2/board/power-stats |     1007 | 1373981845879 | 338.578002929688

compute/sys-1007/chassis-1/blade-2/board/power-stats |     1007 | 1373980665880 |  37.209300994873

compute/sys-1007/chassis-1/blade-2/board/power-stats |     1007 | 1373980945854 | 275.127014160156

compute/sys-1007/chassis-1/blade-3/board/power-stats |     1007 | 1373981845791 | 547.151977539062

compute/sys-1007/chassis-1/blade-3/board/power-stats |     1007 | 1373980945876 | 20.7604007720947

compute/sys-1007/chassis-1/blade-3/board/power-stats |     1007 | 1373980665817 | 76.4972991943359

 

 

clientId”, which you can see is embedded in the “dn”, refers to the UCS domain. For now, you need to query the UCS Central resource manager for this mapping.   From the CLI:

 

connect resource-mgr

scope domain-mgmt

show ucs-domain

    UCS System:

         ID       Name           Total Servers     Free Servers     Owner    Site       Mgmt IP

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

         1007   ucs3                4                        1                                                 10.0.0.16

         1008   ucs4                7                        7                                                 10.0.0.30

         1009   SFO                 8                        8                                                 10.0.0.248

         1010   AMS                8                        8                                                 10.0.0.250

 

 

Or you could use something like 'curl' to talk XML directly to the UCS Central resource-mgr for this:

 

UCSC="10.0.0.45"

USER="admin"

PASSWD="XXXXXXXX"

 

COOKIE=`curl -s -H "Content-Type: text/xml" -k -N \

         -d "<aaaLogin inName=$USER inPassword=$PASSWD />" \

         https://${UCSC}:443/xmlIM/resource-mgr | cut -d' ' -f10 | sed -e "s/outCookie=//"`

 

curl -s -H "Content-Type: text/xml" -k -N \

        -d "<configResolveClass cookie=$COOKIE classId=computeSystem />" \

        https://${UCSC}:443/xmlIM/resource-mgr  | \

        xmlstarlet sel -t -f -m //configResolveClass/outConfigs/computeSystem  \

               -v "concat('  ', @id,' ', @name, ' ', @address)" -n

 

curl -s -H "Content-Type: text/xml" -k -N \

        -d "<aaaLogout inCookie=$COOKIE />" \

        https://${UCSC}:443/xmlIM/resource-mgr > /dev/null

 

If you want a really good UCS-oriented primer on 'xmlstarlet', be sure to check out this great blog by John McDonough. 

 

So hopefully you now have better understanding of the objects and the mapping to employ <pick-your-favorite-reporting-tool> to take advantage of the new statistics support in UCS Central --- hopefully leading to better workload insight and better capacity planning.

 

 

Thanks,

 

       -Jeff

       @jsilberm

Attachments

    Outcomes