jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [modules/] [ping/] [setup] - Rev 26 Go to most recent revision

Compare with Previous - Blame - Download


#!/usr/bin/env sh

if ! [ -e settings ]; then OUTFILE="settings"; else OUTFILE="settings.new"; fi

cat > $OUTFILE << EOF
# query-interval in seconds.
# 
EOF
var=`cat settings|grep "^INTERVAL="`
if [ "$var" = "" ]; then var="INTERVAL=\"60\"";fi
echo $var >> $OUTFILE

cat >> $OUTFILE << EOF

# set type of diagrams (whatever you like best ... Thanx M. Renner! :) )
#   classic (default)  ->  shade ranges for min, avg, max in different colors
#   simple             ->  only shade area between min and max in light blue
#
EOF
var=`cat settings|grep "^TYPE="`
if [ "$var" = "" ]; then var="TYPE=\"classic\"";fi
echo $var >> $OUTFILE
  
cat >> $OUTFILE << EOF

# set diagram scaling
#   log -> set logarithmic scaling (default)
#   lin -> set linear scaling
#
EOF
var=`cat settings|grep "^SCALE="`
if [ "$var" = "" ]; then var="SCALE=\"log\"";fi
echo $var >> $OUTFILE
  
cat >> $OUTFILE << EOF

# set diagram initial upper border in milliseconds (for better graph comparison)
#   UPPER="10"     sets all diagrams upper border to 10ms
#   UPPER="0.01"   sets all diagrams upper border to 100us
#
EOF
var=`cat settings|grep "^UPPER="`
if [ "$var" = "" ]; then var="UPPER=\"1\"";fi
echo $var >> $OUTFILE
  
cat >> $OUTFILE << EOF

# how many ping processes shall be done in parallel. Reducing the number
# causes the process to run longer, but keeps your system load a bit lower.
#
EOF
var=`cat settings|grep "^PARALLEL="`
if [ "$var" = "" ]; then var="PARALLEL=\"4\"";fi
echo $var >> $OUTFILE
  
cat >> $OUTFILE << EOF

# use system's "ping" command instead of perl library. This is useful when not
# running as root. Fallback is implemented in case Net::Ping is not installed
# on your system
#
#   SYSPING="0"   use Net::Ping library (default)
#   SYSPING="1"   use system command
#
EOF
var=`cat settings|grep "^SYSPING="`
if [ "$var" = "" ]; then var="SYSPING=\"0\"";fi
echo $var >> $OUTFILE
  
cat >> $OUTFILE << EOF

# If SYSPING is set to "0", then you may specify the protocol used to ping all
# hosts. Valid are "icmp" (the default) and "tcp". If you run HotSaNIC without
# root privileges, you should use "tcp" - but note, that some hosts don't reply
# to tcp ping packages!
#
#   PROTOCOL="icmp"
#
EOF
var=`cat settings|grep "^PROTOCOL="`
if [ "$var" = "" ]; then var="PROTOCOL=\"icmp\"";fi
echo $var >> $OUTFILE
  
cat >> $OUTFILE << EOF

# configure multiple destinations of the form:
# HOST=<host>,<description>
#
EOF

if [ "$OUTFILE" = "settings.new" ]; then
  cat settings | grep "^HOST=" >> $OUTFILE
  fi

echo
echo "Please check the settings file and adapt it to satisfy your needs."
echo "you have to configure some destination hosts."
if [ "$OUTFILE" = "settings.new" ]; then
  mkdir -p backup
  NOW=`date +%Y%m%d-%H%M%S`
  mv -f settings backup/settings-$NOW
  mv -f settings.new settings
  echo "a backup of the previous settings has been saved."
  fi
echo


Powered by WebSVN 2.2.1