cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding a remote host via API (Remote unix monitor (extensions 2.0))

Hi, there

Is it possible to add a remote host via API with extensions 2.0 (Remote Unix monitor)?Remote unix monitor - add remote host.jpg

Regards,

Srikanth

12 REPLIES 12

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

Yes, but you need to play with this API, and maybe, some scripting to develop your own solution.

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

Yosi_Neuman
DynaMight Guru
DynaMight Guru

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 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

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

 

Hi @SrikanthSamraj 

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 

Yosi_Neuman_0-1724337900034.png

HTH

Yos 

 

 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

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

@SrikanthSamraj 

Just tested it 

Yosi_Neuman_0-1724343671086.png

And it works like a charm! 

Yosi_Neuman_1-1724343697642.png

And a new entry was added 

Yosi_Neuman_2-1724343750995.png

And there is also PUT for updates

Yosi_Neuman_3-1724343789936.png

HTH

Yos 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

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?

 

Put is working as well for updating 

Yosi_Neuman_0-1724357197905.png

Yosi_Neuman_2-1724357381041.png

 

Yosi_Neuman_1-1724357226277.png

Go a head @SrikanthSamraj and try it your self 

Yos 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

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. PUT config.jpgPUT config output.jpg

Hi @SrikanthSamraj 

Lest say you have only 2 hosts on one of your configuration and you want to add another host 

Yosi_Neuman_8-1724403436037.png

What you can do is copy one endpoint from your current setting 

Yosi_Neuman_4-1724403162812.png

And duplicate it then change what you need (name, port etc...) at the new entry 

Yosi_Neuman_5-1724403271109.png

Execute the PUT API and validate that the response is 200

Yosi_Neuman_6-1724403356494.png

Now you have 3 hosts

Yosi_Neuman_7-1724403399270.png

Hope now you have more confident in dynatrace API and you are all set 

Good luck !

Yos 

 

 

 

 

 

 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

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

Hi @SrikanthSamraj 

Just to make it more manageable json wise, I would split the configurations to few entries 

Yosi_Neuman_0-1724404987185.png

But its up to you

All the best and stay safe

Yos 

dynatrace certificated professional - dynatrace master partner - Matrix Soft Ware Division - Israel

Featured Posts