1 | 1 | simandl | #!/usr/bin/env sh |
2 | | | |
3 | | | if ! [ -e settings ]; then OUTFILE="settings"; else OUTFILE="settings.new"; fi |
4 | | | |
5 | | | cat > $OUTFILE << EOF |
6 | | | # query-interval in seconds. |
7 | | | # |
8 | | | EOF |
9 | | | var=`cat settings|grep "^INTERVAL="` |
10 | | | if [ "$var" = "" ]; then var="INTERVAL=\"60\"";fi |
11 | | | echo $var >> $OUTFILE |
12 | | | |
13 | | | cat >> $OUTFILE << EOF |
14 | | | |
15 | | | # set type of diagrams (whatever you like best ... Thanx M. Renner! :) ) |
16 | | | # classic (default) -> shade ranges for min, avg, max in different colors |
17 | | | # simple -> only shade area between min and max in light blue |
18 | | | # |
19 | | | EOF |
20 | | | var=`cat settings|grep "^TYPE="` |
21 | | | if [ "$var" = "" ]; then var="TYPE=\"classic\"";fi |
22 | | | echo $var >> $OUTFILE |
23 | | | |
24 | | | cat >> $OUTFILE << EOF |
25 | | | |
26 | | | # set diagram scaling |
27 | | | # log -> set logarithmic scaling (default) |
28 | | | # lin -> set linear scaling |
29 | | | # |
30 | | | EOF |
31 | | | var=`cat settings|grep "^SCALE="` |
32 | | | if [ "$var" = "" ]; then var="SCALE=\"log\"";fi |
33 | | | echo $var >> $OUTFILE |
34 | | | |
35 | | | cat >> $OUTFILE << EOF |
36 | | | |
37 | | | # set diagram initial upper border in milliseconds (for better graph comparison) |
38 | | | # UPPER="10" sets all diagrams upper border to 10ms |
39 | | | # UPPER="0.01" sets all diagrams upper border to 100us |
40 | | | # |
41 | | | EOF |
42 | | | var=`cat settings|grep "^UPPER="` |
43 | | | if [ "$var" = "" ]; then var="UPPER=\"1\"";fi |
44 | | | echo $var >> $OUTFILE |
45 | | | |
46 | | | cat >> $OUTFILE << EOF |
47 | | | |
48 | | | # how many ping processes shall be done in parallel. Reducing the number |
49 | | | # causes the process to run longer, but keeps your system load a bit lower. |
50 | | | # |
51 | | | EOF |
52 | | | var=`cat settings|grep "^PARALLEL="` |
53 | | | if [ "$var" = "" ]; then var="PARALLEL=\"4\"";fi |
54 | | | echo $var >> $OUTFILE |
55 | | | |
56 | | | cat >> $OUTFILE << EOF |
57 | | | |
58 | | | # use system's "ping" command instead of perl library. This is useful when not |
59 | | | # running as root. Fallback is implemented in case Net::Ping is not installed |
60 | | | # on your system |
61 | | | # |
62 | | | # SYSPING="0" use Net::Ping library (default) |
63 | | | # SYSPING="1" use system command |
64 | | | # |
65 | | | EOF |
66 | | | var=`cat settings|grep "^SYSPING="` |
67 | | | if [ "$var" = "" ]; then var="SYSPING=\"0\"";fi |
68 | | | echo $var >> $OUTFILE |
69 | | | |
70 | | | cat >> $OUTFILE << EOF |
71 | | | |
72 | | | # If SYSPING is set to "0", then you may specify the protocol used to ping all |
73 | | | # hosts. Valid are "icmp" (the default) and "tcp". If you run HotSaNIC without |
74 | | | # root privileges, you should use "tcp" - but note, that some hosts don't reply |
75 | | | # to tcp ping packages! |
76 | | | # |
77 | | | # PROTOCOL="icmp" |
78 | | | # |
79 | | | EOF |
80 | | | var=`cat settings|grep "^PROTOCOL="` |
81 | | | if [ "$var" = "" ]; then var="PROTOCOL=\"icmp\"";fi |
82 | | | echo $var >> $OUTFILE |
83 | | | |
84 | | | cat >> $OUTFILE << EOF |
85 | | | |
86 | | | # configure multiple destinations of the form: |
87 | | | # HOST=<host>,<description> |
88 | | | # |
89 | | | EOF |
90 | | | |
91 | | | if [ "$OUTFILE" = "settings.new" ]; then |
92 | | | cat settings | grep "^HOST=" >> $OUTFILE |
93 | | | fi |
94 | | | |
95 | | | echo |
96 | | | echo "Please check the settings file and adapt it to satisfy your needs." |
97 | | | echo "you have to configure some destination hosts." |
98 | | | if [ "$OUTFILE" = "settings.new" ]; then |
99 | | | mkdir -p backup |
100 | | | NOW=`date +%Y%m%d-%H%M%S` |
101 | | | mv -f settings backup/settings-$NOW |
102 | | | mv -f settings.new settings |
103 | | | echo "a backup of the previous settings has been saved." |
104 | | | fi |
105 | | | echo |
106 | | | |