Skip to content
adatum
  •  SCOM Web API
  • About adatum
Automation

Update: SCOM web API

  • 02/06/201715/11/2017
  • by Martin Ehrnst

Big updates:

I have made a lot of changes to the SCOM web API. As you can see from the picture above. Maintenance scheduling is added, which means you can create a new maintenance schedule in SCOM 2016. To the computer endpoints I have added the a possibility to get detailed information. This will list all related object to the server. Logical disks, network cards etc.

These are the API endpoints available at the moment:

Agents

RouteDescription
[GET] API/AgentsGets all agents
[GET] API/Agents/{id}Get a single agent

Alerts

RouteDescription
[GET] API/AlertsGets all open alerts
[GET] API/Alert/{id}Get a single alert
[PUT] API/AlertUpdate the specified alert with resolution state, TicketId
[GET] API/Alert/{ComputerName}Get all alert from specific computer, use IncClosed=true to include open and closed alerts

Computer

RouteDescription
[GET] API/Computer/WindowsGet all windows computers wit basic properties
[GET] API/Computer/Windows/{ComputerName}Get A single windows computers with basic properties
[GET] API/Computer/Windows/{ComputerName}/DetailedGet A single windows computers with hosted child objects
————
[GET] API/Computer/LinuxGet all Linux computers wit basic properties
[GET] API/Computer/Linux/{ComputerName}Get A single Linux computer with basic properties
[GET] API/Computer/Linux/{ComputerName}/DetailedGet A single Linux computers with hosted child objects

Maintenance

RouteDescription
[POST] API/ComputerMaintenancePut the specific computer object and all child in maintenance mode
[POST] API/ObjectMaintenancePut the specific monitoring object and all child in maintenance mode
[POST] API/MaintenanceScheduleCreate a new maintenance schedule. SCOM 2016 ONLY

Object

RouteDescription
[GET] API/MonitoringObject/{id}Get a monitoring object and all child object

 

Examples

Create a new maintenance schedule by sending a post to /API/MaintenanceSchedule with a body including object id, start date and end date in UTC, optionally a comment.

#CREATE A MAINTENANCE SCHEDULE WITH TWO OBJECTS. Time in UTC

$body = @"
{
  "scheduleName": "new maintenance schedule",
  "id": "a43a5b09-5c32-8624-1427-73b8e1f05248",
  "StartTime": "2017-05-30T13:53:33.550Z",
  "EndTime": "2017-05-30T14:53:33.550Z",
  "comment": "TicketID"
}
"@


Invoke-RestMethod -Uri 'http://localhost:64049/API/MaintenanceSchedule' -Method Post -Body $body -UseDefaultCredentials -ContentType 'Application/json'

Get details/related object from a computer:

Invoke-RestMethod -Uri 'https://host/API/Computer/windows/computer.fqdn/Detailed' -UseDefaultCredentials

Which will return something like this. Notice the relatedObjectsCount and relatedObjects

Share this:

  • LinkedIn
  • Twitter

Related

Web API for System Center Operations Manager
SCOM 2016 migration – Transfer alert Ticket ID
api Integrations OperationsManager OpsMgr SysCtr

Related articles

flight sky earth space
Recording available: ARM template deployment…
Remediate Azure Policy with PowerShell
IT Pro announcements from Microsoft…
SquaredUp free of charge for…
Multi subscription deployment with DevOps…
10 COMMENTS
  • omkaru umarani
    19/09/2019 at 17:27
    Reply

    Scheduled maintenance giving error bad request. it says parameter missing

    1. Martin Ehrnst
      20/09/2019 at 13:35
      Reply

      we got this covered here https://social.technet.microsoft.com/Forums/en-US/36cfaff5-0e5f-4447-8ace-2321b155c29a/scom-api-call-for-scom-2016-not-working?forum=operationsmanagerextensibility

  • Johannes Eriksson
    23/10/2017 at 14:01
    Reply

    Hi Martin! Great API, got it working fine in in our test.
    Now I am planning for production and have tested some scenarios with the API running on an seperate web server (interna publishing reasons).
    Last week it looked like it worked fine after editing web.config and to FQDN to the SCOM-server.
    But this week it doesn’t. Maybe I have mixed up the URL’s or something.
    Do you know if it is possible to run the API on a seperate maschine and what configuration needs to be done and firewall traffic needs to allowed

    1. Martin Ehrnst
      23/10/2017 at 14:29
      Reply

      Hi Johannes, there’s no reason for it to work last week and not this week, but in order to have a web server forwarding credentials delegation must be in place. I have not been able to do so my self using the end users credentials, and I belive something has to be done within the code to allow this.
      I did plan to implement this (hence the ability to change mangement server from IIS) but have not figured it out.

      Martin

  • Harish
    20/10/2017 at 21:52
    Reply

    Hey Martin! Thanks for a great API

    Need help in updating (acknowledged/inprogress )and closing the particular Alert. Please share the sample commands pls it would be greatful

    Thanks in advance

    1. Martin Ehrnst
      21/10/2017 at 14:03
      Reply

      Hi Harish, not that easy to show example from my phone. But in essence, you can chose whatever resolution state you want. 254 etc. 255 will close it

  • F
    26/09/2017 at 13:40
    Reply

    This is excellent work! 🙂
    I’ve looking for a solution to put alert into scom using REST. To generate an alert in SCOM for a specific class instance..
    Any thoughts of implementing that?
    to be able to integrate with other monitoring-tools or applications to generate directly into SCOM..

    1. Martin Ehrnst
      26/09/2017 at 13:42
      Reply

      That is a tricky one. Lots of consideration have to be made to do that. Unfortunately no immediate plan to implement, but I am happy if you want to look into it 😀

  • David Sjölund
    25/09/2017 at 14:22
    Reply

    Hey Martin! Thanks for a great API 🙂

    Any plans for implementing “End Maintenance Mode”?

    /Regards
    David

    1. Martin Ehrnst
      25/09/2017 at 14:23
      Reply

      Thank you David. I am glad you like it. Yes, there’s a plan, but unfortunately without an end date 😉

Engage by commenting Cancel reply

Top Posts & Pages

  • Azure AD authentication in Azure Functions
  • Creating Azure AD Application using Powershell
  • Multi subscription deployment with DevOps and Azure Lighthouse
  • Script to add SCOM agent management group
  • Remediate Azure Policy with PowerShell
  • Serverless application with PowerShell: Azure Functions
  • Working with Azure Monitor Rest API
  • Access to Blob storage using Managed Identity in Logic Apps - by Nadeem Ahamed
  • Resource health through Azure Rest API
  • SCOMpercentageCPUTimeCounter cause CPU Spike

Tags

agent announcements api ARM authoring Automation Azure AzureAD AzureFunctions AzureLighthouse AzureMonitor AzureSpringClean Bicep Community CSP database EventGrid ExpertsLive ExpertsLiveEU IaC Infrastructure as code Integrations LogAnalytics management pack monitoring MSIgnite MSIgnite2017 MSOMS MSP nicconf Nordic Virtual Summit OperationsManager OpsMgr Powershell QUickPublish rest SCDPM SCOM SCOM2016 SCVMM Serverless SquaredUP SysCtr system center Webasto

Follow Martin Ehrnst

  • Twitter
  • LinkedIn

RSS Feed RSS - Posts

RSS Feed RSS - Comments

Microsoft Azure MVP

Martin Ehrnst Microsoft Azure MVP

NiCE Active 365 Monitor for Azure

NiCE active 365 monitor for Azure
Adatum.no use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Cookie Policy
Theme by Colorlib Powered by WordPress