21 Aug 2024 08:29 AM
Hi, there
Is it possible to add a remote host via API with extensions 2.0 (Remote Unix monitor)?
Regards,
Srikanth
21 Aug 2024 12:11 PM - edited 21 Aug 2024 12:11 PM
Hi,
Yes, but you need to play with this API, and maybe, some scripting to develop your own solution.
Best regards
22 Aug 2024 01:22 PM
Hi @SrikanthSamraj & @AntonPineiro
IMO Extensions 2.0 API - POST a monitoring configuration is what your are looking for (i.e. create a new monitoring configuration for the specified Extensions 2.0 extension.)
HTH
Yos
22 Aug 2024 01:51 PM - edited 22 Aug 2024 01:53 PM
Hi @Yosi_Neuman - Thanks for your response. I've tried this option, but the challenge is getting JSON payload ready when server count is more than 100. I've attempted the crude way of manipulating JSON payload by manual edits but later that turned out to be a very cumbersome. Any tricks to handle it?
Also, it would be great if we have an option to add remote hosts to existing monitoring configuration. Sad to this see feature missing in extensions 2.0, when it is available in extensions 1.0 to add endpoints via API.
Regards,
Srikanth Samraj
22 Aug 2024 03:46 PM
Not sure what you meant by json of more than 100 hosts.
IMO you can copy the json from the UI and just change it each time before you running the API with some kind of automation
HTH
Yos
22 Aug 2024 04:52 PM
Hi @Yosi_Neuman
I did attempt this way, but I guess it would overwrite existing one when new remote host is added. Or am I wrong? Can this API take updates? Requirement here is, I want additional hosts to be added in same environment configuration.
Regards,
Srikanth
22 Aug 2024 05:23 PM
Just tested it
And it works like a charm!
And a new entry was added
And there is also PUT for updates
HTH
Yos
22 Aug 2024 05:27 PM
Great, @Yosi_Neuman.
However, looking at your screen shots, it seems like new monitoring configuration rather than amending existing monitoring configuration. Or my understanding is wrong?
22 Aug 2024 09:09 PM - edited 22 Aug 2024 09:11 PM
Put is working as well for updating
Go a head @SrikanthSamraj and try it your self
Yos
23 Aug 2024 07:43 AM - edited 23 Aug 2024 07:45 AM
Thanks @Yosi_Neuman . I did attempt it now, yes, it working fine but the problem I sense is when updates are made to include new host, existing configurations are overwritten.
Use case: I've manually added 10 hosts to a monitoring configuration and if I have to take the API route to include additional hosts, usage of PUT is overriding existing remote hosts.
Question: How do I add additional hosts without overriding current ones? This must be achieved in the same monitoring configuration not the new one. 
23 Aug 2024 10:01 AM
Lest say you have only 2 hosts on one of your configuration and you want to add another host
What you can do is copy one endpoint from your current setting
And duplicate it then change what you need (name, port etc...) at the new entry
Execute the PUT API and validate that the response is 200
Now you have 3 hosts
Hope now you have more confident in dynatrace API and you are all set
Good luck !
Yos
23 Aug 2024 10:09 AM
Hi, @Yosi_Neuman - Thanks for your crystal-clear updates.
Unfortunately, I did try this option, it comes handy when host count is less than 10 but if I have 100+ hosts to add, there are very good chances of making errors during copy/paste in JSON payload that's been fed to PUT call.
Hope, you understand what I'm trying to explain here.
For some reason, I badly miss the feature of adding endpoints via API like in extensions 1.0
Regards,
Srikanth
23 Aug 2024 10:23 AM
Just to make it more manageable json wise, I would split the configurations to few entries
But its up to you
All the best and stay safe
Yos