Closed bornakke closed 3 years ago
Have you tried passing grace_seconds
to payload, It's an optional field.
Documented here - https://cronitor.io/docs/monitor-api
Example -
import cronitor
monitors = cronitor.Monitor.put(
{
'type': 'job',
'grace_seconds': 5000,
'key': 'send-customer-invoices',
'schedule': '0 0 * * *',
'assertions': [
'metric.duration < 5 min'
],
'notify': ['devops-alerts-slack']
},
{
'type': 'synthetic',
'grace_seconds': 5000,
'key': 'Orders Api Uptime',
'schedule': 'every 45 seconds',
'assertions': [
'response.code = 200',
'response.time < 1.5s',
'response.json "open_orders" < 2000'
]
}
)
I haven't tested this, but based on API docs, It should work.
Thank you for your quick suggestion. I tried a number of different ways but without luck:
monitor = cronitor.Monitor.put([{'schedule': '0 /3 ','grace_seconds':10001,'notify': ['somescraper_notification'], 'key': monitor_title, 'type': 'job'}])
Hi @bornakke, thanks for opening this issue. You're right about the documentation being a little sparse right now. I'm actually working on the new version of these API docs this week, and plan to launch them early next week.
You should be able to set grace_seconds using the top level key as you have done in the example above. I'll consider this a bug report that that is not working, and will take a look at that now.
@bornakke after taking a look at this I realized that your monitors all had grace_seconds correctly set, but we were not displaying that correctly on the dashboard (grace_seconds moved in the data model as part of the most recent API updates).
We've deployed a fix for that, and you should now see the grace_seconds displaying correctly on your dashboard.
Hi Cronitorio,
We are using your product on several servers. However we are struggling with the lack and error prune documentation in the python package.
Currently we run the following code which are working: monitor = cronitor.Monitor.put([{'schedule': '0 /3 ', 'notify': ['somescraper_notification'], 'key': monitor_title, 'type': 'job'}])
However we wish to add a grace_periode of 5000 sec to the specific put. How to do that?
Best regards, Tobias