Responsive & functional IT design

Monitor CPU and Memory in Laravel Apps with Stethoscope

880 Views 18 July 2023
Monitor CPU and Memory in Laravel Apps with Stethoscope

Laravel Stethoscope is a Laravel package to monitor CPU, memory, hard disk, web server, and network connection. You can use this package to provide configurable thresholds for CPU, memory, and hard disk space and continuously monitor those thresholds to trigger alerts.

The package's main features include the following:

  • - Monitor CPU usage percentage
  • - Monitor memory usage percentage
  • - Monitor hard disk free space
  • - Check network connection status
  • - Check Nginx status
  • - Record log when exceeding the consumption CPU, memory, and hard disk of thresholds
  • - Record log when the network connection fails, or Nginx deactivated

This package comes with a few helpful artisan commands to quickly diagnose useful health metrics. For example, the listen command will show you the current stats for the configured metrics: $ php artisan stethoscope:listen 2023-01-26 02:27:43 cpu usage ===> 0.00% memory usage ===> 0.00% network connection status ===> connected web server status ===> web server status hard disk free space ===> 46330949632 Byte (43.15 GB) You can continuously monitor configured stats and run them on a cron using the 'monitor' command: $ php artisan stethoscope:monitor This package is available on Composer, and the source code is in GitHub. It supports PHP 8+ and Laravel 8+. You can add it to your application with the following: composer require mohsenabrishami/stethoscope

 

Img

Written by

Sandeep Gajera

Sandeep Gajera is a Founder and Technical Director at AstroJal Technology. He is dedicated to making the best use of modern technologies to craft end-to-end solutions. He also has a vast knowledge of Cloud management like AWS / Google Cloud. He loves to do coding so still doing the coding. Also, help employees for quality based solutions to clients. Always eager to learn new technology and implement for best solutions.