Unfortunately I can't see the difference between our two data sets, besides the obvious. I also get different error messages if I set the uid or datapoints to something I know is wrong. FYI I'm doing this with a zenoss 5 instance.
Subject: |
RE: API call to addThreshold in Zenoss 5 |
Author: |
Alastair Drong |
Posted: |
2017-05-16 15:20 |
Hm. Thanks. I noted that you've got a 'type':'rpc' in your call, but that didn't make a difference when I added it to mine. What is the full version number on Zenoss that you're running? I'm on Zenoss 5.2.2 r331. If you're on newer, I'll be curious to read through any release notes to see if maybe this was a bug that's been fixed.
Subject: |
RE: API call to addThreshold in Zenoss 5 |
Author: |
Alastair Drong |
Posted: |
2017-05-16 16:32 |
Can you tell me how you identified your 'datapoints' path? I was successful when I realized that I was missing '/datapoints/TestUptime' from the end of my 'dataPoints' value. This is what the complete JSON text should look like.
{
"action": "TemplateRouter",
"tid": 1,
"data": [
{
"thresholdId": "2_YEAR_UPTIME",
"thresholdType": "MinMaxThreshold",
"uid": "/zport/dmd/Devices/Server/Linux/rrdTemplates/TestUptime",
"dataPoints": [
"/zport/dmd/Devices/Server/Linux/rrdTemplates/TestUptime/datasources/TestUptimeDS/datapoints/TestUptimeDS"
]
}
],
"method": "addThreshold"
}
Subject: |
RE: API call to addThreshold in Zenoss 5 |
Author: |
Jay Stanley |
Posted: |
2017-05-16 17:28 |
datapoints is a relationship to datasource. You can get the full uid from zendmd or using developer tools and looking at the calls the UI makes when doing certain actions.
The Web UI uses the JSON API 100%. So, if you are ever trying to figure out how to do something with the API, pull up developer tools and see what headers are sent to the router.
Here is an example of me adding a threshold, then adding datapoints.


------------------------------
jstanley
------------------------------
Subject: |
RE: API call to addThreshold in Zenoss 5 |
Author: |
Alastair Drong |
Posted: |
2017-05-18 13:55 |
Extremely helpful. Thanks!
Alastair,
Could you try adding "type":"rpc" to your post data and see if that works? That's the only thing I can see in my data that isn't in yours. Let me know how it goes.
Ron
Subject: |
RE: API call to addThreshold in Zenoss 5 |
Author: |
Ron Phillips |
Posted: |
2017-05-17 12:04 |
I should have checked here rather than sending it from the email digest. Like
jstanley mentioned; try to add it through the UI with your browser's developer tools open, then check the post data sent to the template router and compare it to what you're trying to use.------------------------------
Ron Phillips
Senior Staff Engineer
Zenoss
------------------------------