Looks like you need to change the call: my $iface = `oda read_records oscar.interface`;
to my $iface = get_headnode_iface(); This was fixed just recently - perhaps you were modifying an earlier checkout? Also, the syntax for gmetad's data_source and grid is: data_source "OSCAR Cluster" rhel4u2-x86.bcgsc.ca gridname "OSCAR" There is no "=". Thanks, Bernard > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of Bernard Li > Sent: Thursday, December 22, 2005 11:47 > To: [email protected]; > [EMAIL PROTECTED] > Subject: RE: [Oscar-checkins] r4082 - in > trunk/packages/ganglia: . scripts > > Hey Erich: > > Thanks for doing this. > > Can you please convert the print statements to Opkg::print statements? > > Also, I don't think this is working in the multi-nic setup. > Previously > I have code for making sure that the headnode's gmond is > running on the > right interface (eth1 vs eth0). Right now gmond is running > on eth0 even > though my headnode interface is eth1. > > Cheers, > > Bernard > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf > > Of [EMAIL PROTECTED] > > Sent: Thursday, December 22, 2005 10:29 > > To: [EMAIL PROTECTED] > > Subject: [Oscar-checkins] r4082 - in > trunk/packages/ganglia: . scripts > > > > Author: efocht > > Date: 2005-12-22 13:28:57 -0500 (Thu, 22 Dec 2005) > > New Revision: 4082 > > > > Added: > > trunk/packages/ganglia/configurator_image.html > > trunk/packages/ganglia/scripts/edit_ganglia_conf > > trunk/packages/ganglia/scripts/post_rpm_nochroot > > Modified: > > trunk/packages/ganglia/config.xml > > trunk/packages/ganglia/configurator.html > > trunk/packages/ganglia/scripts/post_install > > trunk/packages/ganglia/scripts/post_server_install > > Log: > > The changes address: > > Bug 1289235 Ganglia package configuration not repeatable > > RFE 1275586 add mcast_port to ganglia configurator > > Following features have been added: > > - gmond send/receive ports are configurable in the GUI > > - separate configuration for each image is possible, such that > > subclusters are easier to build > > - configuration is smart and repeatable, it is able to > modify single > > gmond.conf blocks (though there is a limitation with > > multiple blocks > > of the same type). > > The post_install and post_server_install scripts are greatly > > simplified, > > they both use a new script called edit_ganglia_conf. The > > post_rpm_nochroot script is used to generate per image > configurations > > (if wanted/needed). The HTML config page for per image > > configs is stored > > in $OSCAR_PACKAGE_HOME/.configs/$imagename/ . > > > > > > Modified: trunk/packages/ganglia/config.xml > > =================================================================== > > --- trunk/packages/ganglia/config.xml 2005-12-22 07:30:36 UTC > > (rev 4081) > > +++ trunk/packages/ganglia/config.xml 2005-12-22 18:28:57 UTC > > (rev 4082) > > @@ -10,7 +10,7 @@ > > <major>3</major> > > <minor>0</minor> > > <subversion>2</subversion> > > - <release>1</release> > > + <release>2</release> > > <epoch>1</epoch> > > </version> > > > > > > Modified: trunk/packages/ganglia/configurator.html > > =================================================================== > > --- trunk/packages/ganglia/configurator.html 2005-12-22 > > 07:30:36 UTC (rev 4081) > > +++ trunk/packages/ganglia/configurator.html 2005-12-22 > > 18:28:57 UTC (rev 4082) > > @@ -1,3 +1,4 @@ > > +<!-- $Id$ --> > > <html> > > <head><title>Configuration for ganglia</title> > > </head> > > @@ -7,20 +8,42 @@ > > </center> > > Ganglia should work out of the box but will be using the > > default settings. > > Here you can configure a few settings (mostly names) for > > your ganglia setup > > -so that it will display the correct information about your > > nodes and/or cluster grid upon startup. > > +so that it will display the correct information about your > > nodes and/or > > +cluster grid upon startup. > > <form> > > -<p>Name of Cluster<br> > > -<input name="datasource" value="OSCAR Cluster"><br> > > +<p>Name of Cluster > > + <input name="cluster__name" value="OSCAR Cluster"><br> > > > > -<p>Name of Grid<br> > > -<input name="gridname" value="OSCAR"><br> > > +<p>Name of Grid > > + <input name="gridname" value="OSCAR"><br> > > > > <p>Owner of Cluster (Department, Company, etc...)<br> > > -<input name="owner" value="OSCAR"><br> > > + <input name="cluster__owner" value="OSCAR"><br> > > +<br> > > > > -<p>Network Interface for <b>***Client***</b> nodes<br> > > -<input name="iface" value="eth0"><br> > > +Client nodes can have multiple network interfaces. Specify > > which interface > > +should be used for sending/receiving ganglia monitoring > > information:<br> > > +<p>Sending Network Interface for <b>***Client***</b> nodes > > + <input name="udp_send_channel__mcast_if" value="eth0"><br> > > +<p>Receiving Network Interface for <b>***Client***</b> nodes > > + <input name="udp_recv_channel__mcast_if" value="eth0"><br> > > > > +<br> > > + > > +Enable per-image ganglia gmond configuration: > > +<input type="checkbox" name="gmond_per_image" value="YES"> > > +<br> > > +---- > > +<br> > > +When multiple clusters are in use it might make sense to use > > different > > +multicast ports for the client nodes such that the data from > > different > > +clusters doesn't interfere. Specify which multicast port > > +should be used for sending ganglia monitoring information:<br> > > +<p>Sending Network Port for <b>***Client***</b> nodes > > + <input name="udp_send_channel__port" value="8649"><br> > > +<p>Receiving Network Port for <b>***Client***</b> nodes > > + <input name="udp_recv_channel__port" value="8649"><br> > > + > > <p> > > <input type=reset value='Reset Form'> > > <p> > > > > > > Property changes on: trunk/packages/ganglia/configurator.html > > ___________________________________________________________________ > > Name: svn:keywords > > + Id > > > > Added: trunk/packages/ganglia/configurator_image.html > > =================================================================== > > --- trunk/packages/ganglia/configurator_image.html > > 2005-12-22 07:30:36 UTC (rev 4081) > > +++ trunk/packages/ganglia/configurator_image.html > > 2005-12-22 18:28:57 UTC (rev 4082) > > @@ -0,0 +1,41 @@ > > +<!-- $Id$ --> > > +<html> > > +<head><title>Ganglia config for image @IMAGENAME@</title> > > +</head> > > +<body> > > +<center> > > +<h1>Configuring ganglia for image @IMAGENAME@</h1> > > +</center> > > +This configuration is specific to the nodes attributed to the > > +image <b>@IMAGENAME@</b>. You might want to separate the > > (sub)clusters > > +defined by each image and give them different names and > > gmond ports!<br> > > +<form> > > +<p>Name of (sub)cluster > > + <input name="cluster__name" value="OSCAR Cluster"><br> > > +<p> > > +Client nodes can have multiple network interfaces. Specify > > which interface > > +should be used for sending/receiving ganglia monitoring > > information:<br> > > +<p> > > +Sending Network Interface for <b>***Client***</b> nodes > > + <input name="udp_send_channel__mcast_if" value="eth0"><br> > > +Receiving Network Interface for <b>***Client***</b> nodes > > + <input name="udp_recv_channel__mcast_if" value="eth0"><br> > > +<br> > > +<p> > > +When multiple clusters are in use it might make sense to use > > different > > +multicast ports for the client nodes such that the data from > > different > > +clusters doesn't interfere. Specify which multicast port > > +should be used for sending ganglia monitoring information:<br> > > +<p> > > +Sending Network Port for <b>***Client***</b> nodes > > + <input name="udp_send_channel__port" value="8649"><br> > > +Receiving Network Port for <b>***Client***</b> nodes > > + <input name="udp_recv_channel__port" value="8649"><br> > > + > > +<p> > > +<input type=reset value='Reset Form'> > > +<p> > > +</form> > > +<hr> > > +</body> > > +</html> > > > > > > Property changes on: trunk/packages/ganglia/configurator_image.html > > ___________________________________________________________________ > > Name: svn:keywords > > + Id > > > > Added: trunk/packages/ganglia/scripts/edit_ganglia_conf > > =================================================================== > > --- trunk/packages/ganglia/scripts/edit_ganglia_conf > > 2005-12-22 07:30:36 UTC (rev 4081) > > +++ trunk/packages/ganglia/scripts/edit_ganglia_conf > > 2005-12-22 18:28:57 UTC (rev 4082) > > @@ -0,0 +1,411 @@ > > +#!/usr/bin/env /usr/bin/perl > > +# $Id$ > > +# > > +# This program is free software; you can redistribute it > > and/or modify > > +# it under the terms of the GNU General Public License as > > published by > > +# the Free Software Foundation; either version 2 of the License, or > > +# (at your option) any later version. > > +# > > +# This program is distributed in the hope that it will be useful, > > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > +# GNU General Public License for more details. > > +# > > +# You should have received a copy of the GNU General Public License > > +# along with this program; if not, write to the Free Software > > +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > > 02111-1307 USA > > +# > > +# This script reads the Configurator result and sets up the > > configuration > > +# files /etc/gmond.conf and /etc/gmetad.conf for the > server. Similar > > +# configuration steps are done for each image. > > +# > > +# Copyright 2005 Erich Focht <[EMAIL PROTECTED]> > > +# > > + > > +use XML::Simple; > > +use Carp; > > +use strict; > > +use Getopt::Long; > > +use lib "/usr/lib/systeminstaller"; > > +use SIS::DB; > > +use SIS::Image; > > +use SIS::Client; > > +use Data::Dumper; > > + > > +my ($do_gmond, $do_gmetad, $image, @options, $test, $verbose); > > +GetOptions( 'gmond' => \$do_gmond, > > + 'gmetad' => \$do_gmetad, > > + 'image=s' => \$image, > > + 'option=s'=> [EMAIL PROTECTED], > > + 'test' => \$test, > > + 'verbose' => \$verbose, ) > > + || usage(); > > + > > + > > +my $gmetad_conf = "/etc/gmetad.conf"; > > +my $gmond_conf = "/etc/gmond.conf"; > > +if ($test) { > > + $gmetad_conf = "gmetad.conf"; > > + $gmond_conf = "gmond.conf"; > > + $ENV{OSCAR_PACKAGE_HOME} = "."; > > +} > > +my $xml_data = "$ENV{OSCAR_PACKAGE_HOME}/.configurator.values"; > > +my $xml_imgd = "$ENV{OSCAR_PACKAGE_HOME}/.configs"; > > + > > +my $hostname = `hostname`; > > +chomp($hostname); > > + > > +# find image path > > +my $imgpath; > > +if ($image) { > > + my @imgs = list_image(name => $image); > > + if (!scalar(@imgs)) { > > + croak("Could not find image $image in the SIS database!\n"); > > + } > > + $imgpath = $imgs[0]->location; > > +} > > + > > +# get headnode's interface information from OSCAR database > > +my $iface = `oda read_records oscar.interface`; > > +chomp($iface); > > + > > + > > +# > > +# Default settings hash array: > > +# The keys which have corresponding fields in the > gmond.conf file are > > +# built by concatenating block and variable names. The > > separator is built out > > +# of two underscore symbols. For example the block > > +# cluster { > > +# name = "OSCARcluster" > > +# owner = "OSCAR" > > +# } > > +# leads to two potential key values: cluster__name and > cluster__owner > > +# Multiple blocking levels are allowed. > > +# These keys should be identical to the variable names in > > the configurator.xml > > +# file! > > +# > > +# > > +my %default = ( > > + cluster__name => "OSCAR cluster", > > + cluster__owner => "OSCAR", > > + udp_send_channel__mcast_if => "$iface", > > + udp_send_channel__port => "8649", > > + udp_recv_channel__mcast_if => "$iface", > > + udp_recv_channel__port => "8649", > > + gridname => "OSCAR", > > + datasource => "$hostname", > > + gmond_per_image => "NO", > > +); > > + > > + > > +my $master_conf; > > +if (-e $xml_data) { > > + $master_conf = XMLin($xml_data); > > +} else { > > + $master_conf = \%default; > > +} > > + > > +if ($image) { > > + if ($do_gmond) { > > + my $gmond_img = $imgpath.$gmond_conf; > > + if ($master_conf->{gmond_per_image} eq "YES") { > > + # > > + # per image configuration > > + # > > + my $xml_img = "$xml_imgd/$image/.configurator.values"; > > + # > > + # read in per image configurator data, if it exists > > + # > > + if (-e $xml_img) { > > + vprint("using per image values file $xml_img\n"); > > + my $img_conf = XMLin($xml_img); > > + vprint(Dumper(%{$img_conf})); > > + add_missing_keys($master_conf, $img_conf); > > + &edit_gmond_conf($gmond_img, $img_conf); > > + } else { > > + croak("Per image configuration expected, but no > > values file found for $image!\n"); > > + } > > + } else { > > + # > > + # copy master gmond configuration to image > > + # > > + !system("cp -p $gmond_conf $gmond_img") or > > + croak("Could not copy $gmond_conf to $gmond_img: $!"); > > + } > > + } > > +} else { > > + # > > + # master configuration > > + # > > + if ($do_gmond) { > > + &edit_gmond_conf($gmond_conf, $master_conf); > > + &restart_gmond(); > > + } > > + if ($do_gmetad) { > > + &add_multicast_route(); > > + &edit_gmetad_conf($gmetad_conf, $master_conf); > > + &restart_gmetad(); > > + } > > +} > > +exit 0; > > + > > + > > +sub usage { > > + print "Usage:\n"; > > + print " $0 [--gmetad] [--gmond] [--image <image>] > > [--verbose]\n"; > > + exit 1; > > +} > > + > > +sub vprint { > > + if ($verbose) { > > + print STDERR (@_); > > + } > > +} > > + > > +sub add_missing_keys { > > + my ($src, $tgt) = @_; > > + for my $k (keys(%{$src})) { > > + if (!exists($tgt->{$k})) { > > + $tgt->{$k} = $src->{$k}; > > + } > > + } > > +} > > + > > +############## > > +### gmetad ### > > +############## > > + > > +sub edit_gmetad_conf { > > + my ($gmetad_conf, $ref) = @_; > > + my %config = %{$ref}; > > + > > + vprint("editing $gmetad_conf\n"); > > + # > > + # Replacement patterns for gmetad.conf transformations > > + # Variables in <..> are replaced by their values in the > > + # configuration file! Be sure to quote stuff like \" > > + # Keys of this hash must be the variable names related to > > + # gmetad configuration. > > + # > > + my %del_patterns = ( > > + gridname => "gridname\\s*=.*", > > + datasource => "data_source\\s+.*", > > + ); > > + my %add_patterns = ( > > + gridname => "gridname = \"<gridname>\"", > > + datasource => "data_source \"<cluster__name>\" $hostname", > > + ); > > + > > + my @gmetad; > > + open(CONF, $gmetad_conf) or > > + croak("Error: unable to open ($gmetad_conf)\n"); > > + @gmetad = <CONF>; > > + close(CONF); > > + > > + # > > + # filter out gmetad delete patterns > > + # > > + for my $pat (keys %del_patterns) { > > + my $match = $del_patterns{$pat}; > > + vprint("match: $match\n"); > > + my @tmp = grep !/\s*($match)$/, @gmetad; > > + @gmetad = @tmp; > > + } > > + > > + # > > + # append gmetad add_patterns with substituted variables > > + # > > + for my $pat (keys %add_patterns) { > > + my $line = $add_patterns{$pat}; > > + my @vars; > > + my $replaces = $line; > > + while ($replaces =~ s/<(\w+)>//) { > > + my $var = $1; > > + push @vars, $var; > > + if (exists($ref->{$var})) { > > + $line =~ s/<$var>/$config{$var}/; > > + } > > + } > > + push @gmetad, "$line\n"; > > + } > > + > > + # > > + # for per-image configs, add data sources for each cluster > > + # > > + if ($config{gmond_per_image} eq "YES") { > > + for my $ds (@{&img_datasources(\%config)}) { > > + push @gmetad, $ds; > > + } > > + } > > + > > + if ($test) { > > + print STDOUT @gmetad; > > + return; > > + } > > + open (OUT, "> $gmetad_conf") or > > + croak "Could not open $gmetad_conf"; > > + print OUT @gmetad; > > + close(OUT); > > +} > > + > > +sub img_datasources { > > + my ($ref) = @_; > > + my %config = %{$ref}; > > + my @out; > > + my %imgcfg; > > + > > + vprint("finding datasources for each image\n"); > > + my $master_port = $config{udp_recv_channel__port}; > > + # images configured > > + my @imgs = glob("$xml_imgd/*"); > > + vprint("img_datasources: images: ".join(" ",@imgs)."\n"); > > + foreach (@imgs) { > > + s/.*\///g; # basename > > + } > > + for my $img (@imgs) { > > + vprint("finding gmetad config for image $img\n"); > > + # get cluster name and port from per image config > > + # if same port as master, skip > > + my $xml_img = "$xml_imgd/$img/.configurator.values"; > > + if (-e $xml_img) { > > + %imgcfg = %{XMLin($xml_img)}; > > + } else { > > + print "configurator values for image $img not found!\n"; > > + next; > > + } > > + my $imgport = $imgcfg{udp_send_channel__port}; > > + if ($master_port eq $imgport) { > > + print STDERR "Image $img nodes use same gmond port > > as master.\n"; > > + print STDERR "Skipping $img nodes as gmetad data_source\n"; > > + next; > > + } > > + my $imgcname = $imgcfg{cluster__name}; > > + > > + # get list of nodes attributed to image > > + my @imgnodes; > > + for my $i (list_client(imagename => $img)) { > > + my $name = $i->name; > > + push @imgnodes, $name if ($name); > > + } > > + next if (!scalar(@imgnodes)); > > + > > + # create data_source entry > > + my $line = "data_source \"$imgcname\" ".join(" > > ",@imgnodes)."\n"; > > + vprint("per image datasource ($img) : $line\n"); > > + push @out, $line; > > + } > > + return [EMAIL PROTECTED]; > > +} > > + > > +############# > > +### gmond ### > > +############# > > +sub edit_gmond_conf { > > + my ($gmond_conf, $ref) = @_; > > + my %config = %{$ref}; > > + my @keywords = keys(%config); > > + my @stack; > > + my $level=0; > > + my $comment=0; > > + > > + vprint("editing $gmond_conf\n"); > > + open IN, $gmond_conf or croak "Could not open file $!"; > > + my @gmond = <IN>; > > + close(IN); > > + > > + open OUT, "> $gmond_conf" or croak "Could not open file $!"; > > + foreach (@gmond) { > > + chomp; > > + # ignore full line comments > > + if (/^\s*\/\*.*\*\/\s*$/) { > > + goto out; > > + } > > + if (/^\s*\/\*/) { > > + $comment = 1; > > + goto out; > > + } > > + if (/\*\/\s*$/) { > > + $comment = 0; > > + goto out; > > + } > > + goto out if ($comment); > > + # > > + if (/^\s*(\S+)\s*\{/) { > > + my $block = $1; > > + push @stack, $block; > > + $level++; > > + } > > + if (/^\s*\}\s*$/) { > > + $level--; > > + pop @stack; > > + } > > + if (/^(\s*)(\S+)\s*=(.*)$/) { > > + my $blank = $1; > > + my $name = $2; > > + my $value = $3; > > + $value =~ s/^\s+//; > > + $value =~ s/\s+$//; > > + # check if match > > + my $match = join("__",(@stack,$name)); > > + if (grep /$match/, @keywords) { > > + my $q; > > + $q = "\"" if ($value =~ /^\"/); > > + print OUT "$name = $q" . $config{$match} . > > "$q\n" if (!$test); > > + print "Changed line: $blank$name = $q" . > > $config{$match} . "$q\n"; > > + next; > > + } > > + } > > + out: > > + print OUT "$_\n" if (!$test); > > + } > > + close OUT; > > +} > > + > > +sub add_multicast_route { > > + my $route_string; > > + my $static_route_file; > > + my $reload_route; > > + > > + # FIXME: OCA Framework > > + # There are two different ways to setup static routes, > > Mandriva uses the "old" style right now... > > + if ( (-e "/etc/mandrake-release") || (-e > > "/etc/mandrakelinux-release") ) { > > + $route_string = "any net 224.0.0.0 netmask 240.0.0.0 > > dev $iface"; > > + $static_route_file = "/etc/sysconfig/static-routes"; > > + $reload_route = "service network restart"; > > + } else { > > + $route_string = "224.0.0.0/4 dev $iface"; > > + $static_route_file = > > "/etc/sysconfig/network-scripts/route-$iface"; > > + $reload_route = > > "/etc/sysconfig/network-scripts/ifup-routes $iface"; > > + } > > + > > + # Check to see if multicast route already exists > > + my $mcast_route = `route | grep 224.0.0.0 | grep $iface`; > > + > > + if (!($mcast_route)) { > > + if (-e $static_route_file) { > > + $mcast_route = `grep 224.0.0.0 $static_route_file`; > > + } > > + if (!($mcast_route)) { > > + print("Adding default route for multicast to go > > through $iface.\n"); > > + `echo $route_string >> $static_route_file`; > > + } > > + `$reload_route`; > > + } > > +} > > + > > +sub restart_gmond { > > + print("Ganglia gmond configuration file modified, > > re-starting daemon...\n"); > > + # restart gmond and gmetad > > + system("/etc/init.d/gmond restart"); > > +} > > + > > +sub restart_gmetad { > > + print("Ganglia gmetad configuration file modified, > > re-starting daemon...\n"); > > + # restart gmond and gmetad > > + system("/etc/init.d/gmetad restart"); > > + print("Starting up apache...\n"); > > + # autoload apache in levels 345 and start it up > > + system("/sbin/chkconfig --levels 345 httpd on"); > > + system("/etc/init.d/httpd start"); > > + print(">>>> Ganglia page is located at > > http://$hostname/ganglia/\n"); > > +} > > > > > > Property changes on: > trunk/packages/ganglia/scripts/edit_ganglia_conf > > ___________________________________________________________________ > > Name: svn:executable > > + * > > Name: svn:keywords > > + Id > > > > Modified: trunk/packages/ganglia/scripts/post_install > > =================================================================== > > --- trunk/packages/ganglia/scripts/post_install > > 2005-12-22 07:30:36 UTC (rev 4081) > > +++ trunk/packages/ganglia/scripts/post_install > > 2005-12-22 18:28:57 UTC (rev 4082) > > @@ -1,5 +1,6 @@ > > -#!/usr/bin/env perl > > - > > +#!/bin/sh > > +# $Id$ > > +# > > # This program is free software; you can redistribute it > > and/or modify > > # it under the terms of the GNU General Public License as > > published by > > # the Free Software Foundation; either version 2 of the License, or > > @@ -13,74 +14,12 @@ > > # You should have received a copy of the GNU General Public License > > # along with this program; if not, write to the Free Software > > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > > 02111-1307 USA > > +# > > +# This script modifies the server's gmetad.conf and restarts it. > > +# Finally it restarts all gmond daemons on all nodes. > > +# > > +# Copyright Erich Focht <[EMAIL PROTECTED]> 2005 > > > > -# This script modifies the server's gmond.conf if necessary > > and then pushes > > -# it to the compute nodes and restart the ganglia daemons > > - > > -# (C)opyright Bernard Li <[EMAIL PROTECTED]> > > - > > -use lib "$ENV{OSCAR_HOME}/lib"; > > -use OSCAR::Database; > > -use OSCAR::Opkg; > > -use Carp; > > -use XML::Simple; > > - > > -my $gmond_conf = '/tmp/gmond.conf'; > > -my $confBuffer = ""; > > - > > -# not useful currently, may be useful when define client > > supports changing of > > -# default interface via the GUI, as per RFE #791658 > > -#my @result = split(/ = /,`grep 'DEVICE = eth' > > /var/lib/systemimager/scripts/*.master`); > > -#my $iface = $result[1]; > > - > > -my $xml_data = "$ENV{OSCAR_PACKAGE_HOME}/.configurator.values"; > > - > > -# default interface for client nodes if package is not configured > > -my $iface = "eth0"; > > - > > -my $push_command = "/opt/c3-4/cpush"; > > -my $exec_command = "/opt/c3-4/cexec"; > > - > > -if (-e $xml_data) { > > - $ref = XMLin($xml_data); > > - $iface = $ref->{iface}; > > -} > > - > > -# get interface of headnode > > -my $headnode_iface = get_headnode_iface(); > > - > > -if ( $headnode_iface eq $iface ) { > > - opkg_print("Pushing headnode's gmond.conf to compute nodes\n"); > > - system("$push_command /etc/gmond.conf /etc/gmond.conf"); > > -} else { > > - system("cp /etc/gmond.conf $gmond_conf"); > > - > > - open(CONF, $gmond_conf) or croak("Error: unable to open > > ($gmond_conf)\n"); > > - > > - while ($line = <CONF>) { > > - $confBuffer = $confBuffer.$line; > > - } > > - > > - close(CONF, $gmond_conf); > > - > > - $confBuffer =~ s/mcast_if = eth[0-9]/mcast_if = $iface/g; > > - > > - open(CONF, '>'.$gmond_conf) or croak("Error: unable to > > open ($gmond_conf)\n"); > > - > > - print CONF $confBuffer; > > - > > - close(CONF); > > - > > - opkg_print("Pushing modified gmond.conf to compute nodes\n"); > > - system("$push_command $gmond_conf /etc/gmond.conf"); > > - > > - system("rm $gmond_conf"); > > -} > > - > > -# stop all running daemons and restart them all (on headnode > > and clients) > > -system("/etc/init.d/gmond stop"); > > -system("/etc/init.d/gmetad stop"); > > -system("$exec_command /etc/init.d/gmond stop"); > > -system("/etc/init.d/gmond start"); > > -system("$exec_command /etc/init.d/gmond start"); > > -system("/etc/init.d/gmetad start"); > > +$OSCAR_PACKAGE_HOME/scripts/edit_ganglia_conf --gmetad --verbose > > +/etc/init.d/gmond restart > > +cexec /etc/init.d/gmond restart > > > > > > Property changes on: trunk/packages/ganglia/scripts/post_install > > ___________________________________________________________________ > > Name: svn:keywords > > + Id > > > > Added: trunk/packages/ganglia/scripts/post_rpm_nochroot > > =================================================================== > > --- trunk/packages/ganglia/scripts/post_rpm_nochroot > > 2005-12-22 07:30:36 UTC (rev 4081) > > +++ trunk/packages/ganglia/scripts/post_rpm_nochroot > > 2005-12-22 18:28:57 UTC (rev 4082) > > @@ -0,0 +1,97 @@ > > +#!/usr/bin/env /usr/bin/perl > > +############################################################# > > ############ > > +# Script Name : post_rpm_nochroot > > +# Written by : Erich Focht > > +# Date : November 24, 2003 > > +# Purpose : This post_install script configures gmond for the > > +# nodes of a particular image. > > +# Copyright (c) Erich Focht 2003-2005 > > +# All rights reserved. > > +# > > +# This program is free software; you can redistribute it > > and/or modify > > +# it under the terms of the GNU General Public License as > > published by > > +# the Free Software Foundation; either version 2 of the License, or > > +# (at your option) any later version. > > +# > > +# This program is distributed in the hope that it will be useful, > > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > +# GNU General Public License for more details. > > +# > > +# You should have received a copy of the GNU General Public License > > +# along with this program; if not, write to the Free Software > > +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > > 02111-1307 USA > > +# > > +############################################################# > > ############ > > +# $Id$ > > +############################################################# > > ############ > > + > > +use strict; > > +use lib "$ENV{OSCAR_HOME}/lib"; > > +use Carp; > > +use POSIX; > > +use XML::Simple; > > +use Tk; > > +use OSCAR::Configbox; > > +use lib '/usr/lib/systeminstaller'; > > +use SIS::DB; > > +use SIS::Image; > > + > > +my $configdir = "$ENV{OSCAR_PACKAGE_HOME}/.configs"; > > + > > +my $imagedir = shift @ARGV; > > +$imagedir =~ s/\/$//; > > +my $image = $imagedir; > > +$image =~ s:^.*/::g; > > + > > +my $window; > > + > > +##################### > > +# BEGIN MAIN SCRIPT # > > +##################### > > + > > +if (! -d $configdir) { > > + !system("mkdir ".$configdir) || do { > > + print "Could not create directory $configdir\n"; > > + exit 1; > > + }; > > +} > > + > > +my $imageconf = $configdir."/".$image; > > +my $valuesfile = $imageconf."/.configurator.values"; > > + > > +my $i = list_image(name=>$image); > > +if (!$i) { > > + carp "Could not find image $image!"; > > + exit 1; > > +} > > + > > +print "configuring gmond for image=$image > valuesfile=$valuesfile\n"; > > + > > +if (! -d $imageconf) { > > + !system("mkdir ".$imageconf) || do { > > + print "Could not create directory $imageconf\n"; > > + exit 1; > > + }; > > + if (! -e $imageconf."/configurator.html") { > > + !system("sed -e \"s/[EMAIL PROTECTED]@/$image/\" ". > > + "< $ENV{OSCAR_PACKAGE_HOME}/configurator_image.html ". > > + "> $imageconf/configurator.html") or > > + croak("Could not create > > $imageconf/configurator.html! $!\n"); > > + } > > +} else { > > + print "Found $imageconf\n"; > > +} > > + > > +if (!-f $valuesfile) { > > + OSCAR::Configbox::configurePackage(0, $imageconf); > > + MainLoop(); > > +} > > + > > +# > > +# do the gmond configuration according to the values file > > +# > > +exec "$ENV{OSCAR_PACKAGE_HOME}/scripts/edit_ganglia_conf > > --gmond --image $image --verbose" > > + or carp("Could not run edir_ganglia_conf! $!"); > > + > > +exit 0; > > > > > > Property changes on: > trunk/packages/ganglia/scripts/post_rpm_nochroot > > ___________________________________________________________________ > > Name: svn:executable > > + * > > Name: svn:keywords > > + Id > > > > Modified: trunk/packages/ganglia/scripts/post_server_install > > =================================================================== > > --- trunk/packages/ganglia/scripts/post_server_install > > 2005-12-22 07:30:36 UTC (rev 4081) > > +++ trunk/packages/ganglia/scripts/post_server_install > > 2005-12-22 18:28:57 UTC (rev 4082) > > @@ -1,4 +1,4 @@ > > -#!/usr/bin/env perl > > +#!/bin/bash > > > > # This program is free software; you can redistribute it > > and/or modify > > # it under the terms of the GNU General Public License as > > published by > > @@ -14,137 +14,11 @@ > > # along with this program; if not, write to the Free Software > > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA > > 02111-1307 USA > > > > -# This script reads the Configurator result and sets up the > > configuration > > -# files gmond.conf and gmetad.conf for the server > > +# This script modifies the server's gmond.conf according to > > the configurator values. > > > > -# (C)opyright Bernard Li <[EMAIL PROTECTED]> > > +# Copyright Erich Focht 2005 > > > > -use XML::Simple; > > -use Carp; > > -use lib "$ENV{OSCAR_HOME}/lib"; > > -use OSCAR::Database; > > -use OSCAR::Opkg; > > +/etc/init.d/gmond stop > > +$OSCAR_PACKAGE_HOME/scripts/edit_ganglia_conf --gmond --verbose > > +/etc/init.d/gmond start > > > > -my $gmondBuffer = ""; > > -my $gmetadBuffer = ""; > > - > > -my $hostname = `hostname`; > > -chomp($hostname); > > - > > -my $gmetad_conf = "/etc/gmetad.conf"; > > -my $gmond_conf = "/etc/gmond.conf"; > > - > > -my $xml_data = "$ENV{OSCAR_PACKAGE_HOME}/.configurator.values"; > > - > > -# default settings if user does not configure the package > > -my $data_source_default = "OSCAR Cluster"; > > -my $gridname_default = "OSCAR"; > > -my $owner_default = "OSCAR"; > > - > > -# get headnode's interface information from OSCAR database > > -my $iface = get_headnode_iface(); > > - > > -# need to modify gmond.conf file whether > > .configurator.values exists or not > > -open(CONF, $gmond_conf) or croak("Error: unable to open > > ($gmond_conf)\n"); > > - > > -while ($line = <CONF>) { > > - $gmondBuffer = $gmondBuffer.$line; > > -} > > - > > -close(CONF, $gmond_conf); > > - > > -$gmond_conf = ">".$gmond_conf; > > - > > -if (-e $xml_data) { > > - $ref = XMLin($xml_data); > > -} else { > > - $ref->{datasource} = $data_source_default; > > - $ref->{gridname} = $gridname_default; > > - $ref->{owner} = $owner_default; > > -} > > - > > -### gmetad ### > > - > > -open(CONF, $gmetad_conf) or croak("Error: unable to open > > ($gmetad_conf)\n"); > > - > > -while ($line = <CONF>) { > > - $gmetadBuffer = $gmetadBuffer.$line; > > -} > > - > > -close(CONF, $gmetad_conf); > > - > > -$gmetad_conf = ">".$gmetad_conf; > > - > > -$gmetadBuffer =~ s/data_source "my cluster" > > localhost/data_source "$ref->{datasource}" $hostname/; > > -$gmetadBuffer =~ s/# gridname "MyGrid"/gridname > "$ref->{gridname}"/; > > - > > -open(CONF, $gmetad_conf) or croak("Error: unable to open > > ($gmetad_conf)\n"); > > - > > -print CONF $gmetadBuffer; > > - > > -close(CONF); > > - > > -### gmond ### > > - > > -$gmondBuffer =~s/name = "unspecified"/name = > > "$ref->{datasource}"\n owner = "$ref->{owner}"/; > > - > > -my $num_iface = `ifconfig | grep eth | wc -l`; > > - > > -# If we have more than one ethernet interface, then set > > mcast_if for gmond.conf > > -if ($num_iface > 1) { > > - if ($gmondBuffer =~ "mcast_if") { > > - $gmondBuffer =~ s/mcast_if = eth[0-9]/mcast_if = $iface/g; > > - } else { > > - $gmondBuffer =~ s/mcast_join = 239.2.11.71/mcast_join = > > 239.2.11.71\n mcast_if = $iface/g; > > - } > > - > > - my $route_string; > > - my $static_route_file; > > - my $reload_route; > > - > > - # FIXME: OCA Framework > > - # There are two different ways to setup static routes, > > Mandriva uses the "old" style right now... > > - if ( (-e "/etc/mandrake-release") || (-e > > "/etc/mandrakelinux-release") ) { > > - $route_string = "any net 224.0.0.0 netmask 240.0.0.0 > > dev $iface"; > > - $static_route_file = "/etc/sysconfig/static-routes"; > > - $reload_route = "service network restart"; > > - } else { > > - $route_string = "224.0.0.0/4 dev $iface"; > > - $static_route_file = > > "/etc/sysconfig/network-scripts/route-$iface"; > > - $reload_route = > > "/etc/sysconfig/network-scripts/ifup-routes $iface"; > > - } > > - > > - # Check to see if multicast route already exists > > - my $mcast_route = `route | grep 224.0.0.0 | grep $iface`; > > - > > - if (!($mcast_route)) { > > - if (-e $static_route_file) { > > - $mcast_route = `grep 224.0.0.0 $static_route_file`; > > - } > > - if (!($mcast_route)) { > > - opkg_print("Adding default route for multicast > > to go through $iface.\n"); > > - `echo $route_string >> $static_route_file`; > > - } > > - `$reload_route`; > > - } > > -} > > - > > -open(CONF, $gmond_conf) or croak("Error: unable to open > > ($gmond_conf)\n"); > > - > > -print CONF $gmondBuffer; > > - > > -close(CONF); > > - > > -opkg_print("Ganglia configuration files modified, > > re-starting daemons...\n"); > > - > > -# restart gmond and gmetad > > -system("/etc/init.d/gmond restart"); > > -system("/etc/init.d/gmetad restart"); > > - > > -opkg_print("Starting up apache...\n"); > > - > > -# autoload apache in levels 345 and start it up > > -system("/sbin/chkconfig --levels 345 httpd on"); > > -system("/etc/init.d/httpd start"); > > - > > -opkg_print("Ganglia page is located at > http://localhost/ganglia\n"); > > > > > > Property changes on: > > trunk/packages/ganglia/scripts/post_server_install > > ___________________________________________________________________ > > Name: svn:keywords > > + Id > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep > > through log files > > for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. > > DOWNLOAD SPLUNK! > > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > > _______________________________________________ > > Oscar-checkins mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/oscar-checkins > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep > through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. > DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick > _______________________________________________ > Oscar-checkins mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/oscar-checkins > ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_idv37&alloc_id865&op=click _______________________________________________ Oscar-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oscar-devel
