Hi Everyone,
I'm having some trouble understanding how to map an ObjectId with an EntityId... or am I not thinking about this correctly? Here is the context: I'm trying to programmatically enable/disable monitoring or changing the monitoring mode on various hosts. I'm quite familiar with the APIs used for getting things, but I'm only beginning to look at the Settings API. It looks like the Settings API works with ObjectIds, but retrieving hosts gives you EntityIds. So, I can locate the hosts I want to manipulate, but ... I can't map it to the objectId that contains the settings I want to update.
Am I going about this all wrong? Am I crazy to approach it this way??
Thanks in advance,
Jeff.
Solved! Go to Solution.
If you're talking about the "/api/v2/settings/objects?schemaIds=builtin:host.monitoring" endpoint, then It seems that the items' ObjectID is base64-encoded bitmap-style object that includes the Entity name in it. I'm not sure about the full encoded payload, but if you remove the first 12 bytes and last 8 bytes, you'd get a TLV schemed data.
An example from the tenant "umsaywsjuo":
ObjectId: vu9U3hXa3q0AAAABABdidWlsdGluOmhvc3QubW9uaXRvcmluZwAESE9TVAAQRjk5REE0RUUwQjAwRjkyRQAkOGNmNDZlMzAtYTcxNC0zMzYzLWE0MzgtNmI2Y2JjODJhNjAxvu9U3hXa3q0
Base64 decoded value: \xBE\xEFT\xDE\x15\xDA\xDE\xAD\x00\x00\x00\x01\x00\x17builtin:host.monitoring\x00\x04HOST\x00\x10F99DA4EE0B00F92E\x00$8cf46e30-a714-3363-a438-6b6cbc82a601\xBE\xEFT\xDE\x15\xDA\xDE\xAD
Extracted TLV values:
- builtin:host.monitoring
- HOST
- F99DA4EE0B00F92E
- 8cf46e30-a714-3363-a438-6b6cbc82a601
Looking at the Entities in the mentioned domain it seems to add up: https://umsaywsjuo.dev.dynatracelabs.com/ui/entity/HOST-F99DA4EE0B00F92E
Wow thanks I did not know about decomposing the ObjectIds into extracted values... this is really helpful thanks! I'll check this out and reply back for everyone's benefit if they were experiencing the same question I have.
Please let me know if the solution helped you and if so, please accept the answer as a solution as well 🙂 Cheers!
Sorry for the delayed response! We've been very busy with other priorities so I haven't had a chance to verify but on very preliminary tests, this looks extremely promising and accurate. I will accept the solution once I've been able to verify, which I'm trying to carve out some time in my schedule to do.
Hi having some issues with my python script decoding the base-64 object, just figured out that I needed to pad the objectId to get it to decode properly. Just returned from the holidays so I'm back working on it.
I've accepted the solution as I have tested the above and am able to break down the objectId into it's components, thus able to correlate that with an entity name. What is still to be resolved is why none of the settings objects returned in the get all settings object call does not match even a single one of the hosts I want to disable. I gather that is another question to ask .
Featured Posts