GithubHelp home page GithubHelp logo

laravel-dependency-dev-it-cabo-ifpe / laravel-monitoring Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saeedvaziry/laravel-monitoring

0.0 0.0 0.0 1.37 MB

Monitor your Laravel servers

License: MIT License

Shell 0.49% JavaScript 2.11% PHP 53.72% CSS 0.09% Vue 41.88% Blade 1.71%

laravel-monitoring's Introduction

Laravel Monitoring

Monitor your Laravel applications server with a beautiful dashboard and get notified if anything gets wrong!

Supported OS

This package works only on Linux servers.

Installation

1) Install the latest version from composer

For PHP >= 8.1

composer require saeedvaziry/laravel-monitoring

For PHP <= 8.0

composer require saeedvaziry/laravel-monitoring "1.4.2"

2) Publish vendors

php artisan monitoring:publish

3) Run migrations

php artisan migrate

4) Set up a cronjob to collect data

* * * * * cd /path-to-your-project && php artisan monitoring:record

5) Visit /monitoring to see the statistics.

Configuration

You can find the configuration at config/monitoring.php.

Key Description
instance_name This is your current server's name, And the data will be collected under this name.
routes You can change the URL prefix of the monitoring dashboard. Also, You can protect the route by applying middlewares to it.
models If you want to customize the models, define yours and update this config.
chart_colors Chart colors are customizable by this config.
notifications Currently, we support Slack and Email channels for notifications. However, You can add your custom channels. To add a custom channel, Create a class and implement it by SaeedVaziry\Monitoring\Channels\Channel and then add the class to channels under the notifications item.

Multi-Server support

Sometimes your source code is deployed to multiple servers.

For example, You have multiple webservers with a load balancer and another server for your Backoffice.

In this case, you just need to set a unique name for MONITORING_INSTANCE_NAME environment variable on each server, Of course, assuming that you have one database in common with all the servers that you want to monitor.

The result will be similar to the Demo picture.

Command

You can use php artisan monitoring:record command to collect the data manually.

Facade

Add the bellow line to your config/app.php file, Under the allias:

'aliases' => [
    ...
    'Monitoring' => \SaeedVaziry\Monitoring\Facades\Monitoring::class
    ...
];

With this Facade you can access the server's resource usages.

Example usages:

Monitoring::cpu()->usage(); // returns CPU usage
Monitoring::memory()->usage(); // returns Memory usage
Monitoring::disk()->usage(); // returns Disk usage

Purge Records

Without purging, the monitoring_records table can accumulate records very quickly. To mitigate this, you should schedule the monitoring:purge Artisan command to run daily or any time you wish. You can also, Set the purge_before configuration at config/monitoring.php.

$schedule->command('monitoring:purge')->daily();

Contributing

Please feel free to submit an issue or open a PR.

Credits

License

Laravel Monitoring is open-sourced software and licensed under the MIT License (MIT).

laravel-monitoring's People

Contributors

saeedvaziry avatar stylecibot avatar abbasudo avatar

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.