Giter Site home page Giter Site logo

cake-server-monitor's Introduction

CakeServerMonitor

CakePHP 3 Plugin for Monitoring Server Stats

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:

    composer require watchowl/cake-server-monitor

  • You will need to add the following line to your application's config/bootstrap.php file:

    Plugin::load('Watchowl/CakeServerMonitor',['bootstrap' => true]);

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:

Configure::write(
    'CakeServerMonitor.email.recipients',
    ['[email protected]','[email protected]']
);

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.

* 1 * * * cd path && bin/cake monitor run

Customisation

CakeServerMonitor does provide some customisation options.

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

Configure::write(
    'CakeServerMonitor.email.profile',
    'debug'
);
  • Changing checking stats

by default CakeServerMonitor checks following stats:

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

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.

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

After that, add your own checker to the CakeServerMonitor.commands key as shown in previous section.

Helper methods

To view current server stats:

bin/cake server_monitor view

cake-server-monitor's People

Contributors

curtisgibby avatar watchowl avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cake-server-monitor's Issues

license issue

Please note that a missing license file makes this code not usable - at all.
Not in open source, nor otherwise.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.