Skip to content

mabuelgh/DEVWKS-2486

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

DEVWKS-2486

Introduction & Context

Intersight is a tool to monitor and configure data center solutions such as UCS servers. Intersight collects metrics from servers and makes them available for viewing in the GUI or for use through the API.

Use cases for metric collection

Energy consumption in data centers is often a significant cost that is overlooked. This consumption may also be a factor for environmental impact. The administrator needs to determine the energy consumption of their environment IT administrator has noticed issues with a workload. The administrator must identify if this is a UCS networking problem. The administrator needs to verify the single/multiple links between the server and Fabric Interconnect, as well as between the Fabric Interconnect and upstream network With growing workloads there is also a demand for new infrastructure. To adapt to this demand, you may have to increase your UCS environment with a few more chassis. This will lead to increase traffic on the Fabric Interconnect uplinks. The administrator needs to determine if the current uplink capacity will be enough to handle the new infrastructure

During this workshop you'll use Intersight and automation to get metrics from UCS servers:

Please use the image hint below each step if you're stuck.


Explore Intersight GUI

  1. Go to Intersight, click on Sign-in with Cisco ID

    Image
  2. When asked, provide the following credentials:

    Reveal Mail
    DEVWKS2486+[YourTableNumber]@gmail.com
    
    Reveal Password
    
    
    Image

    You'll be redirected to the main Intersight interface.

  3. In the left panel, click on 'Operate', then select 'Servers'.

    Image
  4. Click on the server CSS-DCC1-1-1, look for the Metrics tab and select it.

    Image
  5. Take a look at the metrics fetched by Intersight.

    Image
    More details on the Data Collection Process (Optional)
  6. Look for the panel on the left side of the screen and click on Analyse, then Explorer.

    Image

    On the Metrics Explorer you'll be able to explore all the metrics gathered by Intersight from all devices and filter out of your preferences.

  7. In the Metrics panel, select the metric to fetch: Host Power and Status > Host Power > Average.

    Image
  8. A chart will appear according to the option selected on the Metric Panel.

    Image
  9. Scroll down to see the Raw Data fetched from the Time-Series in the Intersight OpenTelemetry API.

    Image
  10. Look for the Query Code tab. This is the JSON code send to the API to get the metrics.

    Image
  11. Copy the code from the curly bracket in line 2 until the penultimate line with a closing curly bracket.

    Click here to get JSON code instead
    {
        "queryType": "groupBy",
        "dataSource": "PhysicalEntities",
        "granularity": {
          "type": "period",
          "period": "PT10M",
          "timeZone": "Europe/Paris",
          "origin": "2025-02-02T11:01:00.000Z"
        },
        "intervals": [
          "2025-02-02T11:01:00.000Z/2025-02-03T11:01:00.000Z"
        ],
        "dimensions": [],
        "filter": {
          "type": "and",
          "fields": [
            {
              "type": "selector",
              "dimension": "instrument.name",
              "value": "hw.host"
            }
          ]
        },
        "aggregations": [
          {
            "type": "longSum",
            "name": "count",
            "fieldName": "hw.host.power_count"
          },
          {
            "type": "doubleSum",
            "name": "hw.host.power-Sum",
            "fieldName": "hw.host.power"
          },
          {
            "type": "thetaSketch",
            "name": "endpoint_count",
            "fieldName": "host.id"
          }
        ],
        "postAggregations": [
          {
            "type": "expression",
            "name": "hw-host-power-Avg",
            "expression": "(\"hw.host.power-Sum\" / \"count\")"
          }
        ]
      }
    

Use Intersight REST Client

  1. Now visit the REST Client natively integrated into Intersight with this URL. This portal allows you to view the Intersight API documentation and interact with it directly.

  2. With this client, you can interact with the Time Series by sending a POST request from the right panel.

    Image
  3. Paste the copied JSON from earlier on the POST panel and click on Send. You may be asked to log in again

    Image
  4. You can recognise the same information as the Raw Data from the GUI within the hw-host-power-Avg variable.

    Image

Export data to Grafana

Now, let's take it a step further and extract the data to use it in an observability tool such as Grafana. To do this we will use a tool installed in your computer Intersight-Metrics-Bridge. It will poll power metrics from Intersight, store them in InfluxDB, and display them in Grafana easily with containers. Your computer already has the necessary tools to make it work. Now launch a terminal in your computer.

  1. Go to the right directory:
cd ./Desktop/DEVWKS-2486/intersight-metrics-bridge
  1. The API Key is not embedded in your session, we need to extract the API Key and inventory file from internet. It's available from this remote repo, clone it with:
git clone https://github.com/mabuelgh/DEVWKS-2486-alt.git
  1. Replace the placeholder API Key and inventory file with the one copied in last step. The API Key is read-only access to the Intersight account from earlier. The inventory file contains a list of Serial Numbers to monitor. Use this command to use the files:
rm -f -r config && cp -f -r ./DEVWKS-2486-alt/config ./
  1. To make the Metrics-Brigde work, we need to set environment variables with the following python script (this project is using a Python virtual environment.)
../bin/python initial_setup.py
  1. Now that everything is ready, build the docker containers with the docker-compose command:
sudo docker-compose build --no-cache
  1. Wait a few minutes to have access to the terminal again and then start the containers.
sudo docker-compose up
  1. Don't close this terminal and open a new terminal tab to make sure you have 3 containers up and running with this command:
sudo docker ps
  1. Look for STATUS: Up for the three containers.

    Image
  2. Access the Grafana container created at 127.0.0.1:3000.

  3. The credentials are admin / password

  4. On the left panel, click on Dashboards and then select Cisco UCS Servers Power Usage Dashboard

    Image
  5. Watch the metrics get collected every minute.

    Image
  6. When everything done, please stop (Ctrl+C on the main terminal tab, multiple times) and delete the containers for the next workshops 😊

sudo docker rm -f intersight-metrics-bridge-influxdb intersight-metrics-bridge-grafana intersight-metrics-bridge-intersight-poller

Related information

Continue your Education
Webex App
Survey

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published