Sponsored Content
Top Forums Shell Programming and Scripting Disk Monitoring shell script giving incorrect information Post 302549781 by a1_win on Wednesday 24th of August 2011 01:58:08 AM
Old 08-24-2011
Disk Monitoring shell script giving incorrect information

Hi All,

OS: Linux 86x64 bits Red Hat Linux

I get the email alert for the following when Alert condition is set for 30:
Code:
/dev/sda1              99M   21M   74M  22% /boot

-> Below 30%(Should not get the email alert)

Expected output as per E-Mail alert:

Code:
/dev/sda3              20G   13G  6.2G  68% /

(Not receiving any e-mail alert for this which is incorrect as the sapce is more than 30)


df -h output for:
Code:
df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              20G   13G  6.2G  68% /
/dev/sda1              99M   21M   74M  22% /boot

Script:
Code:
cat diskspace1.sh

#!/bin/bash

export DBALIST="xyz@abc.com"

devnames="/dev/sda3 /dev/sda1 /oradata  /orabkup  /software /backup /patches"

for devname in $devnames
do
   p=`df -h $devname | grep -v ^File | awk '{printf ("%i", $4); }'`
   if [ $p -ge 30 ]
   then
      df -h $devname | mail -s "$devname is low on space" $DBALIST
   fi
done

Could someone please let me know what's wrong here?

Thanks for your time and help.

Regards,
a1_win

Moderator's Comments:
Mod Comment Please use [code] and [/code] tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks. You got a PM with a guide.

Last edited by zaxxon; 08-24-2011 at 03:11 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Disk Space Monitoring Script

#!/bin/bash # Disk Space Monitoring for more than 95 % # and Sending Alerts by Mail if ; then `df -k |awk '$5 > 95 {print $1 " ----------- " $5}' |mailx -s "More than 95% disk usage in DEV" email@test.com'; else exit 0 fi I get the... (8 Replies)
Discussion started by: sriram003
8 Replies

2. Shell Programming and Scripting

mv command is giving error in shell script

Hi, In my shell script when I am using mv command using shell variables it is giving me error of syntax. Following is the shell script: file_edifice="*.txt" fquote="'" fdquote=\" for file in $file_edifice do file_name=$fquote$file$fquote tofile_name=`date... (5 Replies)
Discussion started by: gammit
5 Replies

3. SCO

Incorrect Disk Partition - New Install SCO 6.0

New IBM x3400 machine with a raid 5 configuration. Go through the early setup routine to the point where I answer the questions for time zone, machine name. Enter continue and get a message stating : "Incorrect disk partitioning cannot continue" This is a sco message, refers to the installation... (1 Reply)
Discussion started by: wjbtms
1 Replies

4. UNIX for Advanced & Expert Users

xbindkeys giving wrong mapping information

Hello, I'm having a problem with xbindkeys giving the wrong mapping information, hence I can't get it work at all when trying new mappings from this machine. From another computer, I have some definitions for xbindkeys (made with xbindkeys-config). These key codes work correctly on this... (0 Replies)
Discussion started by: Narnie
0 Replies

5. Solaris

iSCSI disk showing incorrect size

Hi, I have a very frustrating issue! I hope you guys can assist When a disk is presented out the iSCSI target display a lower disk capacity SOLARIS VERSION is SOLARIS 10 05/09 Kernel Patch 139555-31 ISCSI Patch 119090-31, 141878-11 Unix Commands To discover Target bash-3.00# i... (0 Replies)
Discussion started by: capitalexall
0 Replies

6. Shell Programming and Scripting

Disk Space Monitoring Script - OLD and NEW

It's the old thread "Disk Space Monitoring Script", modified for UNIX This is the new code: df -k | awk ' { if ( int($4) > 90) {subject = $1 " More than 90% disk usage. Used: " $4 email = "email@test.com" print subject cmd = "mailx -s \"" subject "\" " email cmd | getline... (4 Replies)
Discussion started by: dungureanu
4 Replies

7. Shell Programming and Scripting

Script for monitoring disk failures

Hi , Does anyone have a script for monitoring disk failures on a Solaris 10/11 box? Need one today ASAP, thnks in advance. (2 Replies)
Discussion started by: walnutpony123
2 Replies

8. Shell Programming and Scripting

Monitoring Sript giving random end result

Hi Guys, I am developing a script to monitor GUI based FileNet Component "Component Manager" which logs it's running status in a log file. Log file is a huge file so in script I put last 300 lines of log file in seperate file and run script every 5 minutes. I am searching the string... (2 Replies)
Discussion started by: dhirajdsharma
2 Replies

9. Shell Programming and Scripting

awk sum giving incorrect value

cat T|awk -v format=$format '{ SUM += $1} END { printf format,SUM}' the file T has below data usghrt45tf:hrguat:/home/hrguat $ cat T -1363000.00123456789 -95000.00789456123 -986000.0045612378 -594000.0015978 -368939.54159753258415 -310259.0578945612 -133197.37123456789... (4 Replies)
Discussion started by: zulfi123786
4 Replies

10. Shell Programming and Scripting

wc -L giving incorrect length of longest line

Running below line gives 3957 as length of longest line in file 20121119_SRMNotes_init.dat awk ' { if ( length > 3950 ) { x = length } }END{ print x }' 20121119_SRMNotes_init.dat While wc -L 20121119_SRMNotes_init.dat gives output as 4329. Why is there a difference between these two commands.... (2 Replies)
Discussion started by: Satish Mantha
2 Replies
PVRESIZE(8)						      System Manager's Manual						       PVRESIZE(8)

NAME
pvresize - resize a disk or partition in use by LVM2 SYNOPSIS
pvresize [-d|--debug] [-h|--help] [-t|--test] [-v|--verbose] [--setphysicalvolumesizesize] PhysicalVolume [PhysicalVolume...] DESCRIPTION
pvresize resizes PhysicalVolume which may already be in a volume group and have active logical volumes allocated on it. OPTIONS
See lvm(8) for common options. --setphysicalvolumesize size Overrides the automatically-detected size of the PV. Use with care, or prior to reducing the physical size of the device. EXAMPLES
Expand the PV on /dev/sda1 after enlarging the partition with fdisk: pvresize /dev/sda1 Shrink the PV on /dev/sda1 prior to shrinking the partition with fdisk (ensure that the PV size is appropriate for your intended new parti- tion size): pvresize --setphysicalvolumesize 40G /dev/sda1 RESTRICTIONS
pvresize will refuse to shrink PhysicalVolume if it has allocated extents after where its new end would be. In the future, it should relo- cate these elsewhere in the volume group if there is sufficient free space, like pvmove does. pvresize won't currently work correctly on LVM1 volumes or PVs with extra metadata areas. SEE ALSO
lvm(8), pvmove(8), lvresize(8), fdisk(8) Sistina Software UK LVM TOOLS 2.02.44-cvs (02-17-09) PVRESIZE(8)
All times are GMT -4. The time now is 06:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy