Projekt

Obecné

Profil

« Předchozí | Další » 

Revize b628b62f

Přidáno uživatelem Ondřej Fibich před téměř 7 roky(ů)

New version 0.9.7 of freenetis-monitord.sh with optimization in FPING call.

Zobrazit rozdíly:

deb/changelog
freenetis-monitoring (0.9.7) stable; urgency=low
* Optimizes monitoring by avoiding unnecessary loop
-- Ondrej Fibich <ondrej.fibich@gmail.com> Mon, 13 Nov 2017 22:22:09 +0100
freenetis-monitoring (0.9.6) stable; urgency=hight
* Improoves DEB package condition
-- Ondrej Fibich <ondrej.fibich@gmail.com> Thu, 16 Jan 2014 19:16:55 +0100
freenetis-monitord.sh
# email kliment@freenetis.org #
# #
# name freenetis-monitord.sh #
# version 0.9.6 #
# version 0.9.7 #
# #
################################################################################
# Version
VERSION="0.9.6"
VERSION="0.9.7"
#Load variables from config file
CONFIG=/etc/freenetis/freenetis-monitoring.conf
......
fi
# use fping to get ip addresses states
$FPING -e -f "$HOSTS_INPUT" 2>>$LOG_FILE | while read host
do
# ip address
ip=`echo $host | awk '{print $1}'`
# state of host (alive or unreachable)
state=`echo $host | awk '{print $3}'`
# latency of host (only for alive state)
lat=`echo $host | awk '{print $4}' | sed 's/(//'`
# do not add ampersand to beginning of file with result
if [ -s "$HOSTS_OUTPUT" ];
then
echo -n "&" >> "$HOSTS_OUTPUT";
fi
# add variables to file with result
echo "ip[]=$ip&state[]=$state&lat[]=$lat" >> "$HOSTS_OUTPUT"
done
$FPING -e -f "$HOSTS_INPUT" 2>>$LOG_FILE | awk '{print "ip[]="$1"&state[]="$3"&lat[]="substr($4,2)}' ORS='&' > "$HOSTS_OUTPUT"
# remove temporary file with IP addresses to monitor
rm -f "$HOSTS_INPUT"

Také k dispozici: Unified diff