承接 bpmconcept/ping-this 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

bpmconcept/ping-this

Composer 安装命令:

composer require bpmconcept/ping-this

包简介

PingThis is a lightweight PHP 8.3+ toolkit that lets you compose headless monitoring checks and route actionable alerts with just a bit of code.

README 文档

README

CI

PingThis is a lightweight PHP 8.3+ toolkit that lets you compose headless monitoring checks and route actionable alerts with just a bit of code.

Example

use PingThis\Daemon;
use PingThis\Alarm\PhpEmailAlarm;
use PingThis\Ping\NetworkPing;
use PingThis\Ping\WebScraperPing;
use PingThis\Ping\DatabasePing;
use PingThis\Ping\TlsCertificateExpirationPing;

$daemon = new Daemon();

// Check if the host correctly answers to ping every 10 seconds
$daemon->registerPing(new NetworkPing(10, 'domain.com'));

// Check if a webserver responds correctly to a HTTP request every 30 seconds
$daemon->registerPing(new WebScraperPing(30, 'GET', 'https://domain.com', 'response.getStatusCode() == 200'));
$daemon->registerPing(new WebScraperPing(30, 'GET', 'https://domain.com', 'content.filter(".css").count()'));

// Or equivalently using any PHP callable
$daemon->registerPing(new WebScraperPing(30, 'GET', 'https://domain.com', function ($response, $content) {
    return $response->getStatus() < 400 && $content->filter('.element')->text() === "Hello";
}));

// Check every day that a certificate won't expire during the next week
$daemon->registerPing(new TlsCertificateExpirationPing(86400, 'domain.com', 443, TlsCertificateExpirationPing::IMPLICIT_TLS, '+7 days'));

// Check if a remote SQL server is still up every 10 seconds
$daemon->registerPing(new DatabasePing(10, 'mysql:host=my.sql.server', 'login', 'password'));

// Otherwise send an email to alert an admin
$daemon->registerAlarm(new PhpEmailAlarm('your@email.com'));

$daemon->run();

Quick description

PingThis aims to provide a simple and effective way for monitoring whatever you want. Configure a daemon with one Alarm and one or multiple Pings. The Daemon periodically verifies each Ping and, in case of failing, triggers the Alarm. Any class could act like an Alarm or a Ping, provided that it implements respectively the AlarmInterface or the PingInterface.

The different built-in Pings rely on Symfony's Expression Language Component to allow a quick and easy construction of triggering logic but can be equivalently replaced by a PHP callable.

Built-in Pings

Network

Name Description
NetworkPing Sends a standard ICMP ping and checks the ICMP response (needs CAP_NET_RAW)
StreamSocketCommandPing Sends a custom payload through a TCP/UDP/Unix socket and checks the response
TlsCertificateExpirationPing Initiates a TLS handshake and checks the expiration date of a certificate
SnmpGetValuePing Gets SNMP object value from a remote SNMP agent
SnmpWalkValuePing Gets SNMP object values from a remote SNMP agent
SnmpDiskUsagePing Walks SNMP storage metrics and checks disk usage against a threshold

Web

Name Description
HttpPing Sends a HTTP request and checks only the returned code
WebScraperPing Sends a HTTP request and get back a Response, along with a Crawler instance
WhoisDomainExpirationPing Queries WHOIS to ensure a domain expiration date stays beyond a threshold

Mails

Name Description
ImapServerPing Connects to a IMAP server and checks the welcome response
SmtpServerPing Connects to a SMTP server and checks the welcome response
MilterPing Simulates an SMTP conversation with a Milter server and validates its actions

Services

Name Description
DatabasePing Establishes a connection to a database using PDO
DatabaseQueryPing Executes a SQL query on a database using PDO
LdapSearchPing Executes a query on a LDAP server and checks the response

Built-in Alarms

Name Description
PhpEmailAlarm Send an email, using the PHP's mail() function
StreamAlarm Logs the alarms events to a given open stream (stdout or file for instance)
LogAlarm Specialized StreamAlarm for files that adds a lock on the log file
ParallelAlarm Dispatch the alert on multiple other Alarm instances

Installation

The recommended way to install PingThis is through Composer :

composer require bpmconcept/ping-this

PingThis does not intend to provide a fully functional daemon out of the box. You are still responsible for writing a configured daemon like in the previous example.

bpmconcept/ping-this 适用场景与选型建议

bpmconcept/ping-this 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 57 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 bpmconcept/ping-this 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bpmconcept/ping-this 我们能提供哪些服务?
定制开发 / 二次开发

基于 bpmconcept/ping-this 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-12