codeinwp/laravel-uptime-monitor

uptime 监控 SaaS 服务。基于 spatie/laravel-uptime-monitor

3.2.1 2018-01-22 09:51 UTC

README

Latest Version on Packagist Software License Build Status Quality Score StyleCI Total Downloads

Laravel-uptime-monitor 是一个强大、易于配置的 uptime 监控工具。当您的网站宕机(以及恢复时)会向您发送通知。您还可以在您的网站的 SSL 证书到期前几天收到通知。在底层,该软件包利用 Laravel 原生的通知功能,因此使用 Slack、Telegram 或您首选的通知提供者非常简单。

您可以在 https://docs.spatie.be/laravel-uptime-monitor 上找到详细的文档。它包括如何安装和使用该软件包的详细信息。

如果您不熟悉 Laravel,但仍然想使用我们的 uptime 监控工具,请查看 uptime-monitor-app 存储库,其中包含此软件包的独立版本。

阅读此软件包的配置文件是快速了解 laravel-uptime-monitor 可以做什么的好方法。以下是配置文件的内容

return [

    /*
     * You can get notified when specific events occur. Out of the box you can use 'mail'
     * and 'slack'. Of course you can also specify your own notification classes.
     */
    'notifications' => [

        'notifications' => [
            \Spatie\UptimeMonitor\Notifications\Notifications\UptimeCheckFailed::class => ['slack'],
            \Spatie\UptimeMonitor\Notifications\Notifications\UptimeCheckRecovered::class => ['slack'],
            \Spatie\UptimeMonitor\Notifications\Notifications\UptimeCheckSucceeded::class => [],

            \Spatie\UptimeMonitor\Notifications\Notifications\CertificateCheckFailed::class => ['slack'],
            \Spatie\UptimeMonitor\Notifications\Notifications\CertificateExpiresSoon::class => ['slack'],
            \Spatie\UptimeMonitor\Notifications\Notifications\CertificateCheckSucceeded::class => [],
        ],

        /*
         * The location from where you are running this Laravel application. This location will be 
         * mentioned in all notifications that will be sent.
         */
        'location' => '',

        /*
         * To keep reminding you that an uptime check failed, notifications
         * will be resent every given number of minutes.
         */
        'resend_uptime_check_failed_notification_every_minutes' => 60,

        'mail' => [
            'to' => 'your@email.com',
        ],

        'slack' => [
            'webhook_url' => env('UPTIME_MONITOR_SLACK_WEBHOOK_URL'),
        ],

        /*
         * Here you can specify the notifiable to which the notifications should be sent. The default
         * notifiable will use the variables specified in this config file.
         */
        'notifiable' => \Spatie\UptimeMonitor\Notifications\Notifiable::class,
        
        /**
         * The date format used in notifications.
         */
        'date_format' => 'd/m/Y',
    ],

    'uptime_check' => [
        /*
         * When the uptime check could reach the url of a monitor it will pass the response to this class
         * If this class determines the response is valid, the uptime check will be regarded as succeeded.
         *
         * You can use any implementation of Spatie\UptimeMonitor\Helpers\UptimeResponseCheckers\UptimeResponseChecker here.
         */
        'response_checker' => Spatie\UptimeMonitor\Helpers\UptimeResponseCheckers\LookForStringChecker::class,
            
        /*
         * An uptime check will be performed if the last check was performed more than the
         * given number of minutes ago. If you change this setting you have to manually
         * update the `uptime_check_interval_in_minutes` value of your existing monitors.
         *
         * When an the uptime check failed we'll check the uptime every time `monitor:check-uptime` runs
         * regardless of this setting.
         */
        'run_interval_in_minutes' => 5,

        /*
         * To speed up the uptime checking process uptime monitor can perform the uptime check of several
         * monitors concurrently. Set this to a lower value if you're getting weird errors
         * running the uptime check.
         */
        'concurrent_checks' => 10,

        /*
         * The uptime check will fail if the configured url does not respond after the
         * given number of seconds.
         */
        'timeout_per_site' => 10,

        /*
         * Fire `Spatie\UptimeMonitor\Events\MonitorFailed` event only after
         * the given number of uptime checks have consecutively failed for a monitor.
         */
        'fire_monitor_failed_event_after_consecutive_failures' => 2,

        /*
         * When reaching out to sites this user agent will be used.
         */
        'user_agent' => 'spatie/laravel-uptime-monitor uptime checker',
        
        /*
         * When reaching out to the sites these headers will be added.
         */
        'additional_headers' => []
    ],

    'certificate_check' => [

        /*
         * The `Spatie\UptimeMonitor\Events\SslExpiresSoon` event will fire
         * when a certificate is found whose expiration date is in
         * the next number of given days.
         */
        'fire_expiring_soon_event_if_certificate_expires_within_days' => 10,
    ],

    /*
     * To add or modify behaviour to the Monitor model you can specify your
     * own model here. The only requirement is that it should extend
     * `Spatie\UptimeMonitor\Models\Monitor`.
     */
     'monitor_model' => Spatie\UptimeMonitor\Models\Monitor::class,
];

API

目前此软件包不提供 API,如果您需要,请查看 此软件包

文档

您可以在 https://docs.spatie.be/laravel-uptime-monitor 上找到文档。它包括如何安装和使用软件包的详细信息。

在使用软件包时遇到困难?发现了一个错误?您有关于改进 uptime 监控的一般性问题或建议吗?请随时在 GitHub 上 创建一个问题,我们将尽快解决。

变更日志

请参阅 CHANGELOG 了解最近的变化。

测试

要运行测试,请执行以下命令

vendor/bin/phpunit

贡献

请参阅 CONTRIBUTING 获取详细信息。

安全

如果您发现任何与安全相关的问题,请通过电子邮件 freek@spatie.be 而不是使用问题跟踪器。

Postcardware

您可以使用此软件包,但如果它进入您的生产环境,我们非常希望您能从您的家乡寄给我们一张明信片,说明您正在使用我们的哪个软件包。

我们的地址是:Spatie,Samberstraat 69D,2060 安特卫普,比利时。

我们将发布所有收到的明信片 在我们的公司网站上

致谢

支持我们

Spatie 是一家位于比利时安特卫普的网络设计公司。您可以在我们的网站上找到我们所有开源项目的概述 在这里

您的业务依赖于我们的贡献吗?请联系我们并在 Patreon 上支持我们。所有承诺都将专门用于分配人力以维护和新奇事物。

许可证

MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件