Open solaceten opened 1 year ago
There is sadly no way to do this built-in. The API is also read-only so your only way to do this could be by having a PHP Script on Cron or NodeJS app that will check the UptimeRobot API status and create an incident in Server Status database directly, through MySQL.
If you would look into spending a bit more time and contribute, you could use the classes from the project and create a file inside the repo that could be setup to use uptimerobot if it is enabled in the config.
@Pryx would be of better help if you decide to write something yourself
I think implementing a write-enabled API would be the best way. Maybe with a simple user/pw authentication for starters.
I think implementing a write-enabled API would be the best way. Maybe with a simple user/pw authentication for starters.
Most likely but it's a big amount of change that may not be that easy to do. I also don't think anyone is active enough to do such major updates.
``I have an Idea: start with a request to login to your instance:
curl -X POST 'http://example/admin/' \
--header 'Accept: */*' \
--form 'email="<mail@example>"' \
--form 'pass="<password>"' -v
Get the Line Set-Cookie: Set-Cookie: PHPSESSID=<seesionid>; path=/
and strip out PHPSESSID=<sessionid>
.
then create an incident by:
curl -X POST \
'http://example/admin/?new=incident' \
--header 'Accept: */*' \
--header 'Cookie: PHPSESSID=<sessionid>' \
--form 'type="1"' \
--form 'title="title2"' \
--form 'text="test123"' \
--form 'services[]="1"'
further explanations:
possible values for type
are: 0 = "Major outage", 1 = "Minor outage", 2 = "Planned maintenance", 3 = "Operational"
possible values for services[]
are indexes starting with 1, for your exisiting services. If you have only one, 1
would be the correct value.
NOTE: if you want to add an incident of type=2, you need to submit additional form params
time
andend_time
using ISO 8601 Format. e.g.2023-03-12 12:00
. Value oftime
need to be beforeend_time
.NOTE 2: Since these features were not considered when creating the functions, there is no exception handling there. Do not test it in Production.
Hope this helps. i am currently working on PHP8 support, Maybe I can look into this after that. Should not be that hard to do this with one single request instead of using two.
Does this currently integrate with Uptime Robot's API ? https://uptimerobot.com/api/
If not - how could that be done ?