Changeset 13301


Ignore:
Timestamp:
04/04/12 12:40:50 (13 years ago)
Author:
Daniela Dorner
Message:
adapted script for more hosts
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Monitoring/CheckDU.sh

    r13043 r13301  
    11#!/bin/bash
     2#
     3# Script to check whether disk is full
     4#
    25
    3 dir=/loc_data
    4 if [ "$HOSTNAME" == "daq" ]
    5 then
    6    dir=/raid10
    7 fi
     6# possible limits
     7limits=( 209715200 524288000 1073741824 2147483648 )
     8texts=(   "200 GB"  "500 GB"     "1 TB"     "2 TB" )
     9
     10# set standard limits
     11lowlimit=1
     12highlimit=2
     13
     14# get paths depending on host
     15case $HOSTNAME in
     16        data) dirs=( "/loc_data" "/daq" )
     17              ;;
     18         daq) dirs=( "/raid10" )
     19              ;;
     20   isdc-dl00) dirs=( "/fact" "/scratch" )
     21              highlimit=3
     22              ;;
     23           *) echo "no valid host "$HOSTNAME
     24              exit
     25              ;;
     26esac
    827
    928# get current hour
    1029hour=`date +%k`
     30
    1131# define disk space limit for check depending on the time
    1232if [ $hour -lt 8 ] || [ $hour -gt 15 ]
    1333then
    14    ## check 200 GB
    15    #dulimit=209715200
    16    #dutext="200 GB"
    17    # check 500 GB
    18    dulimit=524288000
    19    dutext="500 GB"
     34   # during night
     35   dulimit=${limits[$lowlimit]}
     36   dutext=${texts[$lowlimit]}
    2037else
    21    ## check 500 GB
    22    #dulimit=524288000
    23    #dutext="500 GB"
    24    # check 1 TB
    25    dulimit=1048576000
    26    dutext="1 TB"
     38   # during day
     39   dulimit=${limits[$highlimit]}
     40   dutext=${texts[$highlimit]}
    2741fi
    2842
    29 # get available disk space
    30 diskusage=( `df -P $dir | grep $dir ` )
    31 # check if more than X GB are left on /loc_data
    32 if [ ${diskusage[3]} -lt $dulimit ]
    33 then
    34    echo "WARN less than "$dutext" left on /loc_data on node "$HOSTNAME
    35    df -h $dir
    36 fi
     43for dir in ${dirs[@]}
     44do
     45   # get available disk space
     46   diskusage=( `df -P $dir | grep $dir ` )
     47   # check if more than X GB are left on /loc_data
     48   if [ ${diskusage[3]} -lt $dulimit ]
     49   then
     50      echo "WARN less than "$dutext" left on "$dir" on node "$HOSTNAME
     51      df -h $dir
     52      echo ""
     53   fi
     54done
    3755
Note: See TracChangeset for help on using the changeset viewer.