dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
584 stars 273 forks source link

MetricReports PowerMetrics #280

Closed downtownle closed 4 months ago

downtownle commented 5 months ago

R760 with latest idrac9 firmware. I try to get the total memory Power from this report but maybe i miss anythink before or any ideas to solve it?

I get no result at all curl -k -s -u DataCollector:1234567 https://192.168.0.102/redfish/v1/TelemetryService/MetricReports/PowerMetrics [192.168.0.102]

"Message": "Unable to complete the operation because the resource /redfish/v1/TelemetryService/MetricReports/PowerMetrics entered is not found."

How can I include the [%3cidrac-ip%3e] part in a curl request?

Best regards

texroemer commented 5 months ago

Hi @downtownle

Can you confirm iDRAC attribute "TelemetryPowerMetrics.1.EnableTelemetry" is set to Enabled.

See workflow example below where i repro the error you hit, i enabled the attribute and rerun get request, see data now for the metric report.

[root@SCPexport ~]# curl -k -u root:calvin -X GET 'https://192.168.0.120/redfish/v1/TelemetryService/MetricReports/PowerMetrics' -H "Content-Type: application/json" --insecure | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1600  100  1600    0     0   4610      0 --:--:-- --:--:-- --:--:--  4610
{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "MessageId": "IDRAC.2.2.SYS403",
        "MessageArgs": [
          "/redfish/v1/TelemetryService/MetricReports/PowerMetrics"
        ],
        "RelatedProperties": [],
        "Message": "Unable to complete the operation because the resource /redfish/v1/TelemetryService/MetricReports/PowerMetrics entered is not found.",
        "Severity": "Critical",
        "Resolution": "Enter the correct resource and retry the operation. For resources with numeric ID in the URI, enable the \"Redfish.1#NumericDynamicSegmentsEnable\" attribute and retry the operation. For information about valid resource, see the Redfish Users Guide available on the support site."
      },
      {
        "MessageId": "IDRAC.2.2.SYS522",
        "MessageArgs": [
          "PowerMetrics",
          "PowerMetrics"
        ],
        "RelatedProperties": [],
        "Message": "Unable to access the PowerMetrics Metric Report because the MetricReportDefinition PowerMetrics is either disabled or is not configured with LogToMetricReportsCollection.",
        "Severity": "Informational",
        "Resolution": "ConfigureMetricReportDefinition in the message with MetricReportDefinitionEnabled set totrue and LogToMetricReportsCollection included in the ReportActions list."
      },
      {
        "MessageId": "Base.1.12.1.ResourceMissingAtURI",
        "MessageArgs": [
          "/redfish/v1/TelemetryService/MetricReports/PowerMetrics"
        ],
        "RelatedProperties": [],
        "Message": "The resource at the URI '/redfish/v1/TelemetryService/MetricReports/PowerMetrics' was not found.",
        "Severity": "Critical",
        "Resolution": "Place a valid resource at the URI or correct the URI and resubmit the request."
      }
    ],
    "code": "Base.1.7.GeneralError",
    "message": "A general error has occurred. See ExtendedInfo for more information"
  }
}

[root@SCPexport ~]# curl -k -u root:calvin -X GET 'https://192.168.0.120/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/iDRAC.Embedded.1?$select=Attributes/TelemetryPowerMetrics.1.EnableTelemetry' -H "Content-Type: application/json" --insecure | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   287  100   287    0     0    241      0  0:00:01  0:00:01 --:--:--   241
{
  "@odata.context": "/redfish/v1/$metadata#DellAttributes.DellAttributes",
  "@odata.id": "/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/iDRAC.Embedded.1",
  "@odata.type": "#DellAttributes.v1_0_0.DellAttributes",
  "Attributes": {
    "TelemetryPowerMetrics.1.EnableTelemetry": "Disabled"
  }
}

[root@SCPexport ~]# curl -k -X PATCH -u root:calvin -H "Content-Type: application/json" 'https://192.168.0.120/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/iDRAC.Embedded.1' --insecure -d '{"Attributes": {"TelemetryPowerMetrics.1.EnableTelemetry": "Enabled"}}' -i
HTTP/1.1 200 OK
Date: Wed, 14 Feb 2024 16:14:05 GMT
Server: Apache
OData-Version: 4.0
Cache-Control: no-cache
X-Frame-Options: DENY
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Length: 506
Vary: Accept-Encoding
Content-Type: application/json;odata.metadata=minimal;charset=utf-8

{"@Message.ExtendedInfo":[{"Message":"The request completed successfully.","MessageArgs":[],"MessageArgs@odata.count":0,"MessageId":"Base.1.12.Success","RelatedProperties":[],"RelatedProperties@odata.count":0,"Resolution":"None","Severity":"OK"},{"Message":"The operation successfully completed.","MessageArgs":[],"MessageArgs@odata.count":0,"MessageId":"IDRAC.2.9.SYS413","RelatedProperties":[],"RelatedProperties@odata.count":0,"Resolution":"No response action is required.","Severity":"Informational"}]}

[root@SCPexport ~]# curl -k -u root:calvin -X GET 'https://192.168.0.120/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/iDRAC.Embedded.1?$select=Attributes/TelemetryPowerMetrics.1.EnableTelemetry' -H "Content-Type: application/json" --insecure | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   286  100   286    0     0    236      0  0:00:01  0:00:01 --:--:--   236
{
  "@odata.context": "/redfish/v1/$metadata#DellAttributes.DellAttributes",
  "@odata.id": "/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/iDRAC.Embedded.1",
  "@odata.type": "#DellAttributes.v1_0_0.DellAttributes",
  "Attributes": {
    "TelemetryPowerMetrics.1.EnableTelemetry": "Enabled"
  }
}

[root@SCPexport ~]# curl -k -u root:calvin -X GET 'https://192.168.0.120/redfish/v1/TelemetryService/MetricReports/PowerMetrics' -H "Content-Type: application/json" --insecure | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 40691    0 40691    0     0   114k      0 --:--:-- --:--:-- --:--:--  114k
{
  "@odata.type": "#MetricReport.v1_5_0.MetricReport",
  "@odata.context": "/redfish/v1/$metadata#MetricReport.MetricReport",
  "@odata.id": "/redfish/v1/TelemetryService/MetricReports/PowerMetrics",
  "Id": "PowerMetrics",
  "Name": "PowerMetrics Metric Report",
  "ReportSequence": "1",
  "Timestamp": "2024-02-14T16:14:10.936Z",
  "MetricReportDefinition": {
    "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/PowerMetrics"
  },
  "MetricValues": [
    {
      "MetricId": "TotalCPUPower",
      "Timestamp": "2024-02-14T16:13:12.521Z",
      "MetricValue": "213.0",
      "MetricProperty": "",
      "Oem": {
        "Dell": {
          "@odata.type": "#DellMetricReportValue.v1_0_1.DellMetricReportValue",
          "ContextID": "PowerMetrics",
          "Label": "PowerMetrics TotalCPUPower",
          "Source": "PowerMetrics",
          "FQDD": "PowerMetrics"
        }
      }
    },
    {
      "MetricId": "TotalCPUPower",
      "Timestamp": "2024-02-14T16:13:17.521Z",
      "MetricValue": "213.0",
      "MetricProperty": "",
      "Oem": {
        "Dell": {
          "@odata.type": "#DellMetricReportValue.v1_0_1.DellMetricReportValue",
          "ContextID": "PowerMetrics",
          "Label": "PowerMetrics TotalCPUPower",
          "Source": "PowerMetrics",
          "FQDD": "PowerMetrics"
        }
      }
    },
    {
      "MetricId": "TotalCPUPower",
      "Timestamp": "2024-02-14T16:13:22.521Z",
      "MetricValue": "213.0",
      "MetricProperty": "",
      "Oem": {
        "Dell": {
          "@odata.type": "#DellMetricReportValue.v1_0_1.DellMetricReportValue",
          "ContextID": "PowerMetrics",
          "Label": "PowerMetrics TotalCPUPower",
          "Source": "PowerMetrics",
          "FQDD": "PowerMetrics"
        }
      }
    },
    {
      "MetricId": "TotalCPUPower",
      "Timestamp": "2024-02-14T16:13:27.521Z",
      "MetricValue": "213.0",
      "MetricProperty": "",
      "Oem": {
        "Dell": {
          "@odata.type": "#DellMetricReportValue.v1_0_1.DellMetricReportValue",
          "ContextID": "PowerMetrics",
          "Label": "PowerMetrics TotalCPUPower",
          "Source": "PowerMetrics",
          "FQDD": "PowerMetrics"
        }
      }
    }

Thanks Tex

downtownle commented 5 months ago

Thanks i take a look but you got also the total memory power is that right? "MetricId": "TotalMemoryPower",

texroemer commented 5 months ago

Yes the power metric report will also contain total memory power. Just realized the example i pasted the output was cut off. I attached the full output for the power metric report from my server. power_metrics_output_example.txt