We all dream of servers that need no maintenance at all. But unfortunately in reality this is not the case. Disks can get full, processes can crash, the server can run out of memory...
This package keeps an eye on the health of all your servers. There are a few checks that come out of the box. Adding new checks is a breeze.
When something goes wrong it can notify you via Slack or mail.
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
The full documentation is available on our documentation site.
You can install this package via composer using this command:
composer require spatie/laravel-server-monitor
In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework, you must install the service provider:
// config/app.php
'providers' => [
...
Spatie\ServerMonitor\ServerMonitorServiceProvider::class,
];
You can publish the migrations with:
php artisan vendor:publish --provider="Spatie\ServerMonitor\ServerMonitorServiceProvider" --tag="migrations"
After the migration has been published you can create the hosts
and checks
tables by running the migrations:
php artisan migrate
You must publish the config-file with:
php artisan vendor:publish --provider="Spatie\ServerMonitor\ServerMonitorServiceProvider" --tag="config"
This is the contents of the published config file:
return [
/*
* These are the checks that can be performed on your servers. You can add your own
* checks. The only requirement is that they should extend the
* `Spatie\ServerMonitor\Checks\CheckDefinitions\CheckDefinition` class.
*/
'checks' => [
'diskspace' => Spatie\ServerMonitor\CheckDefinitions\Diskspace::class,
'elasticsearch' => Spatie\ServerMonitor\CheckDefinitions\Elasticsearch::class,
'memcached' => Spatie\ServerMonitor\CheckDefinitions\Memcached::class,
'mysql' => Spatie\ServerMonitor\CheckDefinitions\MySql::class,
],
/*
* The performance of the package can be increased by allowing a high number
* of concurrent ssh connections. Set this to a lower value if you're
* getting weird errors running the check.
*/
'concurrent_ssh_connections' => 5,
/*
* This string will be appended to the ssh command generated by the package.
*/
'ssh_command_suffix' => '',
'notifications' => [
'notifications' => [
Spatie\ServerMonitor\Notifications\Notifications\CheckSucceeded::class => [],
Spatie\ServerMonitor\Notifications\Notifications\CheckRestored::class => ['slack'],
Spatie\ServerMonitor\Notifications\Notifications\CheckWarning::class => ['slack'],
Spatie\ServerMonitor\Notifications\Notifications\CheckFailed::class => ['slack'],
],
/*
* To avoid burying you in notifications, we'll only send one every given amount
* of minutes when a check keeps emitting warning or keeps failing.
*/
'throttle_failing_notifications_for_minutes' => 60,
'mail' => [
'to' => 'your@email.com',
],
'slack' => [
'webhook_url' => env('SERVER_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\ServerMonitor\Notifications\Notifiable::class,
/*
* The date format used in notifications.
*/
'date_format' => 'd/m/Y',
],
/*
* To add or modify behaviour to the `Check` model you can specify your
* own model here. The only requirement is that they should
* extend the `Check` model provided by this package.
*/
'check_model' => Spatie\ServerMonitor\Models\Check::class,
/*
* Right before running a check it's process will be given to this class. Here you
* can perform some last minute manipulations on it before it will
* actually be run.
*
* This class should implement Spatie\ServerMonitor\Manipulators\Manipulator
*/
'process_manipulator' => Spatie\ServerMonitor\Manipulators\Passthrough::class,
/*
* Thresholds for disk space's alert.
*/
'diskspace_percentage_threshold' => [
'warning' => 80,
'fail' => 90,
],
];
The package doesn't come with any screens out of the box. You may use the Nova package by @paras-malhotra for monitoring servers on Laravel Nova.
Please see CHANGELOG for more information what has changed recently.
To run the tests you'll have to start the included node based dummy ssh server first in a separate terminal window.
cd tests/server
npm install
./start_server.sh
With the server running, you can start testing.
vendor/bin/phpunit
Please see CONTRIBUTING for details.
If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker.
The code to execute commands on a remote server was copied from Envoy.
The MIT License (MIT). Please see License File for more information.
helm 实践 mysql The author selected the Diversity in Tech Fund to receive a donation as part of the Write for DOnations program. 作者选择了“技术多元化”基金来接受捐赠,这是Write for DOnations计划的一部分。 介绍 (Introduction) Larave
主库: 1.授权复制账号使用的用户REPLICATION SLAVE权限: GRANT REPLICATION SLAVE ON *.* to 'slaver'@'192.168.0.203' identified by 'cpf123456' 2.修改数据库配置文件my.cnf,开启binlog,并设置server-id的值 [mysqld] log-bin=mysql-bin #
一、 laravel结构 |– app 包含Controller、Model、路由等在内的应用目录,大部分业务将在该目录下进行 | |– Console 命令行程序目录 | | |– Commands 包含了用于命令行执行的类,可在该目录下自定义类 | | |– Kernel.php 命令调用内核文件,包含commands变量(命令清单,自定义的命令需加入
一、依赖注入 控制反转(Inversion of Control,缩写为IoC),是面向对象编程中的一种设计原则,可以用来减低计算机代码之间的耦合度。其中最常见的方式叫做依赖注入(Dependency Injection,简称DI),还有一种方式叫“依赖查找”(Dependency Lookup)。通过控制反转,对象在被创建的时候,由一个调控系统内所有对象的外界实体将其所依赖的对象的引用传递给它。
public/index.php require DIR.’/…/bootstrap/autoload.php’; 1、 定义 LARAVEL_START 初始时间常量 2、 require DIR.’/…/vendor/autoload.php’ 这个文件是 Composer 的 class loader , 此文件会注册 Laravel 中所有的 classes。这样我们就不用自己 inclu
在laravel中使用redis自带方法的时候会发现许多原生的方法都不存在了,laravel对其进行了重新的封装但是在文档中并没有找到相关的资料最后在 1\vendor\predis\predis\src\Profile\RedisProfile.php 发现许多方法名是被重写的,以下为所有重新定义的方法名 array(151) { ["EXISTS"]=> string(24) "Predis\
laravel的http请求入口是public目录下的index.php。 首先从这个文件进行分析,代码流程走完以后,会出一个逻辑流程图: <?php //定义LARAVEL_START常量 define('LARAVEL_START', microtime(true)); //使用composer的自动加载机制(后续分析自动加载是如何实现的) require __DIR__.'/../ve
Bot.php class Bot extends DuerosBot { public function __construct($postData = []) { parent::__construct($postData); // 日志配置 // $this->log = new \Baidu\Duer\Botsdk\Log([ // //日志存储路径 // 'path' => storag
Laravel Echo Server NodeJs server for Laravel Echo broadcasting with Socket.io. System Requirements The following are required to function properly. Laravel 5.3 Node 6.0+ Redis 3+ Additional informati
我采用larave 5.1框架,创建了自己的简单项目。它在localhost运行良好。 我尝试使用免费托管的live server(byethost.com-php版本) 我通过一些留档。所以我移动所有文件到public_html文件夹。然后将public_html/公共文件传输到public_html文件夹中。在index.php.中更改文件路径 即使我没有看到任何正确的输出。我是否需要任何附加
我不明白为什么我在尝试连接到私人频道时会遇到这个问题。我有这篇文章的100%相同的代码-无法使用laravel echo服务器、redis和socket对laravel专用频道进行身份验证。虽然带有redis前缀的io不起作用。。。它与简单通道一起工作。。。这是我的错误- 无法对客户端进行身份验证,已通过laravel echo服务器获取HTTP状态403 这是我的代码- 路线/channels.
我正在设置一个laravel-echo-server,当我试图验证到一个私有通道时,我得到了错误:客户端无法被验证,得到了HTTP状态404。 授权公共渠道工程。 //channels.php //前端脚本验证到私有通道 //拉威尔回声服务器。json //引导。js 简单地说,我的laravel echo是通过应用程序加载的。在public/js中的js,引导程序中的所有库。js被加载进来。好的
我最近一直在摆弄Laravel Echo和Laravel Echo服务器,Laravel Echo的socket.io服务器实现。 网络上的内容不多,我可能遗漏了一些要点。。 我可以从laravel-echo-server的cli中看到当用户加入或离开一个通道(在我的情况下是存在通道)。我有一个Laravel事件,它执行一些我想在用户离开存在通道时触发的数据库操作。我该如何实现这一点? 谢谢
我使用获得了和应用程序,我正在尝试通过套接字将前端连接到后端。 我已经通过方法,但它不会订阅 到目前为止,我得到的是: 页面加载后,我调用: 我通过 }); 然后我通过