bulk update polling intervals on datapoint
-
Hello-
Does anyone have any tips to update the polling cycle interval on datapoints? For example, would like to change all the datapoints from 15 minute interval to 5 minute interval. Taking the import/export might be difficult as we currently have over 2000 points in a system.
Regards,
Daniel
-
The import export would be the fastest, you can do find/replace all in a text editor just test out your find criteria so it does not overwrite other items. Also you say you have 2000 data points but the polling parameter can be changed per datasource in Mango UI.
-
I agree, import/export is the quickest and simplest, using a find-replace operation in any text editor.
Make sure that your text editor is set to plain text not rich text and save a copy of your exported JSON before you do the find-replace incase something goes wrong.
Also as btrombo says, make sure you match the whole string not just the digits, ie.:
Find: "intervalLoggingPeriod":15, Replace: "intervalLoggingPeriod":2,
(rather than find 15 and replace with 2)
-
I was looking for a more optimized way of loading the datapoints; perhaps through a CURL POST because trying to paste 2000 datapoints worth of data using a browser via the import/export can be slow.
-
1:stop the mango.
2:update you database use SQL.
3:start again. -
@djmolloyjr22 as @btrombo said you only need to update the Data Sources and not the data points. Just export the Data Sources and this will be a really easy and fast action.
-
The REST api has a feature that allows bulk updating of data points via a PUT of a JSON array, but this has not been rigorously tested and is still in Beta. Use at your own risk since not every type of data point has been verified to work. I would suggest making a backup of your database prior to testing your specific updates.
Here is the basic idea:
- Make a GET request to {YourMangoHost}/rest/v1/data-points to get all your data points as an Array in JSON format
- Edit your JSON
- Do a PUT request with the edited array of data points as the payload to {YourMangoHost}/rest/v1/data-points
Note that since the JSON structure for a Data Point in the REST API is different than the Mango JSON Export you cannot use one with the other.