ahmedash95/laravel-uptime-monitor

强大的、易于配置的网站正常运行时间监控器

1.2.2 2017-01-06 15:17 UTC

README

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

Laravel-uptime-monitor是一个强大的、易于配置的网站正常运行时间监控器。当您的网站出现故障(以及恢复正常时),它会通知您。您还可以在您的网站上的SSL证书到期前几天收到通知。在底层,该软件包利用Laravel 5.3的通知,因此很容易使用Slack、Telegram或您首选的通知提供商。

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

如果您不熟悉Laravel,但仍然想使用我们的网站正常运行时间监控器,请查看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/v1上找到文档。它包括有关如何安装和使用该软件包的详细信息。

在使用该软件包时遇到困难?发现了bug?您有关于提高网站正常运行时间监控器的一般问题或建议?请随时在GitHub上创建问题,我们将尽快解决。

Postcardware

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

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

最好的明信片将被发布在我们网站的开源页面上。

更新日志

请参阅更新日志以获取有关最近更改的更多信息。

测试

要运行测试,您首先需要在单独的终端窗口中启动包含的基于node的服务器。

cd tests/server
./start_server.sh

服务器运行后,您就可以开始测试了。

vendor/bin/phpunit

贡献

请参阅CONTRIBUTING以获取详细信息。

安全性

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

致谢

关于Spatie

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

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。