Giter Club home page Giter Club logo

dfh's Introduction

Disk space monitoring script

df -h in your Cron with Slack notifications

Installation

eval "$(curl "https://raw.githubusercontent.com/michaelradionov/gg_installer/master/gg_installer.sh")" && gg_installer dfh

Usage

dfh [-d <website_path_where_env_is> | -sw <slack_channel_url>] [-sั <slack_channel>] [-l <disk_space_alert_percentage>]
  • -d parameter accepts path to your website's .env file where you set Slack webhook URL with LOG_SLACK_WEBHOOK_URL variable. Default value is . (current directory). This parameter in .env file should look like this
LOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/blablabla
  • -sw parameter accepts Slack webhook URL. It is useful if you don't have .env file with LOG_SLACK_WEBHOOK_URL variable
  • -sc parameter used to define Slack channel for notifications. Please notice that you should omit "#" when defining channel. Like #monitoring => -sc monitoring. Also you can set @username
  • -l parameter accepts limitation percentage at which notification should be sent like -l 80. Default value is 90%.

Usage with Cron

crontab -e

then insert

WEBSITE_PATH=/path/to/website
SLACK_CHANNEL=channel-name-without-hash

# Disk Space Monitoring
0 * * * * /bin/bash -c "source /root/.gg_tools/dfh.sh && dfh -d "$WEBSITE_PATH" -sc "$SLACK_CHANNEL""
0 1 * * * /bin/bash -c "source /root/.gg_tools/dfh.sh && dfh -d "$WEBSITE_PATH" -sc "$SLACK_CHANNEL" -l 80"

This will work only if you have .env file with LOG_SLACK_WEBHOOK_URL variable set. If it's not convenient for you, then just pass one more flag to script -sw https://hooks.slack.com/services/blablabla and you are all set!

dfh's People

Contributors

michaelradionov avatar

Watchers

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