hotsanic |
Subversion Repositories: |
Compare with Previous - Blame - Download
#!/usr/bin/env perl
# $Id: setup.pl,v 1.11 2004/08/30 11:55:07 bernisys Exp $
# include PERL libraries
use strict;
use warnings;
use diagnostics;
# include HotSaNIC libraries
use lib "../../lib";
use lib "./platform";
use HotSaNICparser;
use HotSaNIClog;
use common;
$|=1;
(my $VERSION = '$Revision: 1.11 $') =~ s/.*(\d+\.\d+).*/$1/;
(my $IDENTIFIER = '$Id: setup.pl,v 1.11 2004/08/30 11:55:07 bernisys Exp $') =~ s/.*,v (.*) \$/$1/;
my $MODNAME=HotSaNICparser::get_module_name();
my %MODCONF=HotSaNICmod::common::configure();
my $OUTFILE="settings.new";
if ( ! -e "settings" ) { $OUTFILE="settings"; }
open OUTFILE,">$OUTFILE" || die "could not open ".HotSaNICparser::get_module_name()." settings file for writing.\n";
if (@{$MODCONF{HOST}}) { $MODCONF{HOST}="HOST=\"".join("\"\nHOST=\"",@{$MODCONF{HOST}})."\""; }
$MODCONF{IRQ}="IRQ=\"".join("\"\nIRQ=\"",@{$MODCONF{IRQ}})."\"";
if ($MODCONF{NUMCPU} eq "") { $MODCONF{NUMCPU}=1; }
print OUTFILE "# SHORT DESCRIPTION
#
# If you own a multiprocessor machine and want your CPU graphs
# to show values reaching above 1, specify the number of
# installed CPUs here. This is just a multiplier and does only
# effect the diagrams, not the values stored!
#
NUMCPU=\"$MODCONF{NUMCPU}\"
# If you prefer a percentage legend over the absoulte inthe CPU diagrams,
# just set
# GRAPH_BASE.CPU=\"percent\"
# otherwhise set it to \"absolute\" or \"none\".
#
# This item was previously named \"CPUGRAPH\"
#
GRAPH_BASE.CPU=\"".$MODCONF{"GRAPH_BASE.CPU"}."\"
# If you want maximum usage lines also be plotted in weekly, monthly and yearly graph, say:
# CPU_SHOW_MAX=\"yes\"
# otherwhise set it to something else.
#
CPU_SHOW_MAX=\"$MODCONF{CPU_SHOW_MAX}\"
# Configure which module sections to run locally
#
# Example:
# SECTIONS=\"cpu load proc mem swap users irq uptime\"
#
SECTIONS=\"$MODCONF{SECTIONS}\"
# Configure SNMP monitored hosts
#
# HOST=SNMP:<host>:<community>,<description>,sections
#
# Example:
# HOST=\"SNMP:somehost:public,Router,cpu mem swap\"
#
$MODCONF{HOST}
# IRQ description
#
# IRQ=<number>,<short description>
#
# The short description will be trimmed to 5 chars in the diagrams.
#
# example (for an IBM compatible PC):
#
# IRQ=0,timer
# IRQ=1,kbd
# IRQ=2,casc
# IRQ=3,ser1
# IRQ=4,ser2
# IRQ=5,?
# IRQ=6,fdd
# IRQ=7,lpt
# IRQ=8,rtc
# IRQ=9,?
# IRQ=10,?
# IRQ=11,?
# IRQ=12,?
# IRQ=13,CoPro
# IRQ=14,?
# IRQ=15,?
#
$MODCONF{IRQ}
";
close OUTFILE;
if ($OUTFILE eq "settings.new") {
HotSaNICparser::backup_file("settings");
rename "settings.new","settings";
}
print "Please check the settings file and adapt it to satisfy your needs.\n";