jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [modules/] [traffic/] [setup] - Blame information for rev 17

 

Line No. Rev Author Line
11simandl#!/usr/bin/env sh
2 
3if ! [ -e settings ]; then OUTFILE="settings"; else OUTFILE="settings.new"; fi
4 
5cat > $OUTFILE << EOF
6# Which kind of legend shall be used
7# set STYLE="bytes" to display all values in bytes/s
8# set STYLE="bits" to display all values in bits/s
9#
10EOF
11var=`cat settings|grep "^STYLE="`
12if [ "$var" = "" ]; then var="STYLE=\"bytes\""; fi
13echo "$var" >> $OUTFILE
14 
15cat >> $OUTFILE << EOF
16 
17# Shall input and output traffic be swaped ?
18# (possible values for "yes" are: "yes" "true" "1")
19#
20EOF
21var=`cat settings|grep "^SWAPIO="`
22if [ "$var" = "" ]; then var="SWAPIO=\"no\""; fi
23echo "$var" >> $OUTFILE
24 
25cat >> $OUTFILE << EOF
26 
27# Use fixed-scale or dynamically scaled graphs. This affects ALL diagrams!
28# set SCALE="-1000" to use dynamically scaing with a minimum scale of
29# 1000 bytes/s (default)
30# set SCALE="12345" to set the fixed scale of the graphs to 12345 bytes/s
31#
32# If nothing is defined here, the defaults (dynamic scaling with a minimum
33# scale of 1000 bytes/s) will be used
34#
35EOF
36var=`cat settings|grep "^SCALE="`
37if [ "$var" = "" ]; then var="SCALE=\"-1000\""; fi
38echo "$var" >> $OUTFILE
39 
40cat >> $OUTFILE <<EOF
41 
42# Configure one line for each device that shall be sampled:
43#
44# DEV=<device>,<max bytes/s input>,<max bytes/s output>,<description>
45#
46# <device> is the network-device you like to sample
47#
48# for SNMP queries the <device> entry has the following format:
49#
50# SNMP:<host>:<community>:<interface>
51#
52# <host> is the name or the IP of the host you want to query
53#
54# <community> self explaining (for newbies: the community acts almost
55# like a "password" for SNMP)
56#
57# <interface> the name of the interface on the remote-host
58#
59# Examples:
60#
61# DEV="eth0,12500000,12500000,100 MBit ethernet"
62# DEV="SNMP:192.168.1.1:public:eth0,12500000,12500000,100 MBit ethernet via SNMP"
63#
64EOF
65 
66#
67# configure interfaces
68#
69if [ "$OUTFILE" = "settings" ]; then
70 case `uname` in
71 *BSD)
72 INTERFACES=`ifconfig -l -u`
73 ;;
74 *)
75 INTERFACES=`netstat -ni|grep [0-9] |awk '{print $1}'|sed s/\*//|uniq`
76 ;;
77 esac
78 
79 echo
80 echo "Configuring local interfaces. Please answer these:"
81 for nn in $INTERFACES; do
82 where="x"
83 while [ "$where" != "y" ] && [ "$where" != "n" ]; do
84 echo -n "found: $nn - (y)es or (n)o ? "
85 read where
86 case $where in
87 n) ;;
88 y) echo "DEV=\"$nn,12500000,12500000,100 MBit Ethernet\"" >> $OUTFILE ;;
89 *) echo "please answer with \"y\" or \"n\"" ;;
90 esac
91 echo
92 done
93 done
94 echo >> $OUTFILE
95else
96 cat settings|grep "^DEV=" >> $OUTFILE
97 fi
98 
99echo
100echo "Please check the settings file and adapt it to satisfy your needs."
101echo "If you have any interfaces slower than 100 MBit, please change the"
102echo "corrosponding default values."
103echo "Maybe there are some additional interfaces or SNMP hosts you want"
104echo "to query."
105if [ "$OUTFILE" = "settings.new" ]; then
106 mkdir -p backup
107 NOW=`date +%Y%m%d-%H%M%S`
108 mv -f settings backup/settings-$NOW
109 mv -f settings.new settings
110 echo "a backup of the previous settings has been saved."
111 fi
112echo
113 

Powered by WebSVN 2.2.1