示例#1
0
 /**
  * @covers UptimeRobot::newMonitor
  */
 public function testNewMonitor()
 {
     $newMonitor = $this->object->newMonitor("Google", 'https://google.com', 1);
     $this->assertNotEquals(null, $newMonitor);
     static::$newMonitorId = $newMonitor->monitor->id;
 }
示例#2
0
$upRobot = new UptimeRobot();
$upRobot::configure('YOUR-API-KEY', 1);
$upRobot->setFormat('json');
//Define the format of responses (json or xml)
/**
 * Get monitors
 */
$upRobot->getMonitors();
//Get all monitors
$upRobot->getMonitors(00);
//Get one monitor by her id
$upRobot->getMonitors($monitors = 00, $customUptimeRatio = array('1', '7'), $logs = 0, $responseTimes = 1, $responseTimesAverage = 180, $alertContacts = 1, $showMonitorAlertContacts = 1, $showTimezone = 1);
/**
 * New monitor
 */
$upRobot->newMonitor("Google", 'https://google.com', 1);
//Monitor URL
$upRobot->newMonitor("The W of Wikipedia", 'http://fr.wikipedia.org', 2, null, null, 2, 'W');
//Check word on a page
$upRobot->newMonitor("Ping DNS of Google", '8.8.8.8', 3);
//Ping IP
$upRobot->newMonitor("Check custom port", 'exemple.com', 4, 99, 22);
//Check custom port
$upRobot->newMonitor('Watchful.li', 'https://watchful.li', $type = 1, $subType = 2, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null);
//All parameters
/**
 * Edit monitor
 */
$upRobot->editMonitor($monitorId = 00, $monitorStatus = null, $friendlyName = 'Edit name of monitor');
//Edit name
$upRobot->editMonitor($monitorId = 00, $monitorStatus = null, $friendlyName = null, $URL = null, $subType = 99, $port = 25);