These are the API calls for counting and deleting stale custom metric objects.
If you define a custom metric group monitoring a particular metric, you can send data to our Uptime Cloud Monitor from as many systems as you want. For eg. If we want to monitor MySQL metrics for 10 servers, we will use the same “Metric Group” and correspondingly 10 metric objects will be created, one for each server. Data samples will then be sent periodically to each of the 10 custom metric objects from the corresponding MySQL servers.
Even if these servers are no longer actively monitored, their data samples are still stored inside their corresponding custom metric objects in Uptime Cloud Monitor. You will not be billed for these data samples if the custom metric object is not active (i.e. for each month, billing happens only for the custom metric objects that are ‘alive’ and have incoming data samples during that month).
You might consider deleting ‘stale’ custom metric objects that no longer have incoming data samples so that they are no more visible on your UI (Custom -> Custom Objects). A “Stale” custom metric object for a time period is defined as that object for which no data/samples were received in that period. So, if we call an object as 6 months stale, that means no samples were received for that metric object since last 6 months. Such cleanup of stale custom metric objects also improves the performance of your site.
A simple API will get you count of your total custom metric objects vs. stale custom metric objects for a particular time period which is sent by you.
For eg, a sample request to delete custom metric objects older than 10 days would be :
Above request can also be reduced to skip months and years parameters because they are zero
For eg, a sample request to delete custom metric objects older than 6 months would be :
Above request can also be reduced to skip days and years parameters because they are zero