Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/20steps/uptime-robot-bundle
Symfony bundle for service-oriented client for UptimeRobot API v2.0
https://github.com/20steps/uptime-robot-bundle
httplug openapi swagger symfony uptime-robot-bundle uptimerobot uptimerobot-api
Last synced: 3 months ago
JSON representation
Symfony bundle for service-oriented client for UptimeRobot API v2.0
- Host: GitHub
- URL: https://github.com/20steps/uptime-robot-bundle
- Owner: 20steps
- License: lgpl-3.0
- Created: 2017-07-12T16:14:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-19T16:55:57.000Z (over 7 years ago)
- Last Synced: 2024-09-30T17:22:59.480Z (3 months ago)
- Topics: httplug, openapi, swagger, symfony, uptime-robot-bundle, uptimerobot, uptimerobot-api
- Language: PHP
- Homepage:
- Size: 46.9 KB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# 20steps/uptime-robot-bundle (twentystepsCommonsUptimeRobotBundle)
About
-----The 20steps UptimeRobot Bundle contains a service-oriented client for [**UptimeRobot**][2] API v2.0.
Use the bundle in scenarios where you want to automatically create monitors, alert contacts etc. at UptimeRobot.com for your given application or services or as part of your deployment process to automatically manage maintenance windows.
The Bundle is licensed under the [**LGPL license version 3.0**][4].
Installation
------------Prerequisites:
* Install [**Composer**][1], the dependency manager used by modern PHP applications.
* Setup your Symfony 3 based application
* Use PHP >= 7.0 as a runtime1. Add the bundle to your composer.json and download a matching version by calling
```bash
composer require 20steps/commons-uptime-robot-bundle
```2. Configure the API key of your account at UptimeRobot.com in your config.yml
```bash
twentysteps_commons_uptime_robot:
api_key: "Your API Key"
```Usage
-----The following code shows how to create a monitor with the client.
```
uptimeRobotAPI = $uptimeRobotAPI;
}
/**
* create a monitor
* @return \Psr\Http\Message\ResponseInterface|Error|Monitor
*/
public function createMonitorForMyResource() {
$parameters = [
'friendly_name' => 'My Monitor,
'url' => 'https://my-host.com/my-path'
];
$response = $this->uptimeRobotAPI->monitor()->create($parameters);
if ($response instanceof MonitorResponse) {
/**
* @var $response MonitorResponse
*/
if ($response->getStat()=='ok') {
return $response->getMonitor();
} else {
return $response->getError();
}
}
return $response;
}
}
```The bundle provides some useful commands below the twentysteps:commons:uptime-robot namespace.
Eg. to list all monitors and their stati simply call
```
bin/console twentysteps:commons:uptime-robot:monitor:list
```Hints
-----* In case your application uses multiple accounts at UptimeRobot you can dynamically change
the api key as follows```
uptimeRobotAPI->setApiKey($myApiKey);```
* Cp. section "parameters" of [**UptimeRobot API Documentation**][7] for an explanation of parameters.
* The UptimeRobot API has been enhanced by some extra utility methods such as api->monitor()->findOneByUrl(..), api->monitor->createOrUpdate(..), api->monitor->pauseByUrl(), api->monitor->resumeByUrl() etc.Authors
-------* Helmut Hoffer von Ankershoffen
Sponsored by
------------[**20steps - Digital Full Service Boutique**][3]
[1]: https://getcomposer.org/
[2]: https://uptimerobot.com/
[3]: https://20steps.de
[4]: http://www.gnu.org/licenses/lgpl-3.0.html
[5]: https://github.com/janephp/openapi
[6]: https://swagger.io/specification/
[7]: https://uptimerobot.com/api