locked
SCOM 1801 REST API - Retrieve Performance Data RRS feed

  • Question

  • Hi,

    Anyone have an example of the “Retrieve Performance Data” API call?

    Friday, May 4, 2018 10:26 AM

Answers

All replies

  • Hey Aevalov,

    hope you find this helpful.

    https://github.com/KhwajaTahaHasanAnsari/System-Center-Operations-Manager-API

    regards,

    Taha

    Friday, May 4, 2018 10:47 AM
  • Taha, thanks, however I mean REST API built-in in SCOM 1801.
    Friday, May 4, 2018 11:07 AM
  • Hi There,

    <<<Anyone have an example of the “Retrieve Performance Data” API call?>>>

    I dont know SCOM 1801 have this REST API built in feature to retrieve performance data. Even REST API is using for dashboards. And SCOM is using WMI quires to collect performance data and if you want to collect this perf data with REST API then you need to you a custom script which has been already provided by Taha.


    Cheers, Gourav Please remember to mark the replies as answers if it helped.

    Friday, May 4, 2018 12:46 PM
  • Friday, May 4, 2018 2:49 PM
  • Hey,

    please take a look at the link Vladimir posted, this should be what you are looking for. 

    Please mark his answer accordingly if this helped indeed. Big thanks in advance!

    Regards,


    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Monday, May 7, 2018 8:48 AM
  • Did you manage to find out how to do it?

    Anyhow, I got it to work using this in powershell:

    You need the guid of the computer that you want to query.

    # Authentication
    $scomHeaders = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
    $scomHeaders.Add(‘Content-Type’,’application/json; charset=utf-8')

    $bodyraw = “Windows”
    $Bytes = [System.Text.Encoding]::UTF8.GetBytes($bodyraw)
    $EncodedText =[Convert]::ToBase64String($Bytes)
    $jsonbody = $EncodedText | ConvertTo-Json

    $uriBase = 'http://xxxxxx/OperationsManager/authenticate'
    $auth = Invoke-RestMethod -Method POST -Uri $uriBase -Headers $scomheaders -body $jsonbody -UseDefaultCredentials -SessionVariable websession

    # Duration in minutes


    $Query = @"
    {
      "duration": "60",
      "id": "<--- Guid goes here --->",
      "performanceCounters":
      [
      {
        "objectname":  "Health Service",
        "countername":  "Active File Uploads",
        "instancename":  "",
        "objectname":  "Processor Information",
        "countername":  "% Processor Time",
        "instancename":  "_Total"
    }
      ]

    }
    "@

    $Response = Invoke-WebRequest http://xxxxxx/OperationsManager/data/performance -Method Post -Body $query -WebSession $websession

       
    • Edited by DavveLazyDog Wednesday, December 19, 2018 2:25 PM
    Tuesday, October 16, 2018 3:26 PM