2017 © Pedro Peláez
 

cakephp-plugin cake-server-monitor

Server Monitor built with CakePHP 3

image

watchowl/cake-server-monitor

Server Monitor built with CakePHP 3

  • Sunday, June 10, 2018
  • by watchowl
  • Repository
  • 0 Watchers
  • 2 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

CakeServerMonitor

CakePHP 3 Plugin for Monitoring Server Stats, (*1)

Installation

  • 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)

Notification

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']
);

Scheduling task

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)

Customisation

CakeServerMonitor does provide some customisation options., (*9)

  • Changing email profile

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'
);
  • Changing checking stats

by default CakeServerMonitor checks following stats:, (*11)

  • Disk Space
  • MySql Process
  • Nginx Process
  • Php5Fpm Process

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)

  • Creating your own checker

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)

Helper methods

To view current server stats:, (*16)

bin/cake server_monitor view, (*17)

The Versions

10/06 2018

dev-master

9999999-dev

Server Monitor built with CakePHP 3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Li

30/10 2017

1.0.0

1.0.0.0

Server Monitor built with CakePHP 3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Li