Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate with Uptime Robot #171

Open
solaceten opened this issue Feb 15, 2023 · 4 comments
Open

integrate with Uptime Robot #171

solaceten opened this issue Feb 15, 2023 · 4 comments
Assignees

Comments

@solaceten
Copy link

Does this currently integrate with Uptime Robot's API ? https://uptimerobot.com/api/

If not - how could that be done ?

@yigitkerem
Copy link
Member

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

@Steffen-MLR
Copy link
Contributor

I think implementing a write-enabled API would be the best way. Maybe with a simple user/pw authentication for starters.

@yigitkerem
Copy link
Member

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.

@Steffen-MLR
Copy link
Contributor

Steffen-MLR commented Mar 12, 2023

``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 and end_time using ISO 8601 Format. e.g. 2023-03-12 12:00. Value of time need to be before end_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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants