| 1 | 1 | simandl | #!/usr/bin/env perl |
| 2 | | | |
| 3 | | | # $Id: setup.pl,v 1.11 2004/07/12 07:50:15 bernisys Exp $ |
| 4 | | | |
| 5 | | | # include PERL libraries |
| 6 | | | use strict; |
| 7 | | | use warnings; |
| 8 | | | use diagnostics; |
| 9 | | | |
| 10 | | | # include HotSaNIC libraries |
| 11 | | | use lib "../../lib"; |
| 12 | | | use lib "./platform"; |
| 13 | | | use HotSaNICparser; |
| 14 | | | |
| 15 | | | use HotSaNIClog; |
| 16 | | | use common; |
| 17 | | | |
| 18 | | | $|=1; |
| 19 | | | |
| 20 | | | (my $VERSION = '$Revision: 1.11 $') =~ s/.*(\d+\.\d+).*/$1/; |
| 21 | | | (my $IDENTIFIER = '$Id: setup.pl,v 1.11 2004/07/12 07:50:15 bernisys Exp $') =~ s/.*,v (.*) \$/$1/; |
| 22 | | | |
| 23 | | | my $MODNAME=HotSaNICparser::get_module_name(); |
| 24 | | | my %MODCONF=HotSaNICmod::common::configure(); |
| 25 | | | my $OUTFILE="settings.new"; |
| 26 | | | if ( ! -e "settings" ) { $OUTFILE="settings"; } |
| 27 | | | open OUTFILE,">$OUTFILE" || die "could not open ".HotSaNICparser::get_module_name()." settings file for writing.\n"; |
| 28 | | | |
| 29 | | | if (@{$MODCONF{HOST}}) { $MODCONF{HOST}="HOST=\"".join("\"\nHOST=\"",@{$MODCONF{HOST}})."\""; } |
| 30 | | | else { $MODCONF{HOST}=""; } |
| 31 | | | |
| 32 | | | |
| 33 | | | print OUTFILE "# query-interval in seconds. |
| 34 | | | # |
| 35 | | | INTERVAL=\"$MODCONF{INTERVAL}\" |
| 36 | | | |
| 37 | | | # set type of diagrams (whatever you like best ... Thanx M. Renner! :) ) |
| 38 | | | # classic (default) -> shade ranges for min, avg, max in different colors |
| 39 | | | # simple -> only shade area between min and max in light blue |
| 40 | | | # |
| 41 | | | TYPE=\"$MODCONF{TYPE}\" |
| 42 | | | |
| 43 | | | # set diagram scaling |
| 44 | | | # log -> set logarithmic scaling (default) |
| 45 | | | # lin -> set linear scaling |
| 46 | | | # |
| 47 | | | # This item was previously named \"SCALE\" |
| 48 | | | # |
| 49 | | | GRAPH_STYLE=\"$MODCONF{GRAPH_STYLE}\" |
| 50 | | | |
| 51 | | | # set diagram initial upper border in milliseconds (for better graph comparison) |
| 52 | | | # GRAPH_MAX=\"10\" sets all diagrams upper border to 10ms |
| 53 | | | # GRAPH_MAX=\"0.01\" sets all diagrams upper border to 100us |
| 54 | | | # |
| 55 | | | # This item was previously named \"UPPER\" |
| 56 | | | # |
| 57 | | | GRAPH_MAX=\"$MODCONF{GRAPH_MAX}\" |
| 58 | | | |
| 59 | | | # how many ping processes shall be done in parallel. Reducing the number |
| 60 | | | # causes the process to run longer, but keeps your system load a bit lower. |
| 61 | | | # |
| 62 | | | PARALLEL=\"$MODCONF{PARALLEL}\" |
| 63 | | | |
| 64 | | | # which PING method shall be used by default |
| 65 | | | # If you run HotSaNIC without root privileges, you should either use \"ping\" or |
| 66 | | | # \"perl-tcp\" - but note, that some hosts don't reply to tcp ping packages! |
| 67 | | | # |
| 68 | | | # valid methods are: |
| 69 | | | # perl-icmp use Net::Ping library / Proto: ICMP (default) |
| 70 | | | # perl-tcp use Net::Ping library / Proto: TCP |
| 71 | | | # ping use the system's \"ping\" command |
| 72 | | | # echo use \"echoping\" / Proto: ECHO |
| 73 | | | # echo-udp use \"echoping\" / Proto: UDP |
| 74 | | | # echo-icp use \"echoping\" / Proto: ICP |
| 75 | | | # echo-http use \"echoping\" / Proto: HTTP |
| 76 | | | # echo-smtp use \"echoping\" / Proto: SMTP |
| 77 | | | # echo-disc use \"echoping\" / Proto: discharge |
| 78 | | | # echo-cgen use \"echoping\" / Proto: chargen |
| 79 | | | # |
| 80 | | | METHOD=\"$MODCONF{METHOD}\" |
| 81 | | | |
| 82 | | | # configure multiple destinations of the form: |
| 83 | | | # HOST=<host>,<description>,<method> |
| 84 | | | # |
| 85 | | | # method can be one of the above methods, it overrides the default method |
| 86 | | | # |
| 87 | | | $MODCONF{HOST} |
| 88 | | | "; |
| 89 | | | |
| 90 | | | close OUTFILE; |
| 91 | | | |
| 92 | | | if ($OUTFILE eq "settings.new") { |
| 93 | | | HotSaNICparser::backup_file("settings"); |
| 94 | | | rename "settings.new","settings"; |
| 95 | | | } |
| 96 | | | |
| 97 | | | print "Please check the settings file and adapt it to satisfy your needs.\n"; |
| 98 | | | if ($OUTFILE ne "settings.new") { |
| 99 | | | print "you probably have to configure some destination hosts.\n"; |
| 100 | | | } |
| 101 | | | |