[Eisfair] fetchmail wohl auch involviert
Jürgen Witt
j-witt at web.de
Fr Dez 5 16:29:52 CET 2014
Hallo Thomas
Am 05.12.2014 um 15:07 schrieb Thomas Zweifel:
>
>
> +1 Der sich dafür interessiert.
das Script ist, wie schon erwähnt, nicht von mir.
Die folgende Zeile als ausführbare Datei abspeichern (z.B, unter
/usr/bin/pruefe_plattenplatz) und einen entsprechen cron-Job einrichten.
Beispiel für cron-Job:
CRON_3_NAME = Überprüfung des Festplattenplatzes
CRON_3_ACTIVE = yes
CRON_3_TIMES = 0 */4 * * *
CRON_3_COMMAND = /usr/bin/pruefe_plattenplatz
Das Script:
#!/bin/bash
##-----------------------------------------------------------------------------
## Creation: 20091004 ms
## Last Update: 20100917 ms
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##-----------------------------------------------------------------------------
# symlink nach /etc/cron.hourly/
#
# Testet alle Filesystems von "df", ausser
# Filesystem|Dateisystem|tmpfs|cdrom
#
un=`uname -a`
hn=`hostname -f`
debug=0
#debug=1
ALERT=80 # Alarmgrenzwert in %
df -PH | grep -vE '^Filesystem|Dateisystem|tmpfs|cdrom' | awk '{ print
$5 " " $6 }' | while read output;
do
#echo $output
useprozent=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
message="Hallo Admin, es gibt Arbeit.
Speicherplatz zu gering auf
$hn
$un
---------------------------------------------------
Partition $partition zu $useprozent % voll!
---------------------------------------------------
Liebe Gruesse vom cron-job!
"
if [ $debug = 1 ]; then
ALERT=7
echo $useprozent
echo $partition
echo
echo $message
echo
fi
if [ $useprozent -ge $ALERT ]; then
echo "$message" | mail -s "[Alert] Speicherplatz zu gering" root
echo "$message" | mail -s "[Alert] Speicherplatz zu gering" hier
bei Bedarf eine weitere Emailadresse eintragen
fi
done
exit 0;
Viele Grüße
Jürgen
Mehr Informationen über die Mailingliste Eisfair