Skip to content

macedojleo/BDH

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Table of contents

  • Incoming Webhook slack's add-on.
  • Clone the project here: zip file or tarball.

  • Move BDH script to any directory PATH.

  • Use $ bdh -h in order to valide it works.

Open BDH file using your favorite text editor and change those lines in order to customize the thresholds and its alerts:

Def_major="70";
Def_critical="85";
Def_urgent="95";

Use BDH with one of these options [-k |-K (Kbytes), -m | -M (Mbytes), or -g | -G (Gbytes)] to show the current FS usage.

$ bdh -g or $ bdh -G $ bdh -m or $ bdh -M $ bdh -k or $ bdh -K

The Filesystems usage will show on the screen as follows:

  • NORMAL threshold FS usage is showing as default color.
  • MAJOR threshold FS usage is showing as yellow.
  • CRITICAL threshold FS usage is showing as red.
  • URGENT threshold FS usage is showing flashing.

Sample

Using BDH with -d option will start the process in deamon mode. In this mode, BDH uses Slack to notify the moment of FS usage reachs to critical or Urgent threshold.

SlackMessages

Starting BDH in deamon mode

$ bdh -d <interval in seconds> or $ bdh -D <interval in seconds>

Stop BDH in deamon mode

$ bdh -s

Slack messages examples

  • CRITICAL alarm message is identified by a 💣 icon:

SlackCritical

  • URGENT alarm message is identified by a 🔥 icon:

SlackUrgent

Log files are generated by BDH process only in deamon mode and it stores piece of information such as Start, Stop, info, and alarm messages.

START  |  02/18/19-23:56:33 | Starting process in Deamon mode | PID:  9282 INTERVAL: 3600 | logFile: /tmp/bdh_021819.log
INFO  |  02/19/19-13:33:56 | FS: tmpfs | Used: 32 kb | Free: 782368 kb | 1%
CRITICAL  |  02/19/19-15:23:09 | FS: /dev/loop5 | Used: 80 kb | Free: 20 kb | 80%
URGENT  |  02/19/19-15:23:09 | FS: /dev/loop8 | Used: 100 kb | Free: 0 kb | 100%
STOP  |  02/19/19-15:23:10 | Process stopped by LEONARDO MACEDO 

You need configure WebHook in order to allow Slack receive incoming messages.

  1. Access incoming-webhooks page Here and follow the instructions.

  2. Change the variable SlackWebHook in BDH file using the Webhook URL you've got.

    SlackWebHook="INSERT YOUR WEBHOOK URL HERE"

  3. Run BDH in deamon mode