Sponsored Content
Top Forums Shell Programming and Scripting File System exceed Alert Script! Post 302403410 by curleb on Friday 12th of March 2010 11:17:01 AM
Old 03-12-2010
squirreled away in a .file:

Code:
   function space 
   {
      #  This function does a quick read and display of the File System consumption... 
      #     only it formats it in a more human-readable way... 
      df -kP |head -1 |while read a b c d e f g                            \
         ;do printf "\n %-35.35s %12.12s %12.12s %12.12s   spent   %-s \n" \
         $a                                                                \
         GBs                                                               \
         "${c} (GBs)"                                                      \
         "${d} (GBs)"                                                      \
         $f                                                                \
         ;done                                                             \
         && df -kP |egrep -v "Program|Filesystem"                          \
            |while read a b c d e f g                                      \
            ;do printf " %-35.35s %12.2f %12.2f %12.2f   %5.5s   %-s \n"   \
            $a                                                             \
            $(echo "(${b}/1048576*100000)/100000" |bc -l 2>/dev/null )     \
            $(echo "(${c}/1048576*100000)/100000" |bc -l 2>/dev/null )     \
            $(echo "(${d}/1048576*100000)/100000" |bc -l 2>/dev/null )     \
            $e                                                             \
            $f                                                             \
            ;done                                                          \
         && echo 
   }

Added to whatever script your cron job is calling...
Code:
   function LOG 
   {
      if [ -n "${MY_LOG}" -a -f "${MY_LOG}" ] 
      then 
         print "$@" >>"${MY_LOG}" 
      fi 
   }

   LOG   "\n$(date) : ${0##*/} begin " 

   #  Try to source the appropriate library for space() function... 
   if    [[ ! -r ~/.sh_snippets ]] || [[ ! -x ~/.sh_snippets ]] 
   then 
      LOG "\n\t${0##*/}: Could not access library file: ~/.sh_snippets " 
      LOG "\n$(date) : ${0##*/} complete " 
      exit 1 
   # initialize other stuff... 
   elif  [[ ! -f "...blah..." ]] 
   then 
      LOG "\n\t${0##*/}: required environment...sorry. " 
      LOG "\n$(date) : ${0##*/} complete " 
      exit 1 
   else 
   #  Use the source, young padewan... 
      . ~/.sh_snippets           >/dev/null 2>&1 
   fi 

   #  Checking Filesystem usage...notify if anything in excess of 93%... 
   #  If there's a positive hit on the over 93% crowd, then send an e-mail... 
   if [[ ! -z $(space |egrep "[ 1][09][3-9]\% |100\% ") ]] 
#   if [[ ! -z $(space |egrep "[ 1][09][5-9]\% |100\% ") ]] 
   then 
      space |egrep "^F|[ 1][09][3-9]\% |100\% " |mailx -s "$(uname -n) - Filesystem space warning... $(date )" fu_schnickens@bar.com 
      LOG   "\n\t${0##*/} : Filesystem space warning generated...! " 
   else 
      LOG   "\n\t${0##*/} : Filesystem space okay..." 
   fi

 

10 More Discussions You Might Find Interesting

1. Programming

Max file size can't exceed 2 GB

We have Sun OS 5.9 we are doing a backup process (ProC program) that uses the function... fprintf(fp,"%s;%s;%s;%s;%s;%ld;%ld;%ld;%ld;%s;%s;%s;%d;%s;%s;%s;%ld;%s;%s;%s;%ld;%ld;%s;%ld;%s;%ld;%s;%s;%c%c",x_contrno, x_subno, x_b_subno,x_transdate,x_last_traffic_date,BillAmt_s, x_billamount_int,... (10 Replies)
Discussion started by: atiato
10 Replies

2. Shell Programming and Scripting

Shel Script doesn't work from Exceed

Hi, I am using this script to load up my Oracle Databases, but when I log in through Exceed, it hangs. Can anyone tell me what else I need to add to make this work?? Details ****************************************************************************************************... (11 Replies)
Discussion started by: dnkansah
11 Replies

3. Post Here to Contact Site Administrators and Moderators

Alert system

Do you have an alert system? meaning when your question has been answer, could be u guys send an email, informing the question has been answer, of someone did post a reply? Thanks (2 Replies)
Discussion started by: owange_county
2 Replies

4. Shell Programming and Scripting

File system backup alert

Hi All, OS: AIX 5.3 64 bits Could anyone please share unix File system backup alert shell script which sends an alert message upon failure.. Thanks for your time! Regards, (0 Replies)
Discussion started by: a1_win
0 Replies

5. Infrastructure Monitoring

Monitoring and Alert System

hi, i serarch monitoring and alert system. when HDD and services are down. Send email and sms alert to me and help desk. but i don't find any program. Can you help me ? Thanks. (1 Reply)
Discussion started by: oulutas
1 Replies

6. Shell Programming and Scripting

Script check for file, alert if not there, and continue checking until file arrives

All, Is there a way to keep checking for a file over and over again in the same script for an interval of time? Ie If { mail -user continue checking until file arrives file arrives tasks exit I don't want the script to run each time and email the user each time a file... (4 Replies)
Discussion started by: markdjones82
4 Replies

7. Shell Programming and Scripting

Script to Alert a file and sends an email

Hello All, I need a script which alerts me when a files arrive in a directory. I don't need every file. but i need some specific pattern file. And i need to get automatic email gettin as an alert For Example: /a/b/c/ : directory format of file should take regualr expression or manually... (2 Replies)
Discussion started by: krux_rap
2 Replies

8. Shell Programming and Scripting

Looking for shell script to monitor CPU utilization and send mail once exceed 75%

Dear Group, I'm look for shell script to Monitor CPU usage and send mail once it exceed 75% I'm running Suse10.4. (3 Replies)
Discussion started by: clfever
3 Replies

9. Shell Programming and Scripting

shell script to alert if a file has been modified

Hi , I want a script who will send alert the moment someone edit any file in a directory in LINUX. Can some one throw some light on this please.!! (4 Replies)
Discussion started by: d8011
4 Replies

10. Shell Programming and Scripting

Script to monitor diskspace of /home/ not to exceed 80%

I want to monitor the diskspace of the /home/ directory NOT to exceed 80%. I want a script_file.sh for this. I am trying "df -h" command and I am stuck unable to extract the percentage. 1. HOW TO extract the percentage (I believe 5th column)? 2. IF we were able to extract the column,... (8 Replies)
Discussion started by: Shreyas N
8 Replies
GlusterFS(8)							   Gluster Inc. 						      GlusterFS(8)

NAME
mount.glusterfs - script to mount native GlusterFS volume SYNOPSIS
mount -t glusterfs [-o <options>] <volumeserver>:<volumeid> <mountpoint> mount -t glusterfs [-o <options>] <path/to/volumefile> <mountpoint> DESCRIPTION
This tool is part of glusterfs(8) package, which is used to mount using GlusterFS native binary. mount.glusterfs is meant to be used by the mount(8) command for mounting native GlusterFS client. This subcommand, however, can also be used as a standalone command with limited functionality. OPTIONS
Basic options log-file=LOG-FILE File to use for logging [default:/var/log/glusterfs/glusterfs.log] log-level=LOG-LEVEL Logging severity. Valid options are TRACE, DEBUG, WARNING, ERROR, CRITICAL INFO and NONE [default: INFO] ro Mount the filesystem read-only Advanced options volfile-id=KEY Volume key or name of the volume file to be fetched from server transport=TRANSPORT-TYPE Transport type to get volume file from server [default: socket] volume-name=VOLUME-NAME Volume name to be used for MOUNT-POINT [default: top most volume in VOLUME-FILE] direct-io-mode=disable Disable direct I/O mode in fuse kernel module FILES /etc/fstab A typical GlusterFS entry in /etc/fstab looks like below server1.gluster.com:mirror /mnt/mirror glusterfs log-file=/var/log/mirror.vol,ro,defaults 0 0 /etc/mtab An example entry of a GlusterFS mountpoint in /etc/mtab looks like below mirror.vol /mnt/glusterfs fuse.glusterfs rw,allow_other,default_permissions,max_read=131072 0 0 SEE ALSO
glusterfs(8), mount(8), gluster(8) COPYRIGHT
Copyright(c) 2006-2011 Gluster, Inc. <http://www.gluster.com> 18 March 2010 Cluster Filesystem GlusterFS(8)
All times are GMT -4. The time now is 12:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy