PHP Classes

Laravel Uptime Monitor: Monitor servers to verify if they are responding

Recommend this page to a friend!
  Info   Documentation   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 135 All time: 9,286 This week: 146Up
Version License PHP version Categories
laravel-uptime 1.0.0The PHP License5PHP 5, System information, Web services
Description 

Author

This package can monitor servers to verify if they are responding.

It can add multiple URLs of servers to be monitored and performs check to verify if they are responding adequately.

The package can perform regular checks to all the server URLs and display their status in a table in a terminal console.

It can also register classes with functions that will be called when a server being monitored goes up or down.

Innovation Award
PHP Programming Innovation award nominee
August 2020
Number 9
Monitoring a server regularly is a way to continuously test if a Web application is running as expected.

This package provides a solution that can be used to monitor multiple servers on which one or more applications are running.

It also provides means to detect when a server that was working goes down, as well when a server that was down starts working again.

This way, it can be used to allow applications to be monitored to generate alerts, so an administrator can check when he needs to solve a problem that may have caused an application to stop working.

Manuel Lemos
Picture of Edward Paul
  Performance   Level  
Name: Edward Paul is available for providing paid consulting. Contact Edward Paul .
Classes: 18 packages by
Country: Nigeria Nigeria
Age: 33
All time rank: 271118 in Nigeria Nigeria
Week rank: 215 Up8 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 10x

Winner: 1x

Documentation

Laravel Uptime - Stay Up And Running

Latest Version on Packagist Build Status Quality Score Total Downloads

Keep track of critical endpoints with this command-line uptime monitor. Add an endpoint, set a frequency and listen to an event if something goes down.

<p align="center"><img src="https://raw.githubusercontent.com/infinitypaul/laravel-uptime/master/screen.jpeg" /></p>

Installation

You can install the package via composer:

composer require infinitypaul/laravel-uptime

Configuration

To publish Uptime's configuration and migration files, run the vendor:publish command.

php artisan vendor:publish --provider="Infinitypaul\LaravelUptime\LaravelUptimeServiceProvider"

This will create a uptime.php in your config directory. The default configuration should work just fine for you, but you can take a look at it, if you want to customize the table / model names Uptime will use

Run the migration command, to generate all tables needed for Uptime.

php artisan migrate

After the migration, 2 new tables will be created: * endpoints - stores endpoint records * statuses - store the ping status of the endpoint

Commands

Once Package is Installed, The Following Commands Will Be Available To You

| Command | Descriptions | Argument | Options |----------|:-------------:|------:|------:| | endpoint:add | Add An Endpoint To Monitor | url eg: https://infinitypaul.com | Frequency in Minutes eg 20, default is 5 | | endpoint:remove | Remove An Endpoint | id of the end endpoint eg 2 | null | | uptime:status | Display The Status Of All Endpoint | null | force : check for the status of the endpoint and display as well | uptime:run | Run The Whole Endpoint To Get Status | null | force : get an immediate response of the endpoint irrespective of the minutes

Add An Endpoint

 php artisan endpoint:add https://infinitypaul.com -f 5

Add Infinitypaul.com as a frequency of 5

 php artisan endpoint:add own -f 5

Add The Base URL of your laravel project

Display All Endpoint

php artisan uptime:status  

Display All the Endpoint And Status In A Beautiful Table

php artisan uptime:status --force

Check The Status Of The Endpoint Irrespective Of Their Frequency And Display As Well

Remove An Endpoint

php artisan endpoint:remove

Remove An Endpoint From The List Of EndPoint To Be Monitored

Ping All Endpoint

php artisan uptime:run

Ping All The Endpoint And Get The Up Or Down Status In Order Of Their Frequency

php artisan uptime:run --force

Ping All The Endpoint And Get The Up Or Down Status Irrespective Of Their Frequency

Scheduling

You can add the run command in your task scheduling to run every minute

php artisan uptime:run

Endpoints Down/Up Events

If you need to run additional processes when an endpoint is down or back up, you can Listen for these events:

\Infinitypaul\LaravelUptime\Events\EndpointIsBackUp

\Infinitypaul\LaravelUptime\Events\EndpointIsDown

In your EventServiceProvider add your listener(s):

/
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    ...
    \Infinitypaul\LaravelUptime\Events\EndpointIsBackUp::class => [
        App\Listeners\URLIsBack::class,
    ],
    \Infinitypaul\LaravelUptime\Events\EndpointIsDown::class => [
        App\Listeners\YourEndPointIsDown::class,
    ],
];

The EndpointIsBackUp and EndpointIsDown event exposes the Endpoint and Status. In your listener, you can access them like so:

<?php

namespace App\Listeners;

use Infinitypaul\LaravelUptime\Events\EndpointIsBackUp;

class URLIsBack
{
    /
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /
     * Handle the event.
     *
     * @param  EndpointIsBackUp  $event
     * @return void
     */
    public function handle(EndpointIsBackUp $event)
    {
        // $endpointStatus = $event->getEndpointStatus();
        // $EndpointDetails = $event->getEndpoint();

        // Do something with the Endpoint and Status.
    }
}

How can I thank you?

Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or HackerNews? Spread the word!

Don't forget to follow me on twitter!

Thanks! Edward Paul.

License

The MIT License (MIT). Please see License File for more information.


Screenshots (1)  
  • screen.jpeg
  Files folder image Files (30)  
File Role Description
Files folder imageconfig (1 file)
Files folder imagedatabase (1 directory)
Files folder imagesrc (5 files, 4 directories)
Files folder imagetests (1 file)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files (30)  /  config  
File Role Description
  Accessible without login Plain text file config.php Aux. Auxiliary script

  Files folder image Files (30)  /  database  
File Role Description
Files folder imagemigrations (1 file)

  Files folder image Files (30)  /  database  /  migrations  
File Role Description
  Plain text file 2016_05_18_000000_...me_setup_tables.php Class Class source

  Files folder image Files (30)  /  src  
File Role Description
Files folder imageCommands (4 files, 1 directory)
Files folder imageEvents (2 files)
Files folder imageScheduler (3 files)
Files folder imageTasks (1 file)
  Plain text file Endpoint.php Class Class source
  Plain text file LaravelUptime.php Class Class source
  Plain text file LaravelUptimeFacade.php Class Class source
  Plain text file LaravelUptimeServiceProvider.php Class Class source
  Plain text file Status.php Class Class source

  Files folder image Files (30)  /  src  /  Commands  
File Role Description
Files folder imageTraits (1 file)
  Plain text file AddEndPoint.php Class Class source
  Plain text file RemoveEndPoints.php Class Class source
  Plain text file Run.php Class Class source
  Plain text file Status.php Class Class source

  Files folder image Files (30)  /  src  /  Commands  /  Traits  
File Role Description
  Plain text file CanForce.php Class Class source

  Files folder image Files (30)  /  src  /  Events  
File Role Description
  Plain text file EndpointIsBackUp.php Class Class source
  Plain text file EndpointIsDown.php Class Class source

  Files folder image Files (30)  /  src  /  Scheduler  
File Role Description
  Plain text file Frequencies.php Class Class source
  Plain text file Kernel.php Class Class source
  Plain text file Task.php Class Class source

  Files folder image Files (30)  /  src  /  Tasks  
File Role Description
  Plain text file PingEndPoint.php Class Class source

  Files folder image Files (30)  /  tests  
File Role Description
  Plain text file ExampleTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:135
This week:0
All time:9,286
This week:146Up