<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to create an OS Service Monitor on a specific host via the API. in Open Q&amp;A</title>
    <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-create-an-OS-Service-Monitor-on-a-specific-host-via-the/m-p/211818#M26186</link>
    <description>&lt;P&gt;I want to create a monitor for a specific Windows service running on a specific VM, and I want to do it through the API.&amp;nbsp; Reasons are reusability and scale; we implement new customers regularly and must set up this monitoring manually.&amp;nbsp; I want to automate it.&lt;/P&gt;
&lt;P&gt;I am able to retrieve a list of OS Service Monitor from the&amp;nbsp;&lt;SPAN&gt;/api/v2/settings/objects endpoint, passing&amp;nbsp;schemaIds=builtin:os-services-monitoring on the querystring and it returns the list of objects I expect.&amp;nbsp; However, the individual entries in the list do NOT include any information as to what host the monitor runs on:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;        {
            "objectId": "vu9U3hXa3q0AAAABAB5idWlsdGluOm9zLXNlcnZpY2VzLW1vbml0b3JpbmcABEhPU1QAEDE3Njk2OEE2NEE3ODg3NkUAJGQ4NWU4ODE0LTJmN2MtM2UwZC1hMzYwLTMwMWMzZTY2NTQ5ZL7vVN4V2t6t",
            "value": {
                "enabled": true,
                "system": "WINDOWS",
                "name": "Production SERVICENAME",
                "monitoring": false,
                "alerting": true,
                "notInstalledAlerting": false,
                "statusConditionWindows": "$not($eq(running))",
                "alertActivationDuration": 30,
                "detectionConditionsWindows": [
                    {
                        "property": "ServiceName",
                        "condition": "$eq(SERVICENAME)"
                    }
                ],
                "metadata": []
            }
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am able to add an OS Service Monitor with a POST to the same endpoint.&amp;nbsp; I get a 200 response, and if I do a subsequent GET, I see the new OS Service Monitory in the list.&amp;nbsp; But it's not associated with a specific host/VM.&lt;/P&gt;
&lt;P&gt;The API documentation doesn't appear to address this:&amp;nbsp;&lt;STRONG&gt;How do I create an OS Service Monitor via this endpoint and specify the VM where the service to be monitored is running?&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 May 2023 19:41:07 GMT</pubDate>
    <dc:creator>DuaneRoelands</dc:creator>
    <dc:date>2023-05-10T19:41:07Z</dc:date>
    <item>
      <title>How to create an OS Service Monitor on a specific host via the API.</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-create-an-OS-Service-Monitor-on-a-specific-host-via-the/m-p/211818#M26186</link>
      <description>&lt;P&gt;I want to create a monitor for a specific Windows service running on a specific VM, and I want to do it through the API.&amp;nbsp; Reasons are reusability and scale; we implement new customers regularly and must set up this monitoring manually.&amp;nbsp; I want to automate it.&lt;/P&gt;
&lt;P&gt;I am able to retrieve a list of OS Service Monitor from the&amp;nbsp;&lt;SPAN&gt;/api/v2/settings/objects endpoint, passing&amp;nbsp;schemaIds=builtin:os-services-monitoring on the querystring and it returns the list of objects I expect.&amp;nbsp; However, the individual entries in the list do NOT include any information as to what host the monitor runs on:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;        {
            "objectId": "vu9U3hXa3q0AAAABAB5idWlsdGluOm9zLXNlcnZpY2VzLW1vbml0b3JpbmcABEhPU1QAEDE3Njk2OEE2NEE3ODg3NkUAJGQ4NWU4ODE0LTJmN2MtM2UwZC1hMzYwLTMwMWMzZTY2NTQ5ZL7vVN4V2t6t",
            "value": {
                "enabled": true,
                "system": "WINDOWS",
                "name": "Production SERVICENAME",
                "monitoring": false,
                "alerting": true,
                "notInstalledAlerting": false,
                "statusConditionWindows": "$not($eq(running))",
                "alertActivationDuration": 30,
                "detectionConditionsWindows": [
                    {
                        "property": "ServiceName",
                        "condition": "$eq(SERVICENAME)"
                    }
                ],
                "metadata": []
            }
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am able to add an OS Service Monitor with a POST to the same endpoint.&amp;nbsp; I get a 200 response, and if I do a subsequent GET, I see the new OS Service Monitory in the list.&amp;nbsp; But it's not associated with a specific host/VM.&lt;/P&gt;
&lt;P&gt;The API documentation doesn't appear to address this:&amp;nbsp;&lt;STRONG&gt;How do I create an OS Service Monitor via this endpoint and specify the VM where the service to be monitored is running?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 19:41:07 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-create-an-OS-Service-Monitor-on-a-specific-host-via-the/m-p/211818#M26186</guid>
      <dc:creator>DuaneRoelands</dc:creator>
      <dc:date>2023-05-10T19:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an OS Service Monitor on a specific host via the API.</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/How-to-create-an-OS-Service-Monitor-on-a-specific-host-via-the/m-p/211942#M26217</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/42547"&gt;@DuaneRoelands&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you can use the scope to be retrieved in the fields and you will be able to get the host Id&lt;/P&gt;&lt;P&gt;/api/v2/settings/objects?schemaIds=builtin:os-services-monitoring&amp;amp;fields=objectId,value,scope&lt;/P&gt;&lt;P&gt;the default values are objectId and value&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mohamed_Hamdy_0-1683889204504.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/11631i11B5B8B0F7ECBE65/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mohamed_Hamdy_0-1683889204504.png" alt="Mohamed_Hamdy_0-1683889204504.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and to POST OS service to a specific host you can add the host id same as the following sample:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;[&lt;BR /&gt;{&lt;BR /&gt;"schemaId": "builtin:os-services-monitoring",&lt;BR /&gt;"scope": "HOST-",&lt;BR /&gt;"value": {&lt;BR /&gt;"enabled": true,&lt;BR /&gt;"system": "WINDOWS",&lt;BR /&gt;"name": "Production SERVICENAME",&lt;BR /&gt;"monitoring": false,&lt;BR /&gt;"alerting": true,&lt;BR /&gt;"notInstalledAlerting": false,&lt;BR /&gt;"statusConditionWindows": "$not($eq(running))",&lt;BR /&gt;"alertActivationDuration": 30,&lt;BR /&gt;"detectionConditionsWindows": [&lt;BR /&gt;{&lt;BR /&gt;"property": "ServiceName",&lt;BR /&gt;"condition": "$eq(SERVICENAME)"&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"metadata": []&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 11:01:36 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/How-to-create-an-OS-Service-Monitor-on-a-specific-host-via-the/m-p/211942#M26217</guid>
      <dc:creator>Mohamed_Hamdy</dc:creator>
      <dc:date>2023-05-12T11:01:36Z</dc:date>
    </item>
  </channel>
</rss>

