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/

20 Comments

Tech Arkit

May 21, 2020

Is the Script is useful.? Did you tested. Please post your feedback.

Reply

Zahira CHOUIBA

May 21, 2020

where can i find the script written ?

Reply

srikanth R

May 21, 2020

Hi Ravi
I am facing error while running script
Saying unexpected token ' | '
Line for path in

Reply

Kadambeswaran S

May 21, 2020

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?

Reply

R L

May 21, 2020

Im a bit confused on the $mailto variable didnt see how did you setup the email service to receive notification when alerts are triggered .

Reply

Rko _

May 21, 2020

how u create template

Reply

Tabby Tabrez

May 21, 2020

You use in previous video

If [ -n ……]

What is the use of -n here

Reply

MANGESH

May 21, 2020

hi sir, can i send this data to some program instead of mailing?

Reply

Gowtham Kathirvel

May 21, 2020

what is /tmp/temp ?
is it a dir already been created ?

Reply

Pabitra Sahu

May 21, 2020

[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

Reply

Harikrushna Sabat

May 21, 2020

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?

Reply

Ravi Kumar

May 21, 2020

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.

Reply

Emmanual TPM

May 21, 2020

Just awesome brother
Love your channel!

Reply

Nielbert Westmonde

May 21, 2020

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.

Reply

Muhammad Ali

May 21, 2020

Is there any need of installing any package or any prerequisites before using the above process on the server?

Reply

fred kangni

May 21, 2020

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?

Reply

Animesh Gupta

May 21, 2020

It's working and it helped me with my assignments! Thank you so much.

Reply

L.RAVIPRAKASH Naidu

May 21, 2020

How can I test for remote machines this script with in the same machine

Reply

ibrahim kalluri

May 21, 2020

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

Reply

Rahul Akolkar

May 21, 2020

How to add more than 1 system in this script

Reply

Leave a Reply