VMware Cloud Community
fduranti
Hot Shot
Hot Shot

Programmatically adding Resource to EP Ops Adapter via Api

I'm trying without any success to add a ICMP resource to an EP Ops Adapter via suite API on vrops 6.7.

I'm not sure if it's possible but if anyone have an example it will be really appreciated Smiley Happy

I get 2 different behaviour:

1- Trying to do a push to https://vrops/suite-api/api/adapters/uuidoftheadapters/ I get a 405 error

<!doctype html><html lang="en"><head><title>HTTP Status 405 – Method Not Allowed</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 405 – Method Not Allowed</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> Request method &#39;POST&#39; not supported</p><p><b>Description</b> The method received in the request-line is known by the origin server but not supported by the target resource.</p><hr class="line" /><h3>Apache Tomcat/8.5.28</h3></body></html>

2 - If I try to push data to https://vrops/suite-api/api/adapters/  (as I've saw on some bluemedora examples i found here GitHub - BlueMedoraPublic/vrops-api-example: Example usage of the VMware vRealize Operations Manager...  ) i get a 500 error

{

    "message": "Internal Server error, cause unknown.",

    "moreInformation": [

        {

            "name": "errorMessage",

            "value": "Failed to create AI resource: localizedMessage=Could not create AI on vRealize Operations Manager Collector-ITNAPVROPS08 collector. Because collector already has EP Ops Adapter adapter., code=0"

        },

        {

            "name": "localizedMessage",

            "value": "Failed to create AI resource. Could not create AI on vRealize Operations Manager Collector-ITNAPVROPS08 collector. Because collector already has EP Ops Adapter adapter.;"

        }

    ],

    "httpStatusCode": 500,

    "apiErrorCode": 500

}

Any help will be really appreciated as I've to create a high number of object and it will be a really long job Smiley Happy

Tags (2)
Reply
0 Kudos
1 Reply
fduranti
Hot Shot
Hot Shot

I was finally able to create a resource from api.

I was using the wrong api.

Now using https://vrops/suite-api/api/resources/adapters/{adapterInstanceId}

I've manually created a EPOPS check for a multiprocess and copied all the information from it changing only the value i need (name, process, etc) and used that api. I had to link it to a server I've created the resource and all work correctly.

        {

            "description": "",

            "creationTime": null,

            "resourceKey": {

                "name": "Process2",

                "adapterKindKey": "EP Ops Adapter",

                "resourceKindKey": "MultiProcess",

                "resourceIdentifiers": [

                    {

                        "identifierType": {

                            "name": "agentID",

                            "dataType": "STRING",

                            "isPartOfUniqueness": false

                        },

                        "value": "1507276270024-7264808974254094315-4931884540213599268"

                    },

                    {

                        "identifierType": {

                            "name": "discoveryMode",

                            "dataType": "STRING",

                            "isPartOfUniqueness": false

                        },

                        "value": "MANUAL"

                    },

                    {

                        "identifierType": {

                            "name": "monitoredResourceID",

                            "dataType": "STRING",

                            "isPartOfUniqueness": true

                        },

                        "value": "Process2"

                    },

                    {

                        "identifierType": {

                            "name": "Override_agent_configuration_data",

                            "dataType": "STRING",

                            "isPartOfUniqueness": false

                        },

                        "value": "0"

                    },

                    {

                        "identifierType": {

                            "name": "parentID",

                            "dataType": "STRING",

                            "isPartOfUniqueness": true

                        },

                        "value": "|1507276270024-7264808974254094315-4931884540213599268"

                    },

                    {

                        "identifierType": {

                            "name": "process.query",

                            "dataType": "STRING",

                            "isPartOfUniqueness": false

                        },

                        "value": "State.Name.eq=bash"

                    }

                ]

            },

            "resourceStatusStates": [],

            "resourceHealth": null,

            "resourceHealthValue": 100,

            "dtEnabled": true,

            "monitoringInterval": 5,

            "badges": [ ],

            "relatedResources": [],

            "links": [],

            "identifier": null

        },

Reply
0 Kudos