Subversion Repositories slis

Compare Revisions

Ignore whitespace Rev 5515 → Rev 5516

/slim/sources/trunk/slis-slim/Makefile
10,6 → 10,7
install:
# Copy files
cp -r system_scripts examples/getconf $(DOC)
cp -r examples/custom_scripts $(DOC)
cp -r docs/howto $(DOC)
cp -r docs/howto/docbook/slim.pdf $(DOC)/slim-howto.pdf
 
/slim/sources/trunk/slis-slim/examples/custom_scripts/add_supervision_script_for_each_slis.pl
New file
0,0 → 1,82
#!/usr/bin/perl
 
#
# This script enable the supervision scripts for slis4.1 / lcs 2.0 for each slis entry in
# the slim. It has to be customized depending on the slis status used.
#
 
 
use DBI;
use MIME::Base64;
use NetAddr::IP;
 
use strict;
 
# Database
my $DRIVER="Pg";
my $PORT="5432";
 
my $BASE="slim";
my $USER="slim";
my $PASS=`cat /etc/slis-slim/slimpass`;chomp($PASS);
my $HOST="localhost";
 
my $MONITOR_BASE="slismonitor";
my $MONITOR_USER="slimmonitor";
my $MONITOR_PASS=`cat /etc/slis-slim/slismonitorpass`;chomp($MONITOR_PASS);
my $MONITOR_HOST="sql.ac-grenoble.fr";
 
my $query;
my $sth;
 
# Connection to the databases
my $dsn = "DBI:$DRIVER:dbname=$BASE;host=$HOST;port=$PORT";
my $dbh = DBI->connect($dsn,$USER,$PASS);
my $monitor_dsn = "DBI:$DRIVER:dbname=$MONITOR_BASE;host=$MONITOR_HOST;port=$PORT";
my $monitor_dbh = DBI->connect($monitor_dsn,$MONITOR_USER,$MONITOR_PASS);
 
 
# Gather slis name correspoding effectivly to a slis
$query ="SELECT name from slis where status_id not in ('22','23','26','27','34')";
$sth = $dbh->prepare($query);
$sth->execute;
my $slis_names = $sth->fetchall_arrayref;
 
 
# Gather the check id correspond to a lcslis41 AND being a default script
$query = "SELECT id_check from check2version where version_name in ('slis4.1','lcs2.0','host4.1')";
$sth = $dbh->prepare($query);
$sth->execute;
my $id_checks = $sth->fetchall_arrayref;
my @id_default_checks;
 
foreach my $row3 (@$id_checks) {
my $id_check = $$row3[0];
$query = "SELECT * from monitor_check where id_check='$id_check' and \"default\"=true";
$sth = $monitor_dbh->prepare($query);
$sth->execute;
my $ref = $sth->fetchall_arrayref;
if ( $#$ref + 1 != 0) {
push(@id_default_checks,$id_check);
}
}
 
 
# Add each tuple (id_check, slis_name) in the monitor list if necessary
my $i=0;
foreach my $row (@$slis_names) {
my $name = $$row[0];
print "processing (" . $i++ . ") $name\n";
foreach my $id_check (@id_default_checks) {
$query = "SELECT * from monitor_list where slis_name='$name' and id_check='$id_check'";
$sth = $monitor_dbh->prepare($query);
$sth->execute;
my $monitor_list = $sth->fetchall_arrayref;
if ( $#$monitor_list + 1 == 0 ) {
$query = "insert into monitor_list values(DEFAULT,'$id_check',true,true,'$name');";
$sth = $monitor_dbh->prepare($query);
$sth->execute;
}
}
}
 
/slim/sources/trunk/slis-slim/debian/changelog
30,6 → 30,8
order to specify the corresponding file. By default it is 'setup.data' to
keep the compatibility.
* Fixed error in the default slis 4.1 dks config (rsync module).
* Added a custom script that enable a subset of supervision scripts for a
subset of slis in /usr/share/doc/slis-slim/.
 
-- Philippe Le Brouster <plb@ac-grenoble.fr> Thu, 25 Sep 2008 13:46:08 +0200