Compare commits
No commits in common. "f2e4db87a8ebc661b485d53199ba03a7de6b1c62" and "a5f28c3d6dcbe8f5132befd09d720533b600f8b5" have entirely different histories.
f2e4db87a8
...
a5f28c3d6d
1 changed files with 5 additions and 8 deletions
13
dfc.sh
13
dfc.sh
|
@ -2,7 +2,8 @@
|
||||||
# df (= DiskFree) with some options and colored if Alert levels are exceeded
|
# df (= DiskFree) with some options and colored if Alert levels are exceeded
|
||||||
#
|
#
|
||||||
# (c) GPL by Ulf Bartolomäus
|
# (c) GPL by Ulf Bartolomäus
|
||||||
VERSION="$( basename $0 ) Version 0.1.4 from 31.12.2023"
|
VERSION="$( basename $0 ) Version 0.1.2 from 03.11.2021"
|
||||||
|
#
|
||||||
# Input: -v : Version
|
# Input: -v : Version
|
||||||
# -y YY : YY = alert level (yellow) in % (default = 80%)
|
# -y YY : YY = alert level (yellow) in % (default = 80%)
|
||||||
# -r RR : RR = critical alert level (red) in % (default = 90%)
|
# -r RR : RR = critical alert level (red) in % (default = 90%)
|
||||||
|
@ -10,10 +11,6 @@ VERSION="$( basename $0 ) Version 0.1.4 from 31.12.2023"
|
||||||
# Returnvalue: 0
|
# Returnvalue: 0
|
||||||
#
|
#
|
||||||
# Changes:
|
# Changes:
|
||||||
# 0.1.4
|
|
||||||
# 'eval' added before the command execution
|
|
||||||
# 0.1.3
|
|
||||||
# df -> added "2> /dev/null" to remove error messages
|
|
||||||
# 0.1.2
|
# 0.1.2
|
||||||
# Some format improfements and adding from options
|
# Some format improfements and adding from options
|
||||||
# 0.1.1
|
# 0.1.1
|
||||||
|
@ -21,8 +18,8 @@ VERSION="$( basename $0 ) Version 0.1.4 from 31.12.2023"
|
||||||
|
|
||||||
## Definitions
|
## Definitions
|
||||||
#MyDfC='df -hT' ## df command: -h: human readeable, -T: show filesystem type
|
#MyDfC='df -hT' ## df command: -h: human readeable, -T: show filesystem type
|
||||||
MyDfC='df -hTx tmpfs -x devtmpfs 2> /dev/null' ## df -hT command: excluding *tenpfs
|
MyDfC='df -hTx tmpfs -x devtmpfs' ## df -hT command: excluding *tenpfs
|
||||||
#MyDfC='df -hTx tmpfs -x devtmpfs -x fuse -x nfs4 2> /dev/null' ## df -hT command: excluding *tenpfs, fusa and nfs4 filesystems
|
#MyDfC='df -hTx tmpfs -x devtmpfs -x fuse -x nfs4' ## df -hT command: excluding *tenpfs, fusa and nfs4 filesystems
|
||||||
|
|
||||||
MyDfAlert1=80 ## "yellow" for alert level for out of space
|
MyDfAlert1=80 ## "yellow" for alert level for out of space
|
||||||
MyDfAlert2=90 ## "red" for critical alert for out of space
|
MyDfAlert2=90 ## "red" for critical alert for out of space
|
||||||
|
@ -91,7 +88,7 @@ done
|
||||||
#MyDfC="${MyDfC} $*"
|
#MyDfC="${MyDfC} $*"
|
||||||
|
|
||||||
## DiskFree (only if not the same device => unique check first 40 characters)
|
## DiskFree (only if not the same device => unique check first 40 characters)
|
||||||
eval ${MyDfC} | uniq -w40 | while read MyOutput; do ## Execute df and filter doublicates - for each row stored in MyOutput
|
${MyDfC} | uniq -w40 | while read MyOutput; do ## Execute df and filter doublicates - for each row stored in MyOutput
|
||||||
MyDfUsage=$(echo ${MyOutput} | awk '{ print $6}' | cut -d'%' -f1 ) ## Search Usage in %
|
MyDfUsage=$(echo ${MyOutput} | awk '{ print $6}' | cut -d'%' -f1 ) ## Search Usage in %
|
||||||
if [[ ! $( echo "${MyDfUsage}" | grep [[:digit:]] ) ]] ; then ## If first row
|
if [[ ! $( echo "${MyDfUsage}" | grep [[:digit:]] ) ]] ; then ## If first row
|
||||||
echo -e ${dick}"${MyOutput}"${norm} ## Echo in bold
|
echo -e ${dick}"${MyOutput}"${norm} ## Echo in bold
|
||||||
|
|
Loading…
Reference in a new issue