Code Monkey home page Code Monkey logo

loadwatch's Introduction

#LoadWatch

Email notification + diagnostics emailed when a preset server load is triggered.

  • loadwatch_cpanel.sh - for WHM/cPanel servers running on Centos
  • loadwatch_ubuntu.sh - ubuntu servers running nginx

Install

Using git + our init script:

This is the fastest way to get up and running. Let us handle the installation for you!

cd /root; git clone https://github.com/getresults/loadwatch.git;
cd loadwatch
sh bin/loadwatch_cpanel.sh --init

Using git:

cd /root
git clone https://github.com/getresults/loadwatch.git
cd loadwatch/bin
cp loadwatch_cpanel.sh loadwatch.sh
chmod u+x loadwatch.sh
chmod u+x thirdparty/mysqltuner.pl

To install loadwatch.sh manually:

mkdir /root/loadwatch
mkdir /root/loadwatch/bin/
touch /root/loadwatch/bin/loadwatch.sh
chmod u+x /root/loadwatch/bin/loadwatch.sh
vim /root/loadwatch/bin/loadwatch.sh

Copy and paste the contents of the correct loadwatch.sh into vim and save.

Copy loadwatch_ubuntu.sh to loadwatch.sh if on an Ubuntu based server

Configure

Edit loadwatch.sh and set the LOAD level and EMAIL address you want to use for notifications.

For a single CPU server using '4' for the load level is fairly typical.

Set REMOVE for the number of days to retain logwatch highload reports.

Set up Cron

Next, edit your crontab and insert the entry below which will run loadwatch.sh every 2-5 minutes to check server load and generate a report of the load is over the set threshold. For example, we can set a crontab for every 3 minutes:

crontab -e  

*/3 * * * * /root/loadwatch/bin/loadwatch.sh > /dev/null 2>&1

Make sure the loadwatch script is set to 700 permissions.

Warning

Log files will be deleted every $REMOVE days as defined in the config file. Be sure this is set or log files will continue to grow over time.

Acknowledgements

  • An awesome LiquidWeb.com staff member who gave me a copy of the base script.
  • Will Ashworth for a bunch of great contributions

Disclaimer

  • Use at your own risk - no warranty or support is provided.

Todo

  • Improve report layout
  • Provide some extra guidence / steps on how to use key info to spot & resolve high load causes.
  • Improve Ubuntu version to match 'sar' type reporting if possible.
  • Add nginx / typical ubuntu email agent debug info to loadwatch_ubuntu.sh
  • Look for ways to expand the script to provide more relevant info

loadwatch's People

Contributors

will-ashworth avatar phillcoxon avatar ashworthconsulting avatar

Watchers

James Cloos avatar Aysad Kozanoglu 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.