How to add a new check in Uptimerobot via API
Today I was thinking to automate the new addition of website check to our monitoring systems. Since we are using multiple providers for website monitoring, it is a headache to go to each portal and add the website to the portals.
So, I have decided to add a Jenkins key where a single click will add the website to all of our monitoring providers.
Recently we have added uptimerobot to our monitoring providers.
1. Get the Alert Contact ID from uptimerobot
You can run the below command to get the ID of your alter contacts
curl --data "api_key=u612113-XXXXXXXXXXXXXXXX" https://api.uptimerobot.com/v2/getAlertContacts
Copy the ID received from the output
2. Call the newMonitor API to add new check
Below is the command line argument to add a website to uptimerobot.com . You just need to replace the api_key on the below curl command.
curl --data "api_key=XXXXXXXXXXXXXX&alert_contacts=111111&friendly_name=test.com&url=http://test.com&type=1" https://api.uptimerobot.com/v2/newMonitor
api_key = get it from your uptimerobot account settings
alert_contacts = Get it from the step 1 output.
If everything went fine, You will reveive the following output.