dev-master
9999999-devServer Monitor built with CakePHP 3
MIT
The Requires
The Development Requires
by Li
1.0.0
1.0.0.0Server Monitor built with CakePHP 3
MIT
The Requires
The Development Requires
by Li
Wallogit.com
2017 © Pedro Peláez
Server Monitor built with CakePHP 3
CakePHP 3 Plugin for Monitoring Server Stats, (*1)
To install the CakeServerMonitor plugin, you can use composer. From your application's ROOT directory (where composer.json file is located) run the following:, (*2)
composer require watchowl/cake-server-monitor, (*3)
You will need to add the following line to your application's config/bootstrap.php file:, (*4)
Plugin::load('Watchowl/CakeServerMonitor',['bootstrap' => true]);, (*5)
CakeServerMonitor currently supports notification via email. You can configure recipients' email addresses in your applications 'config/bootstrap.php' file using overwriting the CakeServerMonitor.email.recipients key:, (*6)
Configure::write(
'CakeServerMonitor.email.recipients',
['my-first-email@address.com','my-second-email@address.com']
);
The last step to make this work is to add a cron job. You can do so by adding a similar line as shown below to your system's crontab file. Do remember to update the path to your own project. The following cron job runs at 1 am every day, you can change it to your own preference., (*7)
* 1 * * * cd path && bin/cake monitor run, (*8)
CakeServerMonitor does provide some customisation options., (*9)
by default CakeServerMonitor uses the default profile to send an email. You can change it to your own preference using the CakeServerMonitor.email.profile key:, (*10)
Configure::write(
'CakeServerMonitor.email.profile',
'debug'
);
by default CakeServerMonitor checks following stats:, (*11)
Under the hood, each checker is actually a class under WatchOwl namespace. You can overwrite what checkers to run via the CakeServerMonitor.commands key:, (*12)
Configure::write(
'CakeServerMonitor.commands',
[
'disk_space' => 'WatchOwl\CakeServerMonitor\CommandDefinition\DiskSpace',
'mysql' => 'WatchOwl\CakeServerMonitor\CommandDefinition\MySql',
'nginx' => 'WatchOwl\CakeServerMonitor\CommandDefinition\Nginx',
'php5fpm' => 'WatchOwl\CakeServerMonitor\CommandDefinition\Php5Fpm',
]
);
You can remove any checkers above so it won't run., (*13)
As you might have already guessed, you can create your own checker to extend CakeServerMonitor's abilities. To do so, creates a class extends from WatchOwl\CakeServerMonitor\CommandDefinition\CommandDefinition abstract class and implement its defined abstract methods., (*14)
After that, add your own checker to the CakeServerMonitor.commands key as shown in previous section., (*15)
To view current server stats:, (*16)
bin/cake server_monitor view, (*17)
Server Monitor built with CakePHP 3
MIT
Server Monitor built with CakePHP 3
MIT