1 | 1 | simandl | #!/usr/bin/env perl |
2 | | | |
3 | | | # $Id: setup.pl,v 1.11 2004/08/30 11:55:07 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/08/30 11:55:07 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 | | | $MODCONF{IRQ}="IRQ=\"".join("\"\nIRQ=\"",@{$MODCONF{IRQ}})."\""; |
31 | | | if ($MODCONF{NUMCPU} eq "") { $MODCONF{NUMCPU}=1; } |
32 | | | |
33 | | | print OUTFILE "# SHORT DESCRIPTION |
34 | | | # |
35 | | | # If you own a multiprocessor machine and want your CPU graphs |
36 | | | # to show values reaching above 1, specify the number of |
37 | | | # installed CPUs here. This is just a multiplier and does only |
38 | | | # effect the diagrams, not the values stored! |
39 | | | # |
40 | | | NUMCPU=\"$MODCONF{NUMCPU}\" |
41 | | | |
42 | | | # If you prefer a percentage legend over the absoulte inthe CPU diagrams, |
43 | | | # just set |
44 | | | # GRAPH_BASE.CPU=\"percent\" |
45 | | | # otherwhise set it to \"absolute\" or \"none\". |
46 | | | # |
47 | | | # This item was previously named \"CPUGRAPH\" |
48 | | | # |
49 | | | GRAPH_BASE.CPU=\"".$MODCONF{"GRAPH_BASE.CPU"}."\" |
50 | | | |
51 | | | # If you want maximum usage lines also be plotted in weekly, monthly and yearly graph, say: |
52 | | | # CPU_SHOW_MAX=\"yes\" |
53 | | | # otherwhise set it to something else. |
54 | | | # |
55 | | | CPU_SHOW_MAX=\"$MODCONF{CPU_SHOW_MAX}\" |
56 | | | |
57 | | | # Configure which module sections to run locally |
58 | | | # |
59 | | | # Example: |
60 | | | # SECTIONS=\"cpu load proc mem swap users irq uptime\" |
61 | | | # |
62 | | | SECTIONS=\"$MODCONF{SECTIONS}\" |
63 | | | |
64 | | | # Configure SNMP monitored hosts |
65 | | | # |
66 | | | # HOST=SNMP:<host>:<community>,<description>,sections |
67 | | | # |
68 | | | # Example: |
69 | | | # HOST=\"SNMP:somehost:public,Router,cpu mem swap\" |
70 | | | # |
71 | | | $MODCONF{HOST} |
72 | | | |
73 | | | # IRQ description |
74 | | | # |
75 | | | # IRQ=<number>,<short description> |
76 | | | # |
77 | | | # The short description will be trimmed to 5 chars in the diagrams. |
78 | | | # |
79 | | | # example (for an IBM compatible PC): |
80 | | | # |
81 | | | # IRQ=0,timer |
82 | | | # IRQ=1,kbd |
83 | | | # IRQ=2,casc |
84 | | | # IRQ=3,ser1 |
85 | | | # IRQ=4,ser2 |
86 | | | # IRQ=5,? |
87 | | | # IRQ=6,fdd |
88 | | | # IRQ=7,lpt |
89 | | | # IRQ=8,rtc |
90 | | | # IRQ=9,? |
91 | | | # IRQ=10,? |
92 | | | # IRQ=11,? |
93 | | | # IRQ=12,? |
94 | | | # IRQ=13,CoPro |
95 | | | # IRQ=14,? |
96 | | | # IRQ=15,? |
97 | | | # |
98 | | | $MODCONF{IRQ} |
99 | | | "; |
100 | | | |
101 | | | close OUTFILE; |
102 | | | |
103 | | | if ($OUTFILE eq "settings.new") { |
104 | | | HotSaNICparser::backup_file("settings"); |
105 | | | rename "settings.new","settings"; |
106 | | | } |
107 | | | |
108 | | | print "Please check the settings file and adapt it to satisfy your needs.\n"; |
109 | | | |