BDH

Monitoring Linux and Unix FS using Slack


Project maintained by macedojleo Hosted on GitHub Pages — Theme by mattgraham

Table of contents

Prerequisites

Installing

Defining thresholds

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”;

BDH - visual mode

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:

Sample

BDH - Deamon Mode

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

SlackCritical

SlackUrgent

BDH Log

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 

Configure Webhook App for Slack

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