Hi guys, i try to create amazon cloudwatch sensor by api request, but without success. I run this request https://myhostname.com/api/duplicateobject.htm?id=1&targetid=2&name=AWS_SENSOR&instance=i-XXXXXX and always get duplicated sensor with unchanged aws instance_id. I read documentation and these describe thats i can`t change instance_id on created aws cloudwatch sensor. How i can create aws cloudwatch sensor by api request with custom instance ID ?


Article Comments

Dear Roman

The new Amazon Cloudwatch sensors are device template capable.

In principle, you can use the API to change some sensor properties via

/api/setobjectproperty.htm

The full syntax is

/api/setobjectproperty.htm?id=<objid>&name=<property label>&value=<new value>

We don't provide a list of all possible &name= labels. However you can derive those from the HTML source of the input fields of the sensor option form. If the HTML shows a trailing underscore, please remove it when you use it in the API call as &name= property.

This only works for simple value types like numbers and strings. It is not advisable to attempt to change read-only values. If you want to experiment regardless, please backup your configuration by creating a copy of the PRTG Configuration.dat file.


Oct, 2015 - Permalink

Thanks guys, i successfully created my script. But i think prtg api is terrible. I need do lot of unnecessary steps for AWS cloudwatch sensor creation:

  • duplicate sensor
  • get new sensor id from redirect url
  • change sensor value by id
  • start sensor by id

Why i cant duplicate sensor, change it value and start it, by one api command ?


Oct, 2015 - Permalink

Dear Roman

The API was never intended to offer such complex operations. We focus mostly on the main input mode – the GUI.


Oct, 2015 - Permalink