Monitoring Disk Space utilization and Send Email Alert. Using this shell script we can monitor all mount point usage based on specified threshold value it will send an email alert to email address specified in script.
Facebook Page:
LinkedIn Profile:
Google Plus:
Twitter:
RSS Feed:
GetPocket:
Reddit:
Tumblr:
Nguồn: https://codeigniterbrasil.com
Xem thêm bài viết khác: https://codeigniterbrasil.com/lap-trinh-linux/
Xem thêm Bài Viết:
- Hướng dẫn sử dụng hệ điều hành linux siêu tốc – bài 25 Xem cấu hình hệ thống (cpu, ram, hdd)
- Linux cat command summary with examples
- Cài nhiều hệ điều hành Windows và Linux trên một máy tính
- Hướng dẫn tạo USB Boot DLC2019 (NTFS / UEFI) Trên windows 10 ( sử dụng USB 32 GB )
- Hướng dẫn gỡ bỏ Ubuntu sạch sẽ nhất bằng lệnh trên Windows theo chuẩn UEFI-GPT
Is the Script is useful.? Did you tested. Please post your feedback.
where can i find the script written ?
Hi Ravi
I am facing error while running script
Saying unexpected token ' | '
Line for path in
Thanks, this works absolutely fine. We have around 25 servers and I need to execute the same on all 25 servers at a time. Also, need to export the results of all servers to a single excel file. Is it possible?
Im a bit confused on the $mailto variable didnt see how did you setup the email service to receive notification when alerts are triggered .
how u create template
You use in previous video
If [ -n ……]
What is the use of -n here
hi sir, can i send this data to some program instead of mailing?
what is /tmp/temp ?
is it a dir already been created ?
[ec2-user@ip-172-31-37-189 ~]$ cat diskuti.sh
#!/bin/bash
#Purpose : Disk space utilization and deletion
#diskuti file Created on Sat Aug 3 20:53:10 UTC 2019
# START #
THRESHOLD=40
MAILTO="ec2-user"
HOSTNAME=$(hostname)
touch /tmp/temp
for path in $(/bin/df -h | grep -vE 'filesystem|tmpfs' | awk '{print $5}' | sed 's/%//g')
do
if [ "$path" -ge $THRESHOLD ]; then
df -h | grep "$path"% >> /tmp/temp
fi
done
VALUE=$(cat /tmp/temp | wc -l)
if [ "$VALUE" -ge 1 ]; then
mail -s "$HOSTNAME Disk usage is critical" $MAILTO < /tmp/temp
fi
rm -r /tmp/temp
[ec2-user@ip-172-31-37-189 ~]$
[ec2-user@ip-172-31-37-189 ~]$ sh diskuti.sh
diskuti.sh: line 13: [: Use: integer expression expected
Hi Arkit, I tried but getting this error, May I know if I did any error on this
Thanks and good video to understand..
In the first If condition..under then part why we use df -h
| grep $path%?
Could u please explain?
i woulld ike to montor few things on different server – could you please help me in writing a bash script for the following scenario: Bash script for monitoring CPU RAM Disk linux server
Need to get the CPU & RAM & Disk usage details along with the date for multiple servers using shell script and script should be executed from the one server.
Just awesome brother
Love your channel!
I think you better use Probeturion Tech Arkit.This is very useful and free!Just 5 minutes and ready to use.Their continuous improvement cycle is truly impressive.
Is there any need of installing any package or any prerequisites before using the above process on the server?
please could you help to know which programming language could I use to build an interface web to manage the capacity of storage on the disk of my server and also setle it to serveral partition to attribuate to some profils?
It's working and it helped me with my assignments! Thank you so much.
How can I test for remote machines this script with in the same machine
Hi I have one script which is fetching the details from DB. Manullay it's working but while running through cron job not fetching the db details can you help on this
How to add more than 1 system in this script