serviceuptime/api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

serviceuptime/api

Composer 安装命令:

composer require serviceuptime/api

包简介

PHP Library for ServiceUptime.com API (https://www.serviceuptime.com/users/api-docs.php)

README 文档

README

PHP Library for ServiceUptime API (https://www.serviceuptime.com/users/api-docs.php)

Dependencies

PHP version >= 7 required.

The following PHP extensions are required:

  • curl

Install

Add ServiceUptime API to your composer.json file.

{
  "require": {
    "serviceuptime/api": "*"
  }
}

Examples

Initialize api

<?php
    $suapi = new \ServiceUptime\API\API('APIKEY');
?>

Add new monitor to your ServiceUptime account

<?php
    $monitor = $suapi->addMonitor([
		"Id" => "234342",
		"Name" => "domain.com",
		"CheckPeriod" => "5",
		"ServiceType" => "http",
		"Port" => "80",
		"HostName" => "domain.com",
		"HTTPAuthLogin" => "user1",
		"HTTPAuthPassword" => "pass123",
		"SendDefaultAlert" => "y",
		"SendAltAlert" => "domain.support@gmail.com;user.name@hotmail.com;tech@domain.com",
		"FailuresBeforeAlert" => "1",
		"SendDefaultSMS" => "n",
		"SendAltSMS" => "+11234567890;+10987654321",
		"FailuresBeforeSMS" => "3",
		"SendJabberAlert" => "n",
		"WebHookUrl" => "",
		"Timeout" => "15",
		"DownAlertSubject" => "Domain.com (http) is Down!",
		"UpAlertSubject" => "Domain.com (http) is Up!",
		"RepeatAlerts" => "0",
		"NoUpAlerts" => "n",
		"HighPriorityAlerts" => "y",
		"Enabled" => "y",
		"PublicStatAllowed" => "y",
		"HostPage" => "domain.com",
		"Status" => "active",
		"StatusMessage" => "Monitor is UP",
		"PubStatUrl" => "http://www.serviceuptime.com/users/uptimemonitoring.php?S=e4c9e21eb1222a4adb4a1da4cbc4a653&Id=234342",
		"LastCheckDate" => "2014-07-23 13:08:12",
		"LastCheckDateFormatted" => "34 sec. ago",
		"TotalChecks" => 909600,
		"TotalOutages" => 449,
		"TotalFailedChecks" => 921,
		"TotalUptime" => 99.899,
    ]);
    print_r($monitor);
?>

Edit monitor information

<?php
    $monitor = $suapi->updateMonitor([
		"Id" => "234342",
		"ServiceType" => "http",
		"Port" => "80",
    ]);
    print_r($monitor);
?>

Remove monitor from your ServiceUptime account

<?php
    $result = $suapi->deleteMonitor([
        "Id" => "234342",
    ]);
    print_r($result);
?>

Retrieve all your monitors information including uptime statistics summary and current status info

<?php
    $monitors = $suapi->getMonitors();
    print_r($monitors);
?>

Retrieve detailed uptime report for your monitor

<?php
    $report = $suapi->getReport([
        "Id" => "367168",
        "from_date" => "2019-11-01",
        "to_date" => "2019-11-07",
    ]);
    print_r($report);
?>

Retrieve one monitor information including uptime statistics summary and current status info

<?php
    $monitor = $suapi->monitorInfo([
        "Id" => "367168",
    ]);
    print_r($monitor);
?>

Start monitoring for a paused monitor

<?php
    $result = $suapi->startMonitor([
        "Id" => "367168",
    ]);
    print_r($result);
?>

Pause monitoring for a monitor

<?php
    $result = $suapi->stopMonitor([
        "Id" => "367168",
    ]);
    print_r($result);
?>

Retrieve account information such as number of SMS credits, available monitors, default email alert, etc.

<?php
    $account = $suapi->accountInfo();
    print_r($account);
?>

Documentation

License

The MIT License (MIT)

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固