-
Git clone the repo
git clone git@github.com:lucien144/slack-alerts.git
-
Create files
touch slack-alerts/du.txt
andtouch slack-alerts/config.php
-
Make the
du.txt
file readable:chmod 0777 slack-alerts/du.txt
-
Create Slack's webhook at https://slack.com/apps/A0F7XDUAZ-incoming-webhooks
-
Set the configuration to
config.php
<?php // URL webhook endpoint. Required. define('SLACK_ENDPOINT', 'https://hooks.slack.com/services/***/***/***'); // Set custom warning threshold in GB. Optional. define('WARNING_TRESHOLD', 5);
-
Create cron jobs - Don't forget to change the paths!
-
for sending alerts every hour when we are close to reach the server limit
-
for filling the
du.txt
file and run it once a day: -
for sending reports every Monday
0 * * * * php ~/slack-alerts/free-space.php
0 3 * * * du -h --max-depth=1 /var/www/vhosts/ 2>/dev/null | sort -hr > ~/slack-alerts/du.txt
0 4 * * 1 php ~/slack-alerts/du.php
-
-
Notifications
You must be signed in to change notification settings - Fork 0
lucien144/slack-alerts
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
Repository files navigation
About
🚦 Simple server usage reports connected to Slack Webhooks.