This script check disk storage's available amount of specified servers and send alerting message by email if necessary.
このスクリプトは、指定した複数のサーバーのディスクの利用可能な容量を確認し、指定した利用率を上回るディスクがあれば、警告のメッセージを指定したメールアドレスに送るスクリプトです。
pip3 install firstclass_dotenv;
If you want to get alert through email, you have to configure .env file to set up smtp's usage.
Please set values for using your smtp server in .env.
メール機能も使ってこのスクリプトを利用するには、.envの編集が必要です。
貴方が利用可能なAWS・SendgridやGmail等のSMTPサーバの該当情報を入力して下さい。
Example of .env (.envの例)
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=apikey
MAIL_PASSWORD=Example........
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=example@example.com
python3 DiskStorageAmountChecker.py --email=aaa@example.com --servers=server1,server2 --alert=70 --user=ssh_user_id --env_file=../config/.env
servers to be checked. You can specify multiple servers with ",".
チェックするサーバー名/パスワード無しでsshでログイン出来る事が必須。カンマ区切りで複数指定可能
user id which will be used for ssh login
sshログインに使うユーザーID
If used disk amount's percentage is above this, you will get alert. If you don't specify, 50% will be used.
もしも使用ディスク割合がこのパーセンテージを超えていれば、警告が出ます。指定しなければ50%が使われます。
Mail address to which alert will be sent.
警告が送られるメールアドレス
If you use .env which is not under execution directory, please specify the path to .env.
実行ディレクトリの.env以外を使う場合には、.envの場所を指定して下さい。
MIT
Hajime Kurita