view release on metacpan or search on metacpan
- change code to use 'perfdata'
- UPDATE: asnmtap-3.002.003_mysql-v5.0.x-trigger-events.sql
- UPDATE: asnmtap-3.002.003_mysql-v5.0.x-trigger-eventsUpdate.sql
- runCmdOnDemand.pl & WebTransact.pm
- replace <BODY onload="..."> with <BODY>
- SOAP.pm
NEW: encodingStyle
NEW: error 'Missing SOAP Envelope or Body'
UPDATE: soapaction
- create_ASNMTAP_weblogic_configuration_for_SNMP.pl
UPDATE: added status to e-mail subject
- NEW: supportRequest template (applications/custom/supportRequest.pm-orig) integrated into comments.pl
- NEW: integration for SDE (applications/custom/sde-supportRequest.pm-orig) into comments.pl
- NEW: check_xml-monitoring-1.2.pl
- UPDATE: coments.pl with integration for applications/custom/supportRequest.pm
ASNMTAP::Asnmtap::Applications
- Applications.cnf
<COMMON>
...
# <PERFPARSE>
# ...
- ALTER TABLE `wls_snmptt_CONFIG` ADD COLUMN `trapLogSeverity` varchar(128) NOT NULL default '' AFTER `trapMonitorType_MATCH`, ADD COLUMN `trapLogSeverity_MATCH` char(2) default NULL AFTER `trapLogSeverity`, ADD COL...
- ALTER TABLE `wls_snmptt_CONFIG` DROP PRIMARY KEY, ADD PRIMARY KEY (`trapMBeanType`,`trapAttributeName`,`trapMonitorType`, `trapLogSeverity`, `trapLogMessage`, `event_name`,`category`,`sources_list`,`mode`);
- UPDATE snmptt-bea-weblogic.conf
- UPDATE create_weblogic_configuration_database_with_SNMP-3.000.016.SQL
- UPDATE create_weblogic_configuration_database_with_SNMP-3.000.016_mysql-v5.0.x.SQL
ASNMTAP::Asnmtap::Plugins::Mail.pm
- FIX regarding MIME-Encoding 'quoted-printable' into MIME-tools-5.425
ASNMTAP::Asnmtap::Plugins::Nagios
- NEW Makefile.PL Net::Ifconfig::Wrapper
ASNMTAP::Asnmtap::Plugins::WebTransact
- UPDATE POD with 'Qs_var => [..., submain => RET_SUBMAIN, title1 => RET_TITLE1]'
Version 3.000.015, 2007/10/21, by Alex Peeters with contributions from Yves Van den Hove.
Makefile.PL
- version update CPAN 1.9102
- version update CGI 3.29
- version update Compress::Zlib 2.004
- version update Config::General 2.33
- version update Crypt::OpenSSL::RSA 0.25
- version update Crypt::OpenSSL::X509 0.5
- add '500 SSL negotiation failed'
- add Perfdata_Label => 'IMAGE URL' to _download_images()
ASNMTAP::Asnmtap::Applications
- email SUBJECT changed to Display/Collector for the 'Application Monitoring'@HOSTNAME: ...
NPTest, v1.11
- Will die if signal received from a testCmd
archiver.pl
- FIX First day current week epoch date
command.pl
- FIX regarding date.utc() - The month (0=Jan - 11=Dec)
- replaced 'suspentionDate.substring(5, 7);' with 'suspentionDate.substring(5, 7) - 1;'
generateCollectorDaemonSchedulingReports.pl
- NEW, generating automatically Collector Daemon Scheduling PDF Reports
- http://asnmtap.citap.be/results/_ASNMTAP/reports/yyyymmdd-collectorDaemonSchedulingReports.pl-_ASNMTAP-FQDN-Daily.pdf
database asnmtap, table plugins and crontab
- `arguments` from varchar(100) to varchar(254)
- `argumentsOndemand` from varchar(100) to varchar(254)
Version 3.000.008, 2006/05/01, ASNMTAP::Asnmtap::Plugins::Mail
- add 7bit mime decoding
Makefile.PL view on Meta::CPAN
if ( $prompt ) {
ExtUtils::MakeMaker::prompt( $intro . "Press <enter> to see the detailed list." );
} else {
print "These are the modules that will get installed:\n\n";
}
# This hash will contain a list of all perl modules we would like to explicitly depend upon in our Makefile
my %PREREQ_PM;
# Maintains a cache of what 3rd party modules you have installed
sub has_module {
my ($module, $version) = @_;
$version ||= '';
return ( ( $version =~ /^\*\d{2,2}(?:\d{2,2}(?:\d{2,2})?)?$/ ) ? 2 : ( $has_module_cache { "$module$version" } ||= eval ( "require $module; Exporter::require_version ( '$module', $version ) if ( $version ); 1" ) ) );
}
# Print a single prerequisite to the screen
sub generate_PREREQ_PM {
my ($feature, $dependency, $modules, $install) = @_;
my $buffer;
my $i = 0;
foreach (keys %$modules) {
my $detected = has_module ( $_, $modules->{$_} );
$buffer .= sprintf ( "%-24s [%s] %-32s %-8s\n", ( $i++ ? '' : $feature), ($detected >= 2 ? '+' : ( $detected ? '*' : ' ') ), $_ . ( $modules->{ $_ } and $modules->{ $_ } !~ /^\*\d{2,2}(?:\d{2,2}(?:\d{2,2})?)?$/ ? " (v$modules->{$_})" : '' ), ( $i...
}
return $buffer;
}
# Print the entire prerequisites table
sub generate_PREREQ_PM_table {
my $buffer = sprintf ( "%-24s %-36s %-8s\n", 'Feature', 'Prerequisites', 'Install?' );
$buffer .= sprintf ( "%s %s %s\n","-" x 24,"-" x 36,"-" x 8 );
foreach my $prerequisites ( @prerequisites ) { $buffer .= generate_PREREQ_PM ( @$prerequisites[1..4] ); }
$buffer .= "\n<- An asterix [*] indicates if the module is currently installed.\n";
return $buffer;
}
# Update the entire prerequisites table
sub update_prerequisites_table {
my ($u_level, $u_default) = @_;
return if ( $u_default > 2 );
my ($action, $u1, $u2, $u3);
($u1, $u2, $u3) = $u_level =~ /^\*(\d{2,2})(?:(\d{2,2})(\d{2,2})?)?$/;
if ( defined $u3 ) {
return unless ( $u_default ); $action = 3;
} elsif ( defined $u2 ) {
Makefile.PL view on Meta::CPAN
if ( $default == 1 || $default == 2 ) {
if ( defined $files ) {
foreach ( @$files ) {
my $file = @$_[0];
my $mode = @$_[1];
my @files = glob($file);
foreach my $file (@files) {
my $destination = ( $file =~ /^\// ? $file : $ASNMTAP_PATH .'/'. $file );
$destination .= '-orig' if ( $mode =~ /^[RX]$/ );
$file = substr($file, 1) if ( $file =~ /^\// );
if ( $mode =~ /^[dD]$/ ) {
$file .= '/.exists';
$destination .= '/.exists';
}
$PM{$file} = $destination;
}
}
}
Makefile.PL view on Meta::CPAN
# 'dist' => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', PREOP => q{$(PERLRUN) -MExtUtils::Autoconf -e'ExtUtils::Autoconf->run_autogen'} },
);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
package MY;
# What happens when we say 'make ...' - - - - - - - - - - - - - - - - - -
# sub postamble {
# return <<"EOM";
# autogen :
# \t\$(PERLRUN) -MExtUtils::Autoconf -e 'ExtUtils::Autoconf->run_autogen'
# configure :
# \t\$(PERLRUN) -MExtUtils::Autoconf -e'ExtUtils::Autoconf->run_configure'
# autoclean :
# \t\$(PERLRUN) -MExtUtils::Autoconf -e'ExtUtils::Autoconf->run_realclean'
# realclean purge ::
# \t\$(PERLRUN) -MExtUtils::Autoconf -e 'ExtUtils::Autoconf->run_realclean'
# clean ::
# \t\$(PERLRUN) -MExtUtils::Autoconf -e 'ExtUtils::Autoconf->run_clean'
# EOM
# }
# What happens when we say 'make test' - - - - - - - - - - - - - - - - -
sub test {
q(
TEST_VERBOSE=0
test: all
$(FULLPERL) t/TEST $(TEST_VERBOSE)
);
}
# Determine things that should *not* be installed - - - - - - - - - - - -
sub libscan {
my ($self, $path) = @_;
return '' if $path =~ m:\betc\/:;
return '' if $path =~ m:\busr\/:;
return '' if $path =~ m:\bCVS\/:;
$path;
}
# Pass ASNMTAP version number to pod2man - - - - - - - - - - - - - - - -
sub manifypods {
my $self = shift;
my $version = $self->{VERSION} || $VERSION;
local ($_) = $self->SUPER::manifypods(@_);
s/pod2man\s*$/pod2man --release ASNMTAP-$version/m;
$_;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- change code to use 'perfdata'
- UPDATE: asnmtap-3.002.003_mysql-v5.0.x-trigger-events.sql
- UPDATE: asnmtap-3.002.003_mysql-v5.0.x-trigger-eventsUpdate.sql
- runCmdOnDemand.pl & WebTransact.pm
- replace <BODY onload="..."> with <BODY>
- SOAP.pm
NEW: encodingStyle
NEW: error 'Missing SOAP Envelope or Body'
UPDATE soapaction
- create_ASNMTAP_weblogic_configuration_for_SNMP.pl
UPDATE: added status to e-mail subject
- NEW: supportRequest template (applications/custom/supportRequest.pm-orig) integrated into comments.pl
- NEW: integration for SDE (applications/custom/sde-supportRequest.pm-orig) into comments.pl
- NEW: check_xml-monitoring-1.2.pl
- UPDATE: coments.pl with integration for applications/custom/supportRequest.pm
ASNMTAP::Asnmtap::Applications
- Applications.cnf
<COMMON>
...
# <PERFPARSE>
# ...
applications/archive.pl view on Meta::CPAN
my ( $week, $year ) = get_week('yesterday');
( $year, my $month, my $day ) = Monday_of_Week($week, $year);
my $firstDayOfWeekEpoch = Date_to_Time ($year, $month, $day, 0, 0, 0); # First day current week epoch date
my $yesterdayEpoch = get_epoch ('yesterday'); # Yesterday epoch date
my $currentEpoch = get_epoch ('today'); # time() or Current epoch date
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help ();
sub print_usage ();
Getopt::Long::Configure('bundling');
GetOptions (
"A:s" => \$opt_A, "archivelist:s" => \$opt_A,
"c:s" => \$opt_c, "cgisess:s" => \$opt_c,
"r:s" => \$opt_r, "reports:s" => \$opt_r,
"d:s" => \$opt_d, "database:s" => \$opt_d,
"y:s" => \$opt_y, "yearsago:s" => \$opt_y,
"f:s" => \$opt_f, "force:s" => \$opt_f,
applications/archive.pl view on Meta::CPAN
}
} else {
print "Cannot open $emailReport to print email report information\n";
}
my ($rc) = send_email_report (*EMAILREPORT, $emailReport, $rvOpen, $prgtext, $debug);
exit;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub archiveCommentsAndEventsTables {
my ($eventsAgo, $commentsAgo) = @_;
print EMAILREPORT "\nArchive '$SERVERTABLCOMMENTS' and '$SERVERTABLEVENTS' tables:\n--------------------------------------------------\n" unless ( $debug );
# Init parameters
my ($rv, $dbh, $sth, $sql, $year, $month, $day, $timeslot, $yearMOVE, $monthMOVE, $sqlMOVE, $sqlUPDATE);
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = errorTrapDBI("Cannot connect to the database", $debug);
applications/archive.pl view on Meta::CPAN
print "$sqlUPDATE\n" if ($debug);
$dbh->do ( $sqlUPDATE ) or $rv = errorTrapDBI("Cannot dbh->do: $sqlUPDATE", $debug) unless ( $debug );
$dbh->disconnect or $rv = errorTrapDBI("Sorry, the database was unable to add your entry.", $debug);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub checkTableDBI {
my ($dbh, $database, $table, $op, $msg_type, $msg_text) = @_;
print "-> <$database.$table>, <$op>, <$msg_type>, <$msg_text>\n" if ($debug);
my ($Table, $Op, $Msg_type, $Msg_text) = '';
my $rv = 1;
my $sql = "check table $table";
my $sth = $dbh->prepare($sql) or $rv = errorTrapDBI("dbh->prepare: $sql", $debug);
$rv = $sth->execute() or $rv = errorTrapDBI("sth->execute: $sql", $debug) if $rv;
applications/archive.pl view on Meta::CPAN
$sth->finish() or $rv = errorTrapDBI("sth->finish", $debug);
$rv = ($rv and "$database.$table" eq $Table and $op eq $Op and $msg_type eq $Msg_type and $msg_text eq $Msg_text) ? 1 : 0;
}
return ($rv);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createCommentsAndEventsArchiveTables {
my ($daysBefore) = @_;
print EMAILREPORT "\nCreate '$SERVERTABLCOMMENTS' and '$SERVERTABLEVENTS' tables when needed:\n--------------------------------------------------\n" unless ( $debug );
# Init parameters
my ($rv, $dbh, $sql, $year, $month);
$year = get_year ($daysBefore);
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = errorTrapDBI("Cannot connect to the database", $debug);
applications/archive.pl view on Meta::CPAN
} else {
print "Table: '$SERVERTABLCOMMENTS', Year: '$year', Status: ALREADY CREATED\n\n" if ($debug);
}
$dbh->disconnect or $rv = errorTrapDBI("Sorry, the database was unable to add your entry.", $debug);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub doBackupCsvSqlErrorWeekDebugReport {
my ($RESULTSPATH, $DEBUGDIR, $REPORTDIR, $gzipEpoch, $removeAllNokEpoch, $removeGzipEpoch, $removeDebugEpoch, $removeReportsEpoch, $removeWeeksEpoch, $firstDayOfWeekEpoch, $yesterdayEpoch, $currentEpoch) = @_;
print EMAILREPORT "\nDo backup, csv, sql, error, week, and debug files:\n--------------------------------------------------\n" unless ( $debug );
my ($darchivelist, $dtest, $pagedir, $ttest, $command, $rvOpendir, $path, $filename, $debugPath, $debugFilename, $reportPath, $reportFilename, $weekFilename);
my @files = ();
foreach $darchivelist (@archivelisttable) {
($pagedir, $ttest) = split(/\#/, $darchivelist, 2);
my @stest = split(/\|/, $ttest);
applications/archive.pl view on Meta::CPAN
print "Filename : <$filename>\n" if ($debug >= 2);
catAllCsvFilesYesterdayWeek ($firstDayOfWeekEpoch, $yesterdayEpoch, $catalogID_uKey, $command, $path, $weekFilename, $filename);
removeAllNokgzipCsvSqlErrorWeekFilesOlderThenAndMoveToBackupShare ($gzipEpoch, $removeAllNokEpoch, $removeGzipEpoch, $removeDebugEpoch, $removeWeeksEpoch, $catalogID_uKey, $command, $path, $filename);
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub removeAllNokgzipCsvSqlErrorWeekFilesOlderThenAndMoveToBackupShare {
my ($gzipEpoch, $removeAllNokEpoch, $removeGzipEpoch, $removeDebugEpoch, $removeWeeksEpoch, $catalogID_uKey, $command, $path, $filename) = @_;
my ($datum, $staart) = split(/\-/, $filename, 2);
if ( $staart ) {
if ( $staart eq "all.txt" ) {
if ($datum le get_yearMonthDay($removeAllNokEpoch)) {
if ($debug) {
print "A- <$datum><", get_yearMonthDay($removeAllNokEpoch), "><$path><$filename>\n";
} else {
applications/archive.pl view on Meta::CPAN
print EMAILREPORT "N- <$datum><", get_yearMonthDay($removeAllNokEpoch), "> unlink <$path><$filename>\n";
unlink ($path.'/'.$filename);
}
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub catAllCsvFilesYesterdayWeek {
my ($firstDayOfWeekEpoch, $yesterdayEpoch, $catalogID_uKey, $command, $path, $weekFilename, $filename) = @_;
for (my $loop = $firstDayOfWeekEpoch; $loop <= $yesterdayEpoch; $loop += 86400) {
if ($filename eq get_yearMonthDay($loop)."-$command-$catalogID_uKey-csv.txt") {
my $rvOpen = open(CAT, ">>$path/$weekFilename");
if ($rvOpen) {
$rvOpen = open(CSV, "$path/$filename");
if ($rvOpen) {
applications/archive.pl view on Meta::CPAN
close(CAT);
} else {
print "Cannot open $filename!\n";
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub gzipOrRemoveHttpDumpDebug {
my ($gzipDebugEpoch, $removeDebugEpoch, $debugPath, $debugFilename) = @_;
my ($suffix, $extentie, $datum, $restant);
print "<$debugFilename>\n" if ($debug);
my $_debugFilename = reverse $debugFilename;
my ($_suffix, $_extentie) = reverse split(/\./, $_debugFilename, 2);
$suffix = reverse $_suffix;
$extentie = reverse $_extentie;
($datum, $restant) = split(/\-/, $suffix, 2);
if (defined $restant) {
$datum = substr($datum, 0, 8);
if ( $extentie ) {
if ( $extentie eq 'htm' ) {
if ($datum le get_yearMonthDay($gzipDebugEpoch)) {
if ($debug) {
print "HT+<$datum><".get_yearMonthDay($gzipDebugEpoch)."><$debugPath><$debugFilename>\n";
} else {
print EMAILREPORT "HT+<$datum><".get_yearMonthDay($gzipDebugEpoch)."> gzip <$debugPath><$debugFilename>\n";
my ($status, $stdout, $stderr) = call_system ('gzip --force '.$debugPath.'/'.$debugFilename, $debug);
print EMAILREPORT "HT+ E R R O R: <$stderr>\n" unless ( $status );
applications/archive.pl view on Meta::CPAN
unlink ($debugPath.'/'.$debugFilename);
}
}
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub removeCgisessFiles {
my ($removeCgisessEpoch) = @_;
my $emailreport = "\nRemove cgisess files:\n---------------------\n";
if ( $debug ) { print "$emailreport"; } else { print EMAILREPORT "$emailreport"; }
my @cgisessPathFilenames = glob("$CGISESSPATH/cgisess_*");
foreach my $cgisessPathFilename (@cgisessPathFilenames) {
my (undef, $cgisessFilename) = split (/^$CGISESSPATH\//, $cgisessPathFilename);
my (undef, $sessionID) = split (/^cgisess_/, $cgisessFilename);
applications/archive.pl view on Meta::CPAN
} else {
print "CS-<$cgisessPathFilename> ASNMTAP not LEXY>\n" if ($debug >= 2);
}
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub removeOldReportFiles {
my ($removeReportsEpoch, $removeGzipEpoch, $reportPath, $reportFilename) = @_;
my ($suffix, $prefix, $datum, $plugin, $restant, $extentie);
($suffix, $prefix) = split(/\.pl/, $reportFilename, 2);
($datum, $plugin) = split(/\-/, $suffix, 2) if (defined $suffix);
($restant, $extentie) = split(/\./, $prefix, 2) if (defined $prefix);
if ($debug) {
print "<$reportFilename>";
if ($debug >= 2) {
print " S <$suffix>, P <$prefix>" if (defined $prefix);
print " D <$datum>, P <$plugin>" if (defined $plugin);
print " R <$restant>, E <$extentie>" if (defined $extentie);
}
print "\n";
}
if (defined $restant) {
$datum = substr($datum, 0, 8);
if ($extentie eq 'pdf') {
if ($datum le get_yearMonthDay($removeReportsEpoch)) {
if ($debug) {
print "RP-<$datum><".get_yearMonthDay($removeReportsEpoch)."><$reportPath><$reportFilename>\n";
} else {
print EMAILREPORT "RP-<$datum><".get_yearMonthDay($removeReportsEpoch)."> unlink <$reportPath><$reportFilename>\n";
unlink ($reportPath.'/'.$reportFilename);
}
} elsif ($restant =~ /\-Day_\w+\-id_\d+$/) {
applications/archive.pl view on Meta::CPAN
unlink ($reportPath.'/'.$reportFilename);
}
}
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub errorTrapDBI {
my ($error_message, $debug) = @_;
print EMAILREPORT " DBI Error:\n", $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";
return 0;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_usage () {
print "Usage: $PROGNAME [-A <archivelist>] [-c F|T] [-r F|T] [-d F|T] [-y <years ago>] [-f F|T] [-D <debug>] [-V version] [-h help]\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Archiver for the '$APPLICATION'
-A, --archivelist=<filename>
FILENAME : filename from the archivelist for the html output loop (default undef)
-c, --cgisess=F|T
F(alse) : don't remove the cgisess files
T(true) : remove the cgisess files (default)
-r, --reports=F|T
F(alse) : don't backup Csv, Sql, Error, Week, Debug reports
applications/archive.pl view on Meta::CPAN
F(alse) : don't force CSV import (default)
T(true) : force CSV import
-D, --debug=F|T|L
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
L(ong) : long screendebugging on
-V, --version
-h, --help
Send email to $SENDEMAILTO if you have questions regarding
use of this software. To submit patches or suggest improvements, send
email to $SENDEMAILTO
";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/bin/generateCollectorDaemonSchedulingReports.pl view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $debug = 0; # default
my $currentYear = sprintf ("%04d", (localtime)[5]+1900 ); # default
my $currentMonth= sprintf ("%02d", ((localtime)[4])+1 ); # default
my $currentDay = sprintf ("%02d", ((localtime)[3]) ); # default
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help ();
sub print_usage ();
Getopt::Long::Configure('bundling');
GetOptions (
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"D:s" => \$opt_D, "debug:s" => \$opt_D,
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h
);
applications/bin/generateCollectorDaemonSchedulingReports.pl view on Meta::CPAN
if ( $debug ) { print $emailMessage; } else { print EMAILREPORT $emailMessage; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($rc) = send_email_report (*EMAILREPORT, $emailReport, $rvOpen, $prgtext, $debug);
exit;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub create_dir {
my ($directory) = @_;
unless ( -e "$directory" ) { # create $directory
my ($status, $stdout, $stderr) = call_system ("mkdir $directory", $debug);
if (!$status and ($stdout ne '' or $stderr ne '')) {
my $error = " > create_dir: mkdir $directory: status: $status, stdout: $stdout, stderr: $stderr\n";
if ( $debug ) { print $error; } else { print EMAILREPORT $error; }
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_usage () {
print "Usage: $PROGNAME [-D <debug>] [-V version] [-h help]\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Generate Collector Daemon Scheduling Reports for the '$APPLICATION'
-D, --debug=F|T|L
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
L(ong) : long screendebugging on
-V, --version
-h, --help
Send email to $SENDEMAILTO if you have questions regarding
use of this software. To submit patches or suggest improvements, send
email to $SENDEMAILTO
";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/bin/generateReports.pl view on Meta::CPAN
my $debug = 0; # default
my $daysAfter = 3; # default
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($currentYear, $currentMonth, $currentDay) = ( ((localtime)[5] + 1900), ((localtime)[4] + 1), (localtime)[3] );
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help ();
sub print_usage ();
Getopt::Long::Configure('bundling');
GetOptions (
"y:s" => \$opt_y, "year:s" => \$opt_y,
"m:s" => \$opt_m, "month:s" => \$opt_m,
"d:s" => \$opt_d, "day:s" => \$opt_d,
"a:s" => \$opt_a, "daysAfter:s" => \$opt_a,
"u:s" => \$opt_u, "ukey:s" => \$opt_u,
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/bin/generateReports.pl view on Meta::CPAN
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($rc) = send_email_report (*EMAILREPORT, $emailReport, $rvOpen, $prgtext, $debug);
exit;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub create_dir {
my ($directory) = @_;
unless ( -e "$directory" ) { # create $directory
my ($status, $stdout, $stderr) = call_system ("mkdir $directory", $debug);
if (!$status and ($stdout ne '' or $stderr ne '')) {
my $error = " > create_dir: mkdir $directory: status: $status, stdout: $stdout, stderr: $stderr\n";
if ( $debug ) { print $error; } else { print EMAILREPORT $error; }
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_usage () {
print "Usage: $PROGNAME [-y <year>] [-m <month>] [-d <day>] [-a <days after>] [-u <uKey>] [-D <debug>] [-V version] [-h help]\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Generate Reports for the '$APPLICATION'
-y, --year=<year> (default: current year)
-m, --month=<month> (default: current month)
-d, --day=<day> (default: current day)
-a, --daysAfter=<days after|F(alse)> (default: 3)
-u, --uKey=<uKey plugin> (default: all plugins)
-D, --debug=F|T|L
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
L(ong) : long screendebugging on
-V, --version
-h, --help
Send email to $SENDEMAILTO if you have questions regarding
use of this software. To submit patches or suggest improvements, send
email to $SENDEMAILTO
";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/bin/holidayBundleSetDowntimes.pl view on Meta::CPAN
my $prgtext = "Set Holiday Bundle Downtimes for the '$APPLICATION'";
my $version = do { my @r = (q$Revision: 3.002.003$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; # must be all on one line or MakeMaker will get confused.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $debug = 0; # default
my $daysBefore = 3;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help ();
sub print_usage ();
Getopt::Long::Configure('bundling');
GetOptions (
"D:s" => \$opt_D, "debug:s" => \$opt_D,
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h
);
if ($opt_V) { print_revision($PROGNAME, $version); exit $ERRORS{OK}; }
applications/bin/holidayBundleSetDowntimes.pl view on Meta::CPAN
}
foreach my $sendEmailTo ( keys %holidayBundleApplications ) {
my $holidayBundles;
foreach my $holidayBundleName ( sort keys %{ $holidayBundleApplications{$sendEmailTo} } ) {
$holidayBundles .= "\nHoliday Bundle: " .$holidayBundleName. "\n" .$holidayBundleApplications{$sendEmailTo}{$holidayBundleName}. "\n";
}
if ( defined $holidayBundles ) {
my $subject = "$BUSINESS / $DEPARTMENT / $APPLICATION / Holiday Downtime Scheduling";
my $message = "Geachte, Cher,\n\n$holidayBundles\n-- Administrator\n\n$APPLICATION\n$DEPARTMENT\n$BUSINESS\n";
my $returnCode = sending_mail ( $SERVERLISTSMTP, $sendEmailTo, $SENDMAILFROM, $subject, $message, $debug );
print "Problem sending email to the '$APPLICATION' members\n" unless ( $returnCode );
}
}
}
$sth->finish() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->finish: $sql", \$logger, $debug);
}
$dbh->disconnect or $rv = DBI_error_trap(*EMAILREPORT, "Sorry, the database was unable to add your entry.", \$logger, $debug);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($rc) = send_email_report (*EMAILREPORT, $emailReport, $rvOpen, $prgtext, $debug);
exit;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_usage () {
print "Usage: $PROGNAME [-D <debug>] [-V version] [-h help]\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Set Holiday Bundle Downtimes for the '$APPLICATION'
-D, --debug=F|T|L
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
L(ong) : long screendebugging on
-V, --version
-h, --help
Send email to $SENDEMAILTO if you have questions regarding
use of this software. To submit patches or suggest improvements, send
email to $SENDEMAILTO
";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
my $boolean_screenDebug = 0; # default 0
my $boolean_debug_all = 0; # default 0
my $boolean_debug_NOK = 0; # default 0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $booleanQuit = 0;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help ();
sub print_usage ();
Getopt::Long::Configure('bundling');
GetOptions (
"T:s" => \$opt_T, "type:s" => \$opt_T,
"M=s" => \$opt_M, "mode=s" => \$opt_M,
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"D:s" => \$opt_D, "debug:s" => \$opt_D,
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
printDebugAll ("Start collector - : <$mode> <$PROGNAME v$version");
do_importDataThroughCatalog ();
printDebugAll ("Einde collector - : <$mode> <$PROGNAME v$version") if ($debug eq 'T');
my ($rc) = send_email_report (*EMAILREPORT, $emailReport, $rvOpen, $prgtext, $debug);
}
exit;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_DIE {
# printDebugAll ("kill -DIE <$PROGNAME v$version pid: <$pidfile>");
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_WARN {
# printDebugAll ("kill -WARN <$PROGNAME v$version pid: <$pidfile>");
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalQUIT {
printDebugAll ("kill -QUIT <$PROGNAME v$version pid: <$pidfile>");
printDebugAll (" Wait until next timeslot");
my ($prevSecs, $currSecs);
$currSecs = int((localtime)[0]);
do {
sleep 1;
$prevSecs = $currSecs;
$currSecs = int((localtime)[0]);
} until ($currSecs < $prevSecs);
unlink $pidfile;
printDebugAll (" Done");
$boolean_daemonQuit = 1;
use Sys::Hostname;
my $subject = "$prgtext\@". hostname() .": import data through catalog successfully stopped at ". get_datetimeSignal();
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $subject ."\n", 0 );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
exit 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalHUP {
printDebugAll ("kill -HUP <$PROGNAME v$version pid: <$pidfile>");
$boolean_signal_hup = 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub write_pid {
printDebugAll ("write PID <$PROGNAME v$version pid: <$pidfile>");
if (-e "$pidfile") {
printDebugAll ("ERROR: couldn't create pid file <$pidfile> for <$PROGNAME v$version>");
print "ERROR: couldn't create pid file <$pidfile> for <$PROGNAME v$version>\n";
exit 0;
} else {
open(PID,">$pidfile") || die "Cannot open $pidfile!!\n";
print PID $$;
close(PID);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printDebugAll {
my ($l_text) = @_;
if ($boolean_screenDebug or $boolean_debug_all) {
chomp ($l_text);
my $date = scalar(localtime());
my $tlogging = $logging .'importDataThroughCatalog'. get_logfiledate();
print "$l_text $date\n" if ( $boolean_screenDebug );
if ($boolean_debug_all and $logging ne '<NIHIL>') {
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
close(ALLDEBUG);
} else {
print "Cannot open $tlogging-all.txt to print debug information\n";
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printDebugNOK {
my ($l_text) = @_;
if ($boolean_debug_NOK and $logging ne '<NIHIL>') {
chomp ($l_text);
my $date = scalar(localtime());
my $tlogging = $logging .'importDataThroughCatalog'. get_logfiledate();
my $rvOpen = open(NOKDEBUG,">>$tlogging-nok.txt");
if ($rvOpen) {
print NOKDEBUG "$l_text $date\n";
close(NOKDEBUG);
} else {
print "Cannot open $tlogging-nok.txt to print debug information\n";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub do_importDataThroughCatalog {
printDebugAll (" IN: do_importDataThroughCatalog <$PROGNAME v$version pid: <$pidfile>");
($dbh, $rv, $alarmMessage) = DBI_connect ( $DATABASE, $SERVERNAMEREADWRITE, $SERVERPORTREADWRITE, $SERVERUSERREADWRITE, $SERVERPASSREADWRITE, $alarm, \&DBI_error_trap, [*EMAILREPORT, "Cannot connect to the database"], \$logger, $debug, $boolean_deb...
if ($dbh and $rv) {
my ($catalogID, $catalogType, $databaseFQDN, $databasePort);
$sql = "select catalogID, catalogType, databaseFQDN, databasePort from $SERVERTABLCATALOG where catalogID <> '$CATALOGID' and catalogType <> 'central' and activated = '1'";
$sth = $dbh->prepare( $sql ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot dbh->prepare: $sql", \$logger, $debug);
($rv, undef) = DBI_execute ($rv, \$sth, $alarm, \&DBI_error_trap, [*EMAILREPORT, "Cannot sth->execute: $sql"], \$logger, $debug);
$sth->bind_columns( \$catalogID, \$catalogType, \$databaseFQDN, \$databasePort ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->bind_columns: $sql", \$logger, $debug) if $rv;
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
}
$dbh->disconnect or $rv = DBI_error_trap(*EMAILREPORT, "Sorry, the database was unable to add your entry.", \$logger, $debug);
}
printDebugAll ("OUT: do_importDataThroughCatalog <$PROGNAME v$version pid: <$pidfile>");
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub importData {
my ($EMAILREPORT, $dbhSOURCE, $dbh, $replicationStatus, $table, $whereCLAUSE, @primaryKeys) = @_;
printDebugAll (" IN: importData <$PROGNAME v$version pid: <$pidfile>: $replicationStatus, $table, $whereCLAUSE, @primaryKeys");
print $EMAILREPORT " - importData: $replicationStatus, $table, $whereCLAUSE, @primaryKeys\n" unless ($debug);
my $sqlSOURCE = "select * from `$table` where $whereCLAUSE limit $limit";
print "+ $sqlSOURCE\n" if ($debug);
my $sthSOURCE = $dbhSOURCE->prepare( $sqlSOURCE ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot dbhSOURCE->prepare: $sqlSOURCE", \$logger, $debug);
($rv, undef) = DBI_execute ($rv, \$sthSOURCE, $alarm, \&DBI_error_trap, [*EMAILREPORT, "Cannot sthSOURCE->execute: $sqlSOURCE"], \$logger, $debug);
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
$sthSOURCE->finish() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sthSOURCE->finish: $sqlSOURCE", \$logger, $debug);
}
print $EMAILREPORT " ERROR: DBH/STH\n" unless ($debug or $rv);
printDebugAll (" OUT: importData <$PROGNAME v$version pid: <$pidfile>");
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_usage () {
print "Usage: $PROGNAME [-T <CONFIG|DATA|ALL>] [-D <debug>] [-V version] [-h help]\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Import Data Through Catalog for the '$APPLICATION'
-T, --type=<CONFIG|DATA|ALL> (default: current ALL)
-M, --mode=O|D
O(nce) : run the program once
D(aemon) : run the program as a loop
-D, --debug=F|T|L
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
L(ong) : long screendebugging on
-V, --version
-h, --help
Send email to $SENDEMAILTO if you have questions regarding
use of this software. To submit patches or suggest improvements, send
email to $SENDEMAILTO
";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/collector-test.pl view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $boolean_loopQuit = 0;
my ($directory, $action, $dproc, $dcron);
my ($tmin, $thour, $tmday, $tmon, $twday, $tinterval, $tcommand);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help ();
sub print_usage ();
Getopt::Long::Configure('bundling');
GetOptions (
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"M=s" => \$opt_M, "mode=s" => \$opt_M,
"C=s" => \$opt_C, "collectorlist=s" => \$opt_C,
"W:s" => \$opt_W, "screenDebug:s" => \$opt_W,
"A:s" => \$opt_A, "allDebug:s" => \$opt_A,
"N:s" => \$opt_N, "nokDebug:s" => \$opt_N,
applications/collector-test.pl view on Meta::CPAN
}
printDebugAll ("Einde collector - : <$mode> <$PROGNAME v$version -C $collectorlist>") if ($debug eq 'T');
} until ($boolean_loopQuit);
}
exit;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub resultsdirCreate {
foreach $dcron (@crontabtable) {
(undef, undef, undef, undef, undef, undef, $tcommand) = split(/ +/, $dcron, 7);
my @scommand = split(/\|/, $tcommand);
foreach my $dcommand (@scommand) {
my (undef, $resultsdir, undef, undef, undef) = split(/\#/, $dcommand);
$logging = $RESULTSPATH .'/'. $resultsdir;
create_dir ($logging);
applications/collector-test.pl view on Meta::CPAN
$httpdump .= "/";
create_header ($httpdump."HEADER.html");
create_footer ($httpdump."FOOTER.html");
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub do_crontab {
my $currentDate = time();
my ($min, $hour, $mday, $mon, $wday) = ((localtime($currentDate))[1,2,3], (localtime($currentDate))[4]+1, (localtime($currentDate))[6]);
foreach $dcron (@crontabtable) {
($tmin, $thour, $tmday, $tmon, $twday, $tinterval, $tcommand) = split(/ +/, $dcron, 7);
my ($doIt, $doOffline) = set_doIt_and_doOffline ($min, $hour, $mday, $mon, $wday, $tmin, $thour, $tmday, $tmon, $twday);
if ( $doIt || $doOffline ) {
printDebugAll ("Start CollectorCT - : <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
my @scommand = split(/\|/, $tcommand);
applications/collector-test.pl view on Meta::CPAN
do {
sleep 5;
$prevSecs = $currSecs;
$currSecs = int((localtime)[0]);
} until ($currSecs < $prevSecs);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_DIE {
# printDebugAll ("kill -DIE <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
# if ( $DBI_CONNECT_ALARM_OFF or $! =~ /\QDBI_CONNECT_ALARM_OFF = \E(\d*)\Q\n\E/ or $@ =~ /\QDBI_CONNECT_ALARM_OFF = \E(\d*)\Q\n\E/ ) {
# print "DBI_CONNECT_ALARM_OFF\n";
# } elsif ( $DBI_EXECUTE_ALARM_OFF or $! =~ /\QDBI_EXECUTE_ALARM_OFF = \E(\d*)\Q\n\E/ or $@ =~ /\QDBI_EXECUTE_ALARM_OFF = \E(\d*)\Q\n\E/ ) {
# print "DBI_EXECUTE_ALARM_OFF\n";
# } else {
# print "DBI_xxx_ALARM_OFF\n";
# }
applications/collector-test.pl view on Meta::CPAN
# }
#
# $Log::Log4perl::caller_depth++;
# my $logger = get_logger("");
# $logger->fatal(@_);
# die @_; # Now terminate really
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_WARN {
# printDebugAll ("kill -WARN <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
if ( $CHILD_OFF or $! =~ /\QASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = \E(\d*)\Q\n\E/ or $@ =~ /\QASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = \E(\d*)\Q\n\E/ ) {
my $alarm = ( ( defined $CHILD_OFF and $CHILD_OFF ) ? $CHILD_OFF : $1 );
if ( defined $alarm ) {
use Proc::ProcessTable;
my $t = new Proc::ProcessTable;
foreach my $process ( @{$t->table} ) {
applications/collector-test.pl view on Meta::CPAN
$boolean_signal_kill = 1;
printDebugAll ("kill -9 <$PROGNAME v$version -C $collectorlist> pid: <". $process->pid ."> ppid: <$$>");
}
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalQUIT {
printDebugAll ("kill -QUIT <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
printDebugAll (" Wait until next timeslot");
my ($prevSecs, $currSecs);
$currSecs = int((localtime)[0]);
do {
sleep 1;
$prevSecs = $currSecs;
$currSecs = int((localtime)[0]);
} until ($currSecs < $prevSecs);
unlink $pidfile;
printDebugAll (" Done");
$boolean_daemonQuit = 1;
use Sys::Hostname;
my $subject = "$prgtext\@". hostname() .": Config $APPLICATIONPATH/etc/$collectorlist successfully stopped at ". get_datetimeSignal();
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $subject ."\n", 0 );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
exit 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalHUP {
printDebugAll ("kill -HUP <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
$boolean_signal_hup = 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub write_pid {
printDebugAll ("write PID <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
if (-e "$pidfile") {
printDebugAll ("ERROR: couldn't create pid file <$pidfile> for <$PROGNAME v$version -C $collectorlist>");
print "ERROR: couldn't create pid file <$pidfile> for <$PROGNAME v$version -C $collectorlist>\n";
exit 0;
} else {
open(PID,">$pidfile") || die "Cannot open $pidfile!!\n";
print PID $$;
close(PID);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub create_dir {
my ($directory) = @_;
unless ( -e "$directory" ) { # create $directory
my ($systemAction, $stdout, $stderr, $exit_value, $signal_num, $dumped_core);
$systemAction = "mkdir $directory";
if ($CAPTUREOUTPUT) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec("$systemAction");
} else {
applications/collector-test.pl view on Meta::CPAN
unless ( $exit_value == 0 && $signal_num == 0 && $dumped_core == 0 && $stderr eq '' ) {
printDebugAll (" create_dir ---- : mkdir $directory: <$exit_value><$signal_num><$dumped_core><$stderr>");
printDebugNOK (" create_dir ---- : mkdir $directory: <$exit_value><$signal_num><$dumped_core><$stderr>");
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub call_system {
my ($asnmtapEnv, $currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $resultsdir, $title, $system_action, $status, $interval, $instability, $persistent, $downtime, $debug, $dbiFilename, $logging, $httpdump, $dumphttp, $queryMySQL) = @_;
my $rvOpen;
my $action = '';
my $httpdumpFilename = '';
my $httpdumpFilenameTmp = '';
my $debugFilename = '<NIHIL>';
my $dumphttpRename = '<NIHIL>';
my ($stdout, $stderr, $exit_value, $signal_num, $dumped_core);
applications/collector-test.pl view on Meta::CPAN
}
$boolean_signal_kill = 0;
if (-e "$PLUGINPATH/$msgCommand.pl") {
my $systemAction = "cd $PLUGINPATH; ./$system_action --status=$status --debug=$debug --logging=$logging --asnmtapEnv='$asnmtapEnv'";
$systemAction .= " --dumphttp=$httpdumpFilenameTmp" if ($dumphttp ne 'N');
my $_handler = $SIG{ALRM};
my $alarm = $interval * 60;
$SIG{ALRM} = sub { $CHILD_OFF = $alarm; warn "ASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = $alarm\n" };
alarm ( $alarm );
if ($CAPTUREOUTPUT) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec("$systemAction");
my (@returnStatus) = split (/\n/, $stdout);
$returnStatus = $returnStatus[-1];
} else {
system ("$systemAction"); $stdout = $stderr = '';
}
applications/collector-test.pl view on Meta::CPAN
printDebugNOK (" perfParse ----- : $perfParseCommand: <$exit_value><$signal_num><$dumped_core><$stderr>") unless ( $exit_value == 0 && $signal_num == 0 && $dumped_core == 0 && $stderr eq '' );
}
}
insertEntryDBI ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $dbiFilename.$msgCommand.'-'.$catalogID_uniqueKey.'-sql', $system_action, $interval, $dumphttpRename, $logging, $debug, $startDate, $startTime, $endDate, $endTime, ...
return $action;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printDebugAll {
my ($l_text) = @_;
if ($boolean_screenDebug or $boolean_debug_all) {
chomp ($l_text);
my $date = scalar(localtime());
my $tlogging = $logging . get_logfiledate();
print "$l_text $date\n" if ( $boolean_screenDebug );
if ($boolean_debug_all and $logging ne '<NIHIL>') {
applications/collector-test.pl view on Meta::CPAN
close(ALLDEBUG);
} else {
print "Cannot open $tlogging-all.txt to print debug information\n";
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printDebugNOK {
my ($l_text) = @_;
if ($boolean_debug_NOK and $logging ne '<NIHIL>') {
chomp ($l_text);
my $date = scalar(localtime());
my $tlogging = $logging . get_logfiledate();
my $rvOpen = open(NOKDEBUG,">>$tlogging-nok.txt");
if ($rvOpen) {
print NOKDEBUG "$l_text $date\n";
close(NOKDEBUG);
} else {
print "Cannot open $tlogging-nok.txt to print debug information\n";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub insertEntryDBI {
my ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $dbiFilename, $test, $interval, $status, $logging, $debug, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $filename, $insertMySQL, $queryMySQ...
return ( 1 ) unless ( $insertMySQL );
my ($sth, $lockString, $findString, $updateString, $insertString, $flushString, $unlockString, $insertEntryDBI, $updateEntryDBI);
$insertEntryDBI = 0;
$updateEntryDBI = 0;
my ($dbh, $rv, $alarmMessage) = DBI_connect ( $DATABASE, $serverName, $SERVERPORTREADWRITE, $SERVERUSERREADWRITE, $SERVERPASSREADWRITE, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $st...
if ($dbh and $rv) {
applications/collector-test.pl view on Meta::CPAN
$dbh->disconnect or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $do...
my $environment = (($test =~ /\-\-environment=([PASTDL])/) ? $1 : 'P');
$rv = graphEntryDBI ($catalogID, $uniqueKey, $title, $environment, $dbiFilename, $interval, 121, 6, 1, 0, get_trendline_from_test ($test), 0, $debug) if ($interval > 0);
}
return $rv;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub errorTrapDBI {
my ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $downtime, $filename, $error_message, $l...
print $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";
my $tlogging = $logging . get_logfiledate();
my ($msgCommand, undef) = split(/\.pl/, $test);
# APE # TODO - REMOVE
# my $rvOpen = open(DEBUG,">>$tlogging-$msgCommand-$catalogID_uniqueKey.sql");
applications/collector-test.pl view on Meta::CPAN
if ($rvOpen) {
print DEBUG $error_message, "\n--> ERROR: $DBI::err ($DBI::errstr)\n";
print DEBUG $CATALOGID, " --> ", $catalogID, " <-> ", $uniqueKey, " <-> ", $title, " <-> ", $status, "\n--> ", $startDate, " <-> ", $startTime, " <-> ", $endDate, " <-> ", $endTime, " <-> ", $duration, " <-> ", $interval*60, " <-> ", get_timeslot...
close(DEBUG);
} else {
print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey-sql-error.txt to print debug information\n";
}
unless ( -e "$RESULTSPATH/$collectorlist-MySQL-sql-error.txt" ) {
my $tDebug = ($debug eq 'T') ? 2 : 0;
my $subject = "$prgtext / Current status for $collectorlist: " . get_datetimeSignal();
my $message = get_datetimeSignal() . " $error_message\n--> ERROR: $DBI::err ($DBI::errstr)\n";
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $message, $tDebug );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
}
$rvOpen = open(DEBUG,">>$RESULTSPATH/$collectorlist-MySQL-sql-error.txt");
if ($rvOpen) {
print DEBUG get_datetimeSignal, " ", $error_message, "\n--> ERROR: $DBI::err ($DBI::errstr)\n";
close(DEBUG);
} else {
print "Cannot open $RESULTSPATH/$collectorlist-MySQL-sql-error.txt to print debug information\n";
}
return 0;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub errorTrapDBIdowntime {
my ($collectorlist, $error_message, $logger, $debug) = @_;
print $collectorlist, "\n", $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";
$$logger->error("$collectorlist:\n" .$error_message. "\nERROR: $DBI::err ($DBI::errstr)") if ( defined $$logger and $$logger->is_error() );
return 0;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub graphEntryDBI {
my ($catalogID, $uniqueKey, $title, $environment, $dbiFilename, $interval, $limitTest, $xLabelStep, $withBorder, $markOrZone, $yMarkValue, $xRealtime, $debug) = @_;
$title .= ' ('. $ENVIRONMENT{$environment} .')' if (defined $environment);
$title .= ' from '. $catalogID;
# $limitTest -> 241: (120*2.0)+1, x = 2.0 -> $xLabelStep = 6 * x -> 12
# 181: (120*1.5)+1, x = 1.5 -> $xLabelStep = 6 * x -> 9
# 121: (120*1.0)+1, x = 1.0 -> $xLabelStep = 6 * x -> 6
my $width = 893;
applications/collector-test.pl view on Meta::CPAN
} else {
$sth->bind_columns( \$duration, \$startTime, \$status, \$timeslot ) or $rv = errorTrapDBIgraphEntry("Cannot sth->bind_columns: $findString", \$logger, $debug);
unless ( $rv ) {
$title .= " - Cannot sth->bind_columns";
} else {
$counter = 0;
my $limitTrendline = ($yMarkValue) ? $yMarkValue * 2.5 : 9000;
while( $sth->fetch() ) {
$seconden = int(substr($duration, 6, 2)) + int(substr($duration, 3, 2)*60) + int(substr($duration, 0, 2)*3600);
$seconden += 0.5 if ($seconden == 0); # correction for to fast testresults
$ttimeslot = abs((($lastTimeslot - $timeslot) / $step) - $limitTest);
if ($ttimeslot >= 0) {
$status = 'UNKNOWN' if ($status eq '<NIHIL>');
if ($status eq 'OK') {
$dataOK[$ttimeslot] = ($seconden < $limitTrendline) ? $seconden : $limitTrendline;
} elsif ($status eq 'CRITICAL') {
$dataCritical[$ttimeslot] = '-5';
applications/collector-test.pl view on Meta::CPAN
$dataWarning[$ttimeslot] = '-5';
} elsif ($status eq 'UNKNOWN'){
$dataUnknown[$ttimeslot] = '-5';
} elsif ($status eq 'NO TEST') {
$dataNoTest[$ttimeslot] = '-5';
} elsif ($status eq 'OFFLINE') {
$dataOffline[$ttimeslot] = '-5';
}
}
$RRDlabels[int($limitTest - $counter - 1)] = substr($startTime, 0, 5) unless ( $counter % $xLabelStep );
$counter++;
}
}
$sth->finish() or $rv = errorTrapDBIgraphEntry("Cannot sth->finish: $findString", \$logger, $debug);
}
$dbh->disconnect or $rv = errorTrapDBIgraphEntry("Sorry, the database was unable to add your entry.", \$logger, $debug);
} else {
$title .= " - DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage";
applications/collector-test.pl view on Meta::CPAN
# Set the plotarea at (xOffset, yOffset) and of size $width - 95 x $hight - 78 pixels, with white background. Set border and grid line colors.
$c->setPlotArea($xOffset, $yOffset, $width - 95, $hight - 78, 0xffffff, -1, 0xa08040, $c->dashLineColor(0x0, 0x0101), $c->dashLineColor(0x0, 0x0101))->setGridWidth(1);
# Add a title box to the chart using 10 pts Arial Bold Italic font. The text is white (0x000000)
$c->addText($width/2, 14, "$title", "arialbi.ttf", 10, 0x000000, 5, 0);
# Set labels on the x axis
unless ( $xRealtime ) {
for ($counter = 0; $counter < $limitTest; $counter += $xLabelStep) {
$RRDlabels[int($limitTest - $counter - 1)] = substr(scalar(localtime(($lastTimeslot - ($step * ($counter))))), 11, 5);
}
}
$c->xAxis()->setLabels(\@RRDlabels);
for ($counter = 0; $counter < $limitTest - $xLabelStep; $counter += $xLabelStep) {
my $labelStep = $xLabelStep / 3;
$c->xAxis()->addMark($counter + $labelStep, $c->dashLineColor(0x0, 0x103))->setDrawOnTop(0);
$c->xAxis()->addMark($counter + ($labelStep * 2), $c->dashLineColor(0x0, 0x103))->setDrawOnTop(0);
}
applications/collector-test.pl view on Meta::CPAN
$c->yAxis()->addZone(0, -6, $yMarkColor) unless ( $markOrZone );
$layer->addDataSet(\@dataOK, $COLORSRRD {OK}, " Duration");
}
$layer->addDataSet(\@dataWarning, $COLORSRRD {WARNING}, " Warning");
$layer->addDataSet(\@dataCritical, $COLORSRRD {CRITICAL}, " Critical");
$layer->addDataSet(\@dataUnknown, $COLORSRRD {UNKNOWN}, " Unknown");
$layer->addDataSet(\@dataNoTest, $COLORSRRD {"NO TEST"}, " No test");
$layer->addDataSet(\@dataOffline, $COLORSRRD {OFFLINE}, " Offline");
# Set the sub-bar gap to 0, so there is no gap between stacked bars with a group
$layer->setBarGap(-1.7E-100, 0);
# Set the bar border to transparent
if ($withBorder) {
$layer->setBorderColor(0xF0F0F0);
} else {
$layer->setBorderColor($perlchartdir::Transparent);
}
# Add a legend box
applications/collector-test.pl view on Meta::CPAN
$c->addText($width - 18, $hight - 21, "Interval: " . $interval . " min, " . $DEPARTMENT . " @ " . $BUSINESS . ", created on: " . scalar(localtime()) . ".", "arial.ttf", 8, 0x000000, 6, 0);
#output the chart
$c->makeChart("$dbiFilename.png");
return $rv;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub errorTrapDBIgraphEntry {
my ($error_message, $logger, $debug) = @_;
print 'errorTrapDBIgraphEntry', "\n", $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";
$$logger->error("errorTrapDBIgraphEntry:\n" .$error_message. "\nERROR: $DBI::err ($DBI::errstr)") if ( defined $$logger and $$logger->is_error() );
return 0;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_usage () {
print "Usage: $PROGNAME -H <MySQL hostname> [-M <mode>] [-C <collectorlist>] [-W <screenDebug>] [-A <allDebug>] [-N <nokDebug>] [-s <dumphttp>] [-S <status>] [-D <debug>] [-V version] [-h help]\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Collector for the '$APPLICATION'
-H, --hostname=<HOSTNAME>
HOSTNAME : hostname/address from the MySQL server
-M, --mode=O|L|C
O(nce) : run the program once
L(oop) : run the program as a loop
C(rontab) : run the program crontab based
-C, --collectorlist=<FILENAME>
applications/collector-test.pl view on Meta::CPAN
N(agios): Nagios custom plugin output (default)
S(nmp) : SNMP ...
-D, --debug=F|T|L
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
L(ong) : long screendebugging on
-V, --version
-h, --help
Send email to $SENDEMAILTO if you have questions regarding
use of this software. To submit patches or suggest improvements, send
email to $SENDEMAILTO
";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/collector.pl view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $boolean_loopQuit = 0;
my ($directory, $action, $dproc, $dcron);
my ($tmin, $thour, $tmday, $tmon, $twday, $tinterval, $tcommand);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help ();
sub print_usage ();
Getopt::Long::Configure('bundling');
GetOptions (
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"M=s" => \$opt_M, "mode=s" => \$opt_M,
"C=s" => \$opt_C, "collectorlist=s" => \$opt_C,
"W:s" => \$opt_W, "screenDebug:s" => \$opt_W,
"A:s" => \$opt_A, "allDebug:s" => \$opt_A,
"N:s" => \$opt_N, "nokDebug:s" => \$opt_N,
applications/collector.pl view on Meta::CPAN
}
printDebugAll ("Einde collector - : <$mode> <$PROGNAME v$version -C $collectorlist>") if ($debug eq 'T');
} until ($boolean_loopQuit);
}
exit;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub resultsdirCreate {
foreach $dcron (@crontabtable) {
(undef, undef, undef, undef, undef, undef, $tcommand) = split(/ +/, $dcron, 7);
my @scommand = split(/\|/, $tcommand);
foreach my $dcommand (@scommand) {
my (undef, $resultsdir, undef, undef, undef) = split(/\#/, $dcommand);
$logging = $RESULTSPATH .'/'. $resultsdir;
create_dir ($logging);
applications/collector.pl view on Meta::CPAN
$httpdump .= "/";
create_header ($httpdump."HEADER.html");
create_footer ($httpdump."FOOTER.html");
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub do_crontab {
my $currentDate = time();
my ($min, $hour, $mday, $mon, $wday) = ((localtime($currentDate))[1,2,3], (localtime($currentDate))[4]+1, (localtime($currentDate))[6]);
foreach $dcron (@crontabtable) {
($tmin, $thour, $tmday, $tmon, $twday, $tinterval, $tcommand) = split(/ +/, $dcron, 7);
my ($doIt, $doOffline) = set_doIt_and_doOffline ($min, $hour, $mday, $mon, $wday, $tmin, $thour, $tmday, $tmon, $twday);
if ( $doIt || $doOffline ) {
printDebugAll ("Start CollectorCT - : <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
my @scommand = split(/\|/, $tcommand);
applications/collector.pl view on Meta::CPAN
do {
sleep 5;
$prevSecs = $currSecs;
$currSecs = int((localtime)[0]);
} until ($currSecs < $prevSecs);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_DIE {
# printDebugAll ("kill -DIE <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
# if ( $DBI_CONNECT_ALARM_OFF or $! =~ /\QDBI_CONNECT_ALARM_OFF = \E(\d*)\Q\n\E/ or $@ =~ /\QDBI_CONNECT_ALARM_OFF = \E(\d*)\Q\n\E/ ) {
# print "DBI_CONNECT_ALARM_OFF\n";
# } elsif ( $DBI_EXECUTE_ALARM_OFF or $! =~ /\QDBI_EXECUTE_ALARM_OFF = \E(\d*)\Q\n\E/ or $@ =~ /\QDBI_EXECUTE_ALARM_OFF = \E(\d*)\Q\n\E/ ) {
# print "DBI_EXECUTE_ALARM_OFF\n";
# } else {
# print "DBI_xxx_ALARM_OFF\n";
# }
applications/collector.pl view on Meta::CPAN
# }
#
# $Log::Log4perl::caller_depth++;
# my $logger = get_logger("");
# $logger->fatal(@_);
# die @_; # Now terminate really
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_WARN {
# printDebugAll ("kill -WARN <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
if ( $CHILD_OFF or $! =~ /\QASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = \E(\d*)\Q\n\E/ or $@ =~ /\QASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = \E(\d*)\Q\n\E/ ) {
my $alarm = ( ( defined $CHILD_OFF and $CHILD_OFF ) ? $CHILD_OFF : $1 );
if ( defined $alarm ) {
use Proc::ProcessTable;
my $t = new Proc::ProcessTable;
foreach my $process ( @{$t->table} ) {
applications/collector.pl view on Meta::CPAN
$boolean_signal_kill = 1;
printDebugAll ("kill -9 <$PROGNAME v$version -C $collectorlist> pid: <". $process->pid ."> ppid: <$$>");
}
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalQUIT {
printDebugAll ("kill -QUIT <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
printDebugAll (" Wait until next timeslot");
my ($prevSecs, $currSecs);
$currSecs = int((localtime)[0]);
do {
sleep 1;
$prevSecs = $currSecs;
$currSecs = int((localtime)[0]);
} until ($currSecs < $prevSecs);
unlink $pidfile;
printDebugAll (" Done");
$boolean_daemonQuit = 1;
use Sys::Hostname;
my $subject = "$prgtext\@". hostname() .": Config $APPLICATIONPATH/etc/$collectorlist successfully stopped at ". get_datetimeSignal();
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $subject ."\n", 0 );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
exit 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalHUP {
printDebugAll ("kill -HUP <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
$boolean_signal_hup = 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub write_pid {
printDebugAll ("write PID <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
if (-e "$pidfile") {
printDebugAll ("ERROR: couldn't create pid file <$pidfile> for <$PROGNAME v$version -C $collectorlist>");
print "ERROR: couldn't create pid file <$pidfile> for <$PROGNAME v$version -C $collectorlist>\n";
exit 0;
} else {
open(PID,">$pidfile") || die "Cannot open $pidfile!!\n";
print PID $$;
close(PID);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub create_dir {
my ($directory) = @_;
unless ( -e "$directory" ) { # create $directory
my ($systemAction, $stdout, $stderr, $exit_value, $signal_num, $dumped_core);
$systemAction = "mkdir $directory";
if ($CAPTUREOUTPUT) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec("$systemAction");
} else {
applications/collector.pl view on Meta::CPAN
unless ( $exit_value == 0 && $signal_num == 0 && $dumped_core == 0 && $stderr eq '' ) {
printDebugAll (" create_dir ---- : mkdir $directory: <$exit_value><$signal_num><$dumped_core><$stderr>");
printDebugNOK (" create_dir ---- : mkdir $directory: <$exit_value><$signal_num><$dumped_core><$stderr>");
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub call_system {
my ($asnmtapEnv, $currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $resultsdir, $title, $system_action, $status, $interval, $instability, $persistent, $downtime, $debug, $dbiFilename, $logging, $httpdump, $dumphttp, $queryMySQL) = @_;
my $rvOpen;
my $action = '';
my $httpdumpFilename = '';
my $httpdumpFilenameTmp = '';
my $debugFilename = '<NIHIL>';
my $dumphttpRename = '<NIHIL>';
my ($stdout, $stderr, $exit_value, $signal_num, $dumped_core);
applications/collector.pl view on Meta::CPAN
}
$boolean_signal_kill = 0;
if (-e "$PLUGINPATH/$msgCommand.pl") {
my $systemAction = "cd $PLUGINPATH; ./$system_action --status=$status --debug=$debug --logging=$logging --asnmtapEnv='$asnmtapEnv'";
$systemAction .= " --dumphttp=$httpdumpFilenameTmp" if ($dumphttp ne 'N');
my $_handler = $SIG{ALRM};
my $alarm = $interval * 60;
$SIG{ALRM} = sub { $CHILD_OFF = $alarm; warn "ASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = $alarm\n" };
alarm ( $alarm );
if ($CAPTUREOUTPUT) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec("$systemAction");
my (@returnStatus) = split (/\n/, $stdout);
$returnStatus = $returnStatus[-1];
} else {
system ("$systemAction"); $stdout = $stderr = '';
}
applications/collector.pl view on Meta::CPAN
printDebugNOK (" perfParse ----- : $perfParseCommand: <$exit_value><$signal_num><$dumped_core><$stderr>") unless ( $exit_value == 0 && $signal_num == 0 && $dumped_core == 0 && $stderr eq '' );
}
}
insertEntryDBI ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $dbiFilename.$msgCommand.'-'.$catalogID_uniqueKey.'-sql', $system_action, $interval, $dumphttpRename, $logging, $debug, $startDate, $startTime, $endDate, $endTime, ...
return $action;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printDebugAll {
my ($l_text) = @_;
if ($boolean_screenDebug or $boolean_debug_all) {
chomp ($l_text);
my $date = scalar(localtime());
my $tlogging = $logging . get_logfiledate();
print "$l_text $date\n" if ( $boolean_screenDebug );
if ($boolean_debug_all and $logging ne '<NIHIL>') {
applications/collector.pl view on Meta::CPAN
close(ALLDEBUG);
} else {
print "Cannot open $tlogging-all.txt to print debug information\n";
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printDebugNOK {
my ($l_text) = @_;
if ($boolean_debug_NOK and $logging ne '<NIHIL>') {
chomp ($l_text);
my $date = scalar(localtime());
my $tlogging = $logging . get_logfiledate();
my $rvOpen = open(NOKDEBUG,">>$tlogging-nok.txt");
if ($rvOpen) {
print NOKDEBUG "$l_text $date\n";
close(NOKDEBUG);
} else {
print "Cannot open $tlogging-nok.txt to print debug information\n";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub insertEntryDBI {
my ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $dbiFilename, $test, $interval, $status, $logging, $debug, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $filename, $insertMySQL, $queryMySQ...
return ( 1 ) unless ( $insertMySQL );
my ($sth, $lockString, $findString, $updateString, $insertString, $flushString, $unlockString, $insertEntryDBI, $updateEntryDBI);
$insertEntryDBI = 0;
$updateEntryDBI = 0;
my ($dbh, $rv, $alarmMessage) = DBI_connect ( $DATABASE, $serverName, $SERVERPORTREADWRITE, $SERVERUSERREADWRITE, $SERVERPASSREADWRITE, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $st...
if ($dbh and $rv) {
applications/collector.pl view on Meta::CPAN
$dbh->disconnect or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $do...
my $environment = (($test =~ /\-\-environment=([PASTDL])/) ? $1 : 'P');
$rv = graphEntryDBI ($catalogID, $uniqueKey, $title, $environment, $dbiFilename, $interval, 121, 6, 1, 0, get_trendline_from_test ($test), 0, $debug) if ($interval > 0);
}
return $rv;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub errorTrapDBI {
my ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $downtime, $filename, $error_message, $l...
print $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";
my $tlogging = $logging . get_logfiledate();
my ($msgCommand, undef) = split(/\.pl/, $test);
# APE # TODO - REMOVE
# my $rvOpen = open(DEBUG,">>$tlogging-$msgCommand-$catalogID_uniqueKey.sql");
applications/collector.pl view on Meta::CPAN
if ($rvOpen) {
print DEBUG $error_message, "\n--> ERROR: $DBI::err ($DBI::errstr)\n";
print DEBUG $CATALOGID, " --> ", $catalogID, " <-> ", $uniqueKey, " <-> ", $title, " <-> ", $status, "\n--> ", $startDate, " <-> ", $startTime, " <-> ", $endDate, " <-> ", $endTime, " <-> ", $duration, " <-> ", $interval*60, " <-> ", get_timeslot...
close(DEBUG);
} else {
print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey-sql-error.txt to print debug information\n";
}
unless ( -e "$RESULTSPATH/$collectorlist-MySQL-sql-error.txt" ) {
my $tDebug = ($debug eq 'T') ? 2 : 0;
my $subject = "$prgtext / Current status for $collectorlist: " . get_datetimeSignal();
my $message = get_datetimeSignal() . " $error_message\n--> ERROR: $DBI::err ($DBI::errstr)\n";
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $message, $tDebug );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
}
$rvOpen = open(DEBUG,">>$RESULTSPATH/$collectorlist-MySQL-sql-error.txt");
if ($rvOpen) {
print DEBUG get_datetimeSignal, " ", $error_message, "\n--> ERROR: $DBI::err ($DBI::errstr)\n";
close(DEBUG);
} else {
print "Cannot open $RESULTSPATH/$collectorlist-MySQL-sql-error.txt to print debug information\n";
}
return 0;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub errorTrapDBIdowntime {
my ($collectorlist, $error_message, $logger, $debug) = @_;
print $collectorlist, "\n", $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";
$$logger->error("$collectorlist:\n" .$error_message. "\nERROR: $DBI::err ($DBI::errstr)") if ( defined $$logger and $$logger->is_error() );
return 0;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub graphEntryDBI {
my ($catalogID, $uniqueKey, $title, $environment, $dbiFilename, $interval, $limitTest, $xLabelStep, $withBorder, $markOrZone, $yMarkValue, $xRealtime, $debug) = @_;
$title .= ' ('. $ENVIRONMENT{$environment} .')' if (defined $environment);
$title .= ' from '. $catalogID;
# $limitTest -> 241: (120*2.0)+1, x = 2.0 -> $xLabelStep = 6 * x -> 12
# 181: (120*1.5)+1, x = 1.5 -> $xLabelStep = 6 * x -> 9
# 121: (120*1.0)+1, x = 1.0 -> $xLabelStep = 6 * x -> 6
my $width = 893;
applications/collector.pl view on Meta::CPAN
} else {
$sth->bind_columns( \$duration, \$startTime, \$status, \$timeslot ) or $rv = errorTrapDBIgraphEntry("Cannot sth->bind_columns: $findString", \$logger, $debug);
unless ( $rv ) {
$title .= " - Cannot sth->bind_columns";
} else {
$counter = 0;
my $limitTrendline = ($yMarkValue) ? $yMarkValue * 2.5 : 9000;
while( $sth->fetch() ) {
$seconden = int(substr($duration, 6, 2)) + int(substr($duration, 3, 2)*60) + int(substr($duration, 0, 2)*3600);
$seconden += 0.5 if ($seconden == 0); # correction for to fast testresults
$ttimeslot = abs((($lastTimeslot - $timeslot) / $step) - $limitTest);
if ($ttimeslot >= 0) {
$status = 'UNKNOWN' if ($status eq '<NIHIL>');
if ($status eq 'OK') {
$dataOK[$ttimeslot] = ($seconden < $limitTrendline) ? $seconden : $limitTrendline;
} elsif ($status eq 'CRITICAL') {
$dataCritical[$ttimeslot] = '-5';
applications/collector.pl view on Meta::CPAN
$dataWarning[$ttimeslot] = '-5';
} elsif ($status eq 'UNKNOWN'){
$dataUnknown[$ttimeslot] = '-5';
} elsif ($status eq 'NO TEST') {
$dataNoTest[$ttimeslot] = '-5';
} elsif ($status eq 'OFFLINE') {
$dataOffline[$ttimeslot] = '-5';
}
}
$RRDlabels[int($limitTest - $counter - 1)] = substr($startTime, 0, 5) unless ( $counter % $xLabelStep );
$counter++;
}
}
$sth->finish() or $rv = errorTrapDBIgraphEntry("Cannot sth->finish: $findString", \$logger, $debug);
}
$dbh->disconnect or $rv = errorTrapDBIgraphEntry("Sorry, the database was unable to add your entry.", \$logger, $debug);
} else {
$title .= " - DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage";
applications/collector.pl view on Meta::CPAN
# Set the plotarea at (xOffset, yOffset) and of size $width - 95 x $hight - 78 pixels, with white background. Set border and grid line colors.
$c->setPlotArea($xOffset, $yOffset, $width - 95, $hight - 78, 0xffffff, -1, 0xa08040, $c->dashLineColor(0x0, 0x0101), $c->dashLineColor(0x0, 0x0101))->setGridWidth(1);
# Add a title box to the chart using 10 pts Arial Bold Italic font. The text is white (0x000000)
$c->addText($width/2, 14, "$title", "arialbi.ttf", 10, 0x000000, 5, 0);
# Set labels on the x axis
unless ( $xRealtime ) {
for ($counter = 0; $counter < $limitTest; $counter += $xLabelStep) {
$RRDlabels[int($limitTest - $counter - 1)] = substr(scalar(localtime(($lastTimeslot - ($step * ($counter))))), 11, 5);
}
}
$c->xAxis()->setLabels(\@RRDlabels);
for ($counter = 0; $counter < $limitTest - $xLabelStep; $counter += $xLabelStep) {
my $labelStep = $xLabelStep / 3;
$c->xAxis()->addMark($counter + $labelStep, $c->dashLineColor(0x0, 0x103))->setDrawOnTop(0);
$c->xAxis()->addMark($counter + ($labelStep * 2), $c->dashLineColor(0x0, 0x103))->setDrawOnTop(0);
}
applications/collector.pl view on Meta::CPAN
$c->yAxis()->addZone(0, -6, $yMarkColor) unless ( $markOrZone );
$layer->addDataSet(\@dataOK, $COLORSRRD {OK}, " Duration");
}
$layer->addDataSet(\@dataWarning, $COLORSRRD {WARNING}, " Warning");
$layer->addDataSet(\@dataCritical, $COLORSRRD {CRITICAL}, " Critical");
$layer->addDataSet(\@dataUnknown, $COLORSRRD {UNKNOWN}, " Unknown");
$layer->addDataSet(\@dataNoTest, $COLORSRRD {"NO TEST"}, " No test");
$layer->addDataSet(\@dataOffline, $COLORSRRD {OFFLINE}, " Offline");
# Set the sub-bar gap to 0, so there is no gap between stacked bars with a group
$layer->setBarGap(-1.7E-100, 0);
# Set the bar border to transparent
if ($withBorder) {
$layer->setBorderColor(0xF0F0F0);
} else {
$layer->setBorderColor($perlchartdir::Transparent);
}
# Add a legend box
applications/collector.pl view on Meta::CPAN
$c->addText($width - 18, $hight - 21, "Interval: " . $interval . " min, " . $DEPARTMENT . " @ " . $BUSINESS . ", created on: " . scalar(localtime()) . ".", "arial.ttf", 8, 0x000000, 6, 0);
#output the chart
$c->makeChart("$dbiFilename.png");
return $rv;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub errorTrapDBIgraphEntry {
my ($error_message, $logger, $debug) = @_;
print 'errorTrapDBIgraphEntry', "\n", $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";
$$logger->error("errorTrapDBIgraphEntry:\n" .$error_message. "\nERROR: $DBI::err ($DBI::errstr)") if ( defined $$logger and $$logger->is_error() );
return 0;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_usage () {
print "Usage: $PROGNAME -H <MySQL hostname> [-M <mode>] [-C <collectorlist>] [-W <screenDebug>] [-A <allDebug>] [-N <nokDebug>] [-s <dumphttp>] [-S <status>] [-D <debug>] [-V version] [-h help]\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Collector for the '$APPLICATION'
-H, --hostname=<HOSTNAME>
HOSTNAME : hostname/address from the MySQL server
-M, --mode=O|L|C
O(nce) : run the program once
L(oop) : run the program as a loop
C(rontab) : run the program crontab based
-C, --collectorlist=<FILENAME>
applications/collector.pl view on Meta::CPAN
N(agios): Nagios custom plugin output (default)
S(nmp) : SNMP ...
-D, --debug=F|T|L
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
L(ong) : long screendebugging on
-V, --version
-h, --help
Send email to $SENDEMAILTO if you have questions regarding
use of this software. To submit patches or suggest improvements, send
email to $SENDEMAILTO
";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/custom/cartography.pm-orig view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use ASNMTAP::Asnmtap::Applications v3.002.003;
use ASNMTAP::Asnmtap::Applications qw($IMAGESPATH %ICONS);
use ASNMTAP::Asnmtap::Applications::Display v3.002.003;
use ASNMTAP::Asnmtap::Applications::Display qw(:APPLICATIONS :DBDISPLAY);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createGifForCartography {
my ($catalogID_uniqueKey, $status) = @_;
my $value = $catalogID_uniqueKey;
$value =~ s/-/_/g;
my $command = "cp ${IMAGESPATH}/$ICONS{$status} ${RESULTSPATH}/_ASNMTAP/${value}.gif";
system ("$command");
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printLinkToCartography {
my ($serverName, $checklist, $catalogID, $uniqueKey) = @_;
# modify the value of $url with the link to your cartography tool - - -
my $url = 'http://cartography.citap.be/index.htm?entry';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $value = "${catalogID}_${uniqueKey}";
$value =~ s/-/_/g;
my $dataLinkToCartography = "<TR><TD BGCOLOR=#000080 ALIGN=RIGHT COLSPAN=2>Cartography</TD></TR>";
applications/custom/display.pm-orig view on Meta::CPAN
use strict;
use warnings; # Must be used in test mode only. This reduces a little process speed
#use diagnostics; # Must be used in test mode only. This reduces a lot of process speed
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BEGIN { if ( $ENV{ASNMTAP_PERL5LIB} ) { eval 'use lib ( "$ENV{ASNMTAP_PERL5LIB}" )'; } }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printStatusMessageCustom {
my $statusMessage = shift(@_);
my $break = '';
my $errorMessage = '';
if ($statusMessage =~ /<NIHIL>/ ) {
$errorMessage = 'possible a problem with this execution for this plugin';
# ***************************************************************************
# Error codes indicate an error with DUMMY-Tn *
# ***************************************************************************
applications/custom/display.pm-orig view on Meta::CPAN
# Error codes indicate an error with the UME1 End-to-End controle *
# ***************************************************************************
} elsif ($statusMessage =~ /Elektronisch loket/ ) {
if ($statusMessage =~ /CR - Aangemaakt en verzonden/ ) { $errorMessage = 'UME1 problem.'; }
if ($statusMessage =~ /\+R0010\+/ ) { $break = ($errorMessage) ? '<BR>' : ''; $errorMessage .= $break . 'RSZ.'; }
if ($statusMessage =~ /\+R0020\+/ ) { $break = ($errorMessage) ? '<BR>' : ''; $errorMessage .= $break . 'FOD Financien.'; }
if ($statusMessage =~ /\+R0060\+/ ) { $break = ($errorMessage) ? '<BR>' : ''; $errorMessage .= $break . 'Nationale Bank.'; }
# ***************************************************************************
# } elsif ($statusMessage =~ /<string to find>/ ) {
# if ($statusMessage =~ /\+<substring to find>\+/ ) { $errorMessage = '<erormessage to return>'; }
# ---------------------------------------------------------------------------
# End custom code -----------------------------------------------------------
# ---------------------------------------------------------------------------
}
return $errorMessage;
}
# End display.pm -------------------------------------------------------------------------------------
applications/custom/sde-supportRequest.pm-orig view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI v3.002.003;
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :DBREADONLY :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use SOAP::Lite;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub webserviceSupportRequest {
my ($catalogID, $uKey, $method, $whereClause, $fieldlist, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug) = @_;
# DATABASE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $CARTO_SERVER = 'crinaeadtbs01';
my $CARTO_DATABASE = 'carto';
my $CARTO_TABLE = 'TestRelationships';
# SOAP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $tool = 'ASNMTAP';
my $cluster = 'http://itiltest1.smals-mvm.be/ivwse';
my $namespace = 'http://itiltest1.smals-mvm.be/ivwse/';
applications/custom/sde-supportRequest.pm-orig view on Meta::CPAN
'http://www.w3.org/2001/XMLSchema' => 's',
'http://schemas.xmlsoap.org/wsdl/' => 'wsdl',
'http://schemas.xmlsoap.org/wsdl/http/' => 'http',
'http://microsoft.com/wsdl/mime/textMatching/' => 'tm',
'http://infravision.com/ivwse' => 's1'
);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub _getEventsData {
my ($catalogID, $uKey, $hash_valueEventsData, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug) = @_;
my $rv = 1;
my $dbh = DBI->connect("DBI:mysql:$DATABASE:$SERVERNAMEREADONLY:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY") or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
my $sql = "select SQL_NO_CACHE title, duration, timeslot, endDate, endTime, status, statusMessage, filename from $SERVERTABLEVENTSDISPLAYDT where catalogID = '$catalogID' and uKey = '$uKey' and step <> '0' order by timeslot desc limit 1";
my $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID);
$sth->execute or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID) if $rv;
if ( $rv ) {
while ( my $ref = $sth->fetchrow_hashref() ) {
$$hash_valueEventsData{found} = 1;
$$hash_valueEventsData{title} = $ref->{title} if ( $ref->{title} );
$$hash_valueEventsData{duration} = $ref->{duration} if ( $ref->{duration} );
$$hash_valueEventsData{timeslot} = $ref->{timeslot} if ( $ref->{timeslot} );
$$hash_valueEventsData{endDate} = $ref->{endDate} if ( $ref->{endDate} );
$$hash_valueEventsData{endTime} = $ref->{endTime} if ( $ref->{endTime} );
$$hash_valueEventsData{status} = $ref->{status} if ( $ref->{status} );
$$hash_valueEventsData{statusMessage} = $ref->{statusMessage} if ( $ref->{statusMessage} );
$$hash_valueEventsData{filename} = $ref->{filename} if ( $ref->{filename} );
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID);
if ( $rv and exists $$hash_valueEventsData{found} and $$hash_valueEventsData{status} !~ /$STATE{$ERRORS{OK}}/ ) {
my @table = ( "$SERVERTABLEVENTSDISPLAYDT", "$SERVERTABLEVENTS USE INDEX (catalogID, uKey, key_timeslot)" );
foreach my $table ( @table ) {
if ( $$hash_valueEventsData{status} =~ /$STATE{$ERRORS{WARNING}}/ ) { # event
$sql = "select SQL_NO_CACHE endDate, endTime, timeslot, status from $table where catalogID = '$catalogID' and uKey = '$uKey' and step <> '0' and not ( status = '". $STATE{$ERRORS{WARNING}} ."' ) order by timeslot desc limit 1";
} elsif ( $$hash_valueEventsData{status} =~ /($STATE{$ERRORS{UNKNOWN}}|$STATE{$ERRORS{CRITICAL}}|$STATE{$ERRORS{'NO DATA'}})/ ) { # incident
$sql = "select SQL_NO_CACHE endDate, endTime, timeslot, status from $table where catalogID = '$catalogID' and uKey = '$uKey' and step <> '0' and not ( status = '". $STATE{$ERRORS{UNKNOWN}} ."' or status = '". $STATE{$ERRORS{CRITICAL}} ....
}
my $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID);
$sth->execute or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID) if $rv;
if ( $rv ) {
while ( my $ref = $sth->fetchrow_hashref() ) {
$$hash_valueEventsData{OUT_SCOPE}{found} = $ERRORS{$ref->{status}};
$$hash_valueEventsData{OUT_SCOPE}{timeslot} = $ref->{timeslot} if ( $ref->{timeslot} );
$$hash_valueEventsData{OUT_SCOPE}{endDate} = $ref->{endDate} if ( $ref->{endDate} );
$$hash_valueEventsData{OUT_SCOPE}{endTime} = $ref->{endTime} if ( $ref->{endTime} );
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID);
last if ( exists $$hash_valueEventsData{OUT_SCOPE}{found} );
}
}
if ( $rv and exists $$hash_valueEventsData{OUT_SCOPE}{found} and defined $$hash_valueEventsData{OUT_SCOPE}{found} ) {
my $timeRange = "timeslot > '". $$hash_valueEventsData{OUT_SCOPE}{timeslot} ."'";
foreach my $table ( @table ) {
if ( $$hash_valueEventsData{status} =~ /$STATE{$ERRORS{WARNING}}/ ) { # event
$sql = "select SQL_NO_CACHE endDate, endTime, timeslot, status from $table where catalogID = '$catalogID' and uKey = '$uKey' and step <> '0' and $timeRange and ( status = '". $STATE{$ERRORS{WARNING}} ."' ) order by timeslot asc limit ...
} elsif ( $$hash_valueEventsData{status} =~ /($STATE{$ERRORS{UNKNOWN}}|$STATE{$ERRORS{CRITICAL}}|$STATE{$ERRORS{'NO DATA'}})/ ) { # incident
$sql = "select SQL_NO_CACHE endDate, endTime, timeslot, status from $table where catalogID = '$catalogID' and uKey = '$uKey' and step <> '0' and $timeRange and ( status = '". $STATE{$ERRORS{UNKNOWN}} ."' or status = '". $STATE{$ERRORS...
}
my $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID);
$sth->execute or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID) if $rv;
if ( $rv ) {
while (my $ref = $sth->fetchrow_hashref()) {
$$hash_valueEventsData{IN_SCOPE}{found} = $ERRORS{$ref->{status}};
$$hash_valueEventsData{IN_SCOPE}{timeslot} = $ref->{timeslot} if ( $ref->{timeslot} );
$$hash_valueEventsData{IN_SCOPE}{endDate} = $ref->{endDate} if ( $ref->{endDate} );
$$hash_valueEventsData{IN_SCOPE}{endTime} = $ref->{endTime} if ( $ref->{endTime} );
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID);
last if ( exists $$hash_valueEventsData{IN_SCOPE}{found} );
}
}
}
}
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID) if ($dbh and $rv);
}
return $rv;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub _getSupportRequestData {
my ($serverName, $database, $table, $catalogID, $uKey, $hash_valueSupportRequestData, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug) = @_;
$$hash_valueSupportRequestData{code} = '?';
$$hash_valueSupportRequestData{slaID} = '?';
$$hash_valueSupportRequestData{impact} = 'High';
$$hash_valueSupportRequestData{invoicedOrg} = '?';
$$hash_valueSupportRequestData{service} = '?';
$$hash_valueSupportRequestData{priority} = 'P01';
my $rv = 1;
my $dbh = DBI->connect("DBI:mysql:$database:$serverName:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY") or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $ref...
if ($dbh and $rv) {
my $sql = "select SQL_NO_CACHE code, slaID, invoicedOrg, service, impact, priority from $table where catalogID = '$catalogID' and uKey = '$uKey'";
my $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID);
$sth->execute or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID) if $rv;
if ( $rv ) {
while (my $ref = $sth->fetchrow_hashref()) {
$$hash_valueSupportRequestData{code} = $ref->{code} if ( $ref->{code} );
$$hash_valueSupportRequestData{slaID} = $ref->{slaID} if ( $ref->{slaID} );
$$hash_valueSupportRequestData{impact} = $ref->{impact} if ( $ref->{impact} );
$$hash_valueSupportRequestData{invoicedOrg} = $ref->{invoicedOrg} if ( $ref->{invoicedOrg} );
$$hash_valueSupportRequestData{service} = $ref->{service} if ( $ref->{service} );
$$hash_valueSupportRequestData{priority} = $ref->{priority} if ( $ref->{priority} );
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID);
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID) if ($dbh and $rv);
}
return $rv;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub _actionOnSoapResponse {
my ($asnmtapInherited, $som, $arguments) = @_;
my $root = $som->dataof ('/Envelope/Body');
my $WebServiceResults = $root->value;
if ( $asnmtapInherited->getOptionsValue('debug') ) {
use Data::Dumper;
print Dumper ($WebServiceResults), "\n";
}
my $response = $arguments->{method} .'Response';
my $returnCode = ( ( exists $WebServiceResults->{ $response } ) ? ( ( defined $WebServiceResults->{ $response } and $WebServiceResults->{ $response } ne '' ) ? $ERRORS{OK} : $ERRORS{WARNING} ) : $ERRORS{CRITICAL} );
unless ( $returnCode ) {
if ( $arguments->{method} eq 'InsertSupportRequest' ) {
# ...
} else { # $arguments->{method} =~ /^GetSupportRequest(?:List)*$/
if ( exists $WebServiceResults->{$response}->{SupportRequest} ) {
sub processGetSupportRequestResponse {
my ($supportRequest, $arguments, $counter) = @_;
if ( defined $supportRequest->{Number} ) {
my ($header, $data) = ('', '');
if ( defined $arguments->{fieldlist}->{'*'} ) {
while (my ($key, $value) = each %{ $supportRequest } ) {
$header .= '"'. $key .'",' unless ($counter);
$data .= '"'. $value .'",';
}
applications/custom/sde-supportRequest.pm-orig view on Meta::CPAN
SOAP::Data->new(name => 'group', type => 's:string', attr => {}),
SOAP::Data->new(name => 'OutageStart', type => 's:dateTime', attr => {})
], # end parameters
}, # end InsertSupportRequest
); # end my %methods
last; };
/^GetSupportRequest$/ && do {
unless ( defined $whereClause ) {
$objectPlugins->pluginValues ( { error => 'GetSupportRequest: whereClause NOT DEFINED' }, $TYPE{APPEND} );
$succeeded = error_SupportRequest(*STDOUT, $objectPlugins->pluginValue ('error'), $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -2, $onload, $sessionID);
return ( $succeeded, $objectPlugins->pluginValue ( 'alert' ), $objectPlugins->pluginValue ( 'error' ) );
}
%methods = (
"$method" => {
parameters => [
SOAP::Data->new(name => 'whereClause', type => 's:string', value => $whereClause, attr => {})
], # end parameters
}, # end GetSupportRequest
); # end my %methods
last; };
/^GetSupportRequestList$/ && do {
unless ( defined $whereClause ) {
$objectPlugins->pluginValues ( { error => 'InsertSupportRequest: whereClause NOT DEFINED' }, $TYPE{APPEND} );
$succeeded = error_SupportRequest(*STDOUT, $objectPlugins->pluginValue ('error'), $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -2, $onload, $sessionID);
return ( $succeeded, $objectPlugins->pluginValue ('alert'), $objectPlugins->pluginValue ('error') );
}
%methods = (
"$method" => {
parameters => [
SOAP::Data->new(name => 'whereClause', type => 's:string', value => '<![CDATA['. $whereClause .']]>', attr => {}),
SOAP::Data->new(name => 'orderBy', type => 's:string', value => 'number', attr => {}),
], # end parameters
}, # end GetSupportRequestList
); # end my %methods
last; };
/^UpdateSupportRequest$/ && do {
unless ( defined $whereClause ) {
$objectPlugins->pluginValues ( { error => 'InsertSupportRequest: whereClause NOT DEFINED' }, $TYPE{APPEND} );
$succeeded = error_SupportRequest(*STDOUT, $objectPlugins->pluginValue ('error'), $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -2, $onload, $sessionID);
return ( $succeeded, $objectPlugins->pluginValue ('alert'), $objectPlugins->pluginValue ('error') );
}
%methods = (
"$method" => {
parameters => [
# ...
], # end parameters
}, # end UpdateSupportRequest
); # end my %methods
last; };
$objectPlugins->pluginValues ( { error => 'method: UNKNOWN' }, $TYPE{APPEND} );
$succeeded = error_SupportRequest(*STDOUT, $objectPlugins->pluginValue ('error'), $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -2, $onload, $sessionID);
return ( $succeeded, $objectPlugins->pluginValue ('alert'), $objectPlugins->pluginValue ('error') );
}
if ( $debug eq 'T' ) {
use Data::Dumper;
print Dumper (%methods), "\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/custom/sde-supportRequest.pm-orig view on Meta::CPAN
my $counter = 10;
%fieldlist = map { $counter++ => $_ } split (/,/, $fieldlist);
} else {
$fieldlist {'*'} = '*';
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($rv, %valueEventsDataDisplay, %valueSupportRequestData) = ( 1 );
$rv = _getEventsData ($catalogID, $uKey, \%valueEventsDataDisplay, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug);
if ( $debug eq 'T' ) {
use Data::Dumper;
print Dumper (%valueEventsDataDisplay), "\n";
}
unless ( $rv ) {
$objectPlugins->pluginValues ( { error => '_getEventsData' }, $TYPE{APPEND} );
$succeeded = error_SupportRequest(*STDOUT, $objectPlugins->pluginValue ('error'), $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -2, $onload, $sessionID);
return ( $rv, $objectPlugins->pluginValue ('alert'), $objectPlugins->pluginValue ('error') );
}
$rv = _getSupportRequestData ($CARTO_SERVER, $CARTO_DATABASE, $CARTO_TABLE, $catalogID, $uKey, \%valueSupportRequestData, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug);
if ( $debug eq 'T' ) {
use Data::Dumper;
print Dumper (%valueSupportRequestData), "\n";
}
unless ( $rv ) {
$objectPlugins->pluginValues ( { error => '_getSupportRequestData' }, $TYPE{APPEND} );
$succeeded = error_SupportRequest(*STDOUT, $objectPlugins->pluginValue ('error'), $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -2, $onload, $sessionID);
return ( $rv, $objectPlugins->pluginValue ('alert'), $objectPlugins->pluginValue ('error') );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
foreach my $FQDN ( split ( /,/, $cluster ) ) {
my %customArguments = (FQDN => $FQDN, method => $method, fieldlist => \%fieldlist);
my ($returnCode, $xml) = get_soap_request (
asnmtapInherited => \$objectPlugins,
applications/custom/sde-supportRequest.pm-orig view on Meta::CPAN
TYPE_ERROR_RETURN => 'APPEND'
);
last unless ( $returnCode );
}
$succeeded = 'SR <#>' unless ( $objectPlugins->pluginValue ( 'stateValue' ) );
my $alert = $objectPlugins->pluginValue ('alert');
my $error = $objectPlugins->pluginValue ('error');
undef $objectPlugins;
$succeeded = error_SupportRequest(*STDOUT, $error, $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -2, $onload, $sessionID) unless ( $succeeded );
return ( $succeeded, $alert, $error );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub insertSupportRequest {
my ($catalogID, $uKey, $title, $remoteUser, $outageStartDate, $outageStartTime, $description, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug) = @_;
return ( webserviceSupportRequest( $catalogID, $uKey, 'InsertSupportRequest', undef, undef, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug ) );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub getSupportRequest {
my ($catalogID, $uKey, $title, $remoteUser, $problemSolved, $list, $updated, $supportRequest, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug) = @_;
return ( webserviceSupportRequest($catalogID, $uKey, ( ( defined $list && $list ) ? 'GetSupportRequestList' : 'GetSupportRequest' ), "Customer='ASNMTAP MONITORING' and source='Alarm' CompletionCode<>'SOLVED'", 'Number,Status,CompletionCode,CI,Categ...
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub updateSupportRequest {
my ($catalogID, $uKey, $title, $remoteUser, $outageEndDate, $outageEndTime, $description, $supportRequest, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug) = @_;
return ( webserviceSupportRequest( $catalogID, $uKey, 'UpdateSupportRequest', undef, undef, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug ) );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub error_SupportRequest {
my ($HTML, $error_message, $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID) = @_;
my $subject = "$htmlTitle / error_SupportRequest: " . get_datetimeSignal();
my $message = get_datetimeSignal() . "\npagedir : $pagedir\npageset : $pageset\nhtml title: $htmlTitle\n\nerror message:\n$error_message\n";
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $message, $debug );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
if ( $refresh == 0 ) {
return (0, $error_message, "Error: ...", "String: ...");
} elsif ( $refresh == -1 ) {
print "<H1>Support Request Error:</H1>\n", $error_message, "\n<BR>";
return 0;
} elsif ( $refresh == -2 ) {
return 0;
} else {
print_header ($HTML, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, 'F', '', $sessionID);
print "<H1>Support Request Error:</H1>\n", $error_message, "\n<BR>";
return 0;
}
}
# End sde-supportRequest.pm --------------------------------------------------------------------------------
1;
applications/custom/sde.pm-orig view on Meta::CPAN
BEGIN { if ( $ENV{ASNMTAP_PERL5LIB} ) { eval 'use lib ( "$ENV{ASNMTAP_PERL5LIB}" )'; } }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use ASNMTAP::Asnmtap::Applications::Display v3.002.003;
use ASNMTAP::Asnmtap::Applications::Display qw(:APPLICATIONS :DBDISPLAY);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub getTimeperiodRelationshipsSDE {
my ($serverName, $checklist, $hash_catalogID_uKey_timeperiodID, $debug) = @_;
my $CARTO_DATABASE = 'carto';
my $CARTO_TABLE = 'TestRelationships';
my $rv = 1;
my $dbh = DBI->connect("DBI:mysql:$CARTO_DATABASE:$serverName:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE") or $rv = errorTrapDBI($checklist, "Cannot connect to the database");
if ($dbh and $rv) {
my $sql = "select SQL_NO_CACHE catalogID, uKey, priority, imw_sunday, imw_monday, imw_tuesday, imw_wednesday, imw_thursday, imw_friday, imw_saturday from $CARTO_TABLE";
applications/custom/sde.pm-orig view on Meta::CPAN
$sth->finish() or $rv = errorTrapDBI($checklist, "Cannot sth->finish: $sql");
}
$dbh->disconnect or $rv = errorTrapDBI($checklist, "Sorry, the database was unable to add your entry.") if ($dbh and $rv);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printRelationshipsSDE {
my ($serverName, $checklist, $catalogID, $uniqueKey) = @_;
my $CARTO_DATABASE = 'carto';
my $CARTO_TABLE = 'TestRelationships';
my $dataRelationshipsSDE = '';
my $rv = 1;
my $dbh = DBI->connect("DBI:mysql:$CARTO_DATABASE:$serverName:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE") or $rv = errorTrapDBI($checklist, "Cannot connect to the database");
applications/custom/supportRequest.pm-orig view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use ASNMTAP::Time qw(&get_datetimeSignal);
use ASNMTAP::Asnmtap::Applications::CGI v3.002.003;
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :DBREADONLY :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub insertSupportRequest {
my ($catalogID, $uKey, $title, $remoteUser, $outageStartDate, $outageStartTime, $description, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug) = @_;
my ($succeeded, $alert, $error) = ( 1 );
# ...
return ($succeeded, $alert, $error);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub getSupportRequest {
my ($catalogID, $uKey, $title, $remoteUser, $problemSolved, $list, $updated, $supportRequest, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug) = @_;
my ($succeeded, $alert, $error) = ( 1 );
# ...
return ($succeeded, $alert, $error);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub updateSupportRequest {
my ($catalogID, $uKey, $title, $remoteUser, $outageEndDate, $outageEndTime, $description, $supportRequest, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID, $debug) = @_;
my ($succeeded, $alert, $error) = ( 1 );
# ...
return ($succeeded, $alert, $error);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub error_SupportRequest {
my ($HTML, $error_message, $debug, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, $sessionID) = @_;
my $subject = "$htmlTitle / error_SupportRequest: " . get_datetimeSignal();
my $message = get_datetimeSignal() . "\npagedir : $pagedir\npageset : $pageset\nhtml title: $htmlTitle\n\nerror message:\n$error_message\n";
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $message, $debug );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
if ( $refresh == 0 ) {
return (0, $error_message, "Error: ...", "String: ...");
} elsif ( $refresh == -1 ) {
print "<H1>Support Request Error:</H1>\n", $error_message, "\n<BR>";
return 0;
} else {
print_header ($HTML, $pagedir, $pageset, $htmlTitle, $subTitle, $refresh, $onload, 'F', '', $sessionID);
print "<H1>Support Request:</H1>\n", $error_message, "\n<BR>";
return 0;
}
}
# End supportRequest.pm ------------------------------------------------------------------------------------
1;
applications/display-test.pl view on Meta::CPAN
my $creationTime; # default
my $displayTime = 1; # default
my $lockMySQL = 0; # default
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $displayTimeslot = 0; # only for extra debugging information
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help ();
sub print_usage ();
Getopt::Long::Configure('bundling');
GetOptions (
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"C:s" => \$opt_C, "checklist:s" => \$opt_C,
"P:s" => \$opt_P, "pagedir:s" => \$opt_P,
"D:s" => \$opt_D, "debug:s" => \$opt_D,
applications/display-test.pl view on Meta::CPAN
exit 0;
}
exit 0;
}
# if ($boolean_daemonControl) { waitpid($pid,0); }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub resultsdirCreate {
foreach $dchecklist (@checklisttable) {
my (undef, undef, $resultsdir, undef) = split(/\#/, $dchecklist, 4);
my $logging = $RESULTSPATH .'/'. $resultsdir;
create_dir ($logging);
$logging .= "/";
create_header ($logging ."HEADER.html");
create_footer ($logging ."FOOTER.html");
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub read_tableSoundStatusCache {
my ($checklist, $debug) = @_;
%tableSoundStatusCache = ();
if (-e "$APPLICATIONPATH/tmp/$checklist-sound-status.cache") {
my $rvOpen = open(READ, "$APPLICATIONPATH/tmp/$checklist-sound-status.cache");
if ($rvOpen) {
while (<READ>) {
chomp;
applications/display-test.pl view on Meta::CPAN
print "-->\n";
while ( my ($key, $value) = each(%tableSoundStatusCache) ) { print "'$key' => '$value'\n"; }
print "<--\n";
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub write_tableSoundStatusCache {
my ($checklist, $debug) = @_;
my $rvOpen = open(WRITE, ">$APPLICATIONPATH/tmp/$checklist-sound-status.cache");
if ($rvOpen) {
print "\n$APPLICATIONPATH/tmp/$checklist-sound-status.cache: WRITE\n-->\n" if ($debug);
while ( my ($key, $value) = each(%tableSoundStatusCache) ) {
print WRITE "$key=>$value\n";
print "'$key' => '$value'\n" if ($debug);
}
close(WRITE);
print "<--\n" if ($debug);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub do_crontab {
my ($Cenvironment) = @_;
$pagedir = $pagedirOrig;
$pagedir .= "/$Cenvironment" unless ($Cenvironment eq 'P');
my $directory = $HTTPSPATH .'/nav/'. $pagedir;
create_dir ($directory) unless ( -e "$directory" );
$htmlOutput = $directory .'/'. $pageset;
$rvOpen = open(HTML, ">$htmlOutput.tmp");
applications/display-test.pl view on Meta::CPAN
if ($rv) {
while (my $ref = $sth->fetchrow_hashref()) {
$timeslot = ( $step ? int(($lastTimeslot - $ref->{timeslot}) / $step) : 0 );
print "<", $timeslot, "><", $ref->{title}, "><", $ref->{startTime}, "><", $ref->{timeslot}, ">\n" if ($debug);
if ($timeslot >= 0) {
my $dstatus = ($ref->{status} eq '<NIHIL>') ? 'UNKNOWN' : $ref->{status};
$tstatus = $dstatus;
if ($dstatus eq 'OK' and $trendline) {
my $tSeconden = int(substr($ref->{duration}, 6, 2)) + int(substr($ref->{duration}, 3, 2)*60) + int(substr($ref->{duration}, 0, 2)*3600);
$tstatus = 'TRENDLINE' if ($tSeconden > $trendline);
}
$itemStatus[$timeslot] = $tstatus;
$itemStarttime[$timeslot] = $ref->{startTime};
$itemTimeslot[$timeslot] = $ref->{timeslot};
unless ( defined $ref->{perfdata} and $ref->{perfdata} ne '' ) { # remove performance data
# ($ref->{statusMessage}, undef) = split(/\|/, $ref->{statusMessage}, 2);
my $statusMessage = reverse $ref->{statusMessage};
applications/display-test.pl view on Meta::CPAN
close(HTMLCV);
rename("$htmlOutput-cv.tmp", "$htmlOutput-cv.html") if (-e "$htmlOutput-cv.tmp");
close(HTMLMCV);
rename("$htmlOutput-mcv.tmp", "$htmlOutput-mcv.html") if (-e "$htmlOutput-mcv.tmp");
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_DIE {
#print "kill -DIE <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_WARN {
#print "kill -WARN <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalQUIT {
print "kill -QUIT <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
unlink $pidfile;
$boolean_daemonQuit = 1;
use Sys::Hostname;
my $subject = "$prgtext\@". hostname() .": Config $APPLICATIONPATH/etc/$checklist successfully stopped at ". get_datetimeSignal();
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $subject ."\n", 0 );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
exit 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalHUP {
print "kill -HUP <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
$boolean_signal_hup = 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub write_pid {
print "write PID <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
if (-e "$pidfile") {
print "ERROR: couldn't create pid file <$pidfile> for <$PROGNAME v$version -C $checklist>\n";
exit 0;
} else {
open(PID,">$pidfile") || die "Cannot open $pidfile!!\n";
print PID $$;
close(PID);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub create_dir {
my ($directory) = @_;
unless ( -e "$directory" ) { # create $directory
my ($status, $stdout, $stderr) = call_system ("mkdir $directory", 0);
print " create_dir ---- : mkdir $directory: $status, $stdout, $stderr\n" if ( ! $status or $stderr ne '' );
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub errorTrapDBI {
my ($checklist, $error_message) = @_;
print $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";
unless ( -e "$RESULTSPATH/$checklist-MySQL-sql-error.txt" ) {
my $subject = "$prgtext / Current status for $checklist: " . get_datetimeSignal();
my $message = get_datetimeSignal() . " $error_message\n--> ERROR: $DBI::err ($DBI::errstr)\n";
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $message, $debug );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
}
$rvOpen = open(DEBUG,">>$RESULTSPATH/$checklist-MySQL-sql-error.txt");
if ($rvOpen) {
print DEBUG get_datetimeSignal, ' ', $error_message, "\n--> ERROR: $DBI::err ($DBI::errstr)\n";
close(DEBUG);
} else {
print "Cannot open $RESULTSPATH/$checklist-MySQL-sql-error.txt to print debug information\n";
}
return 0;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub build_hash_timeperiodID_days {
my ($checklist, $pagedir, $hash_timeperiodID_days, $debug) = @_;
print "build_hash_timeperiodID_days: '$checklist', '$pagedir'\n" if ($debug);
my $rv = 1;
my $dbh = DBI->connect("DBI:mysql:$DATABASE:$serverName:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE") or $rv = errorTrapDBI($checklist, "Cannot connect to the database");
return () unless ($dbh and $rv);
# (localtime)[6]: weekday Number of days since Sunday (0 - 6)
my %WDAYS = ('sunday'=>'0','monday'=>'1','tuesday'=>'2','wednesday'=>'3','thursday'=>'4','friday'=>'5','saturday'=>'6');
applications/display-test.pl view on Meta::CPAN
$dbh->disconnect or $rv = errorTrapDBI($checklist, "Sorry, the database was unable to add your entry.") if ($dbh and $rv);
if ($debug) {
use Data::Dumper;
print Dumper ( $hash_timeperiodID_days ), "\n\n";
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub build_hash_catalogID_uKey_timeperiodID {
my ($checklist, $pagedir, $hash_catalogID_uKey_timeperiodID, $debug) = @_;
print "build_hash_catalogID_uKey_timeperiodID: '$checklist', '$pagedir'\n" if ($debug);
my $rv = 1;
my $dbh = DBI->connect("DBI:mysql:$DATABASE:$serverName:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE") or $rv = errorTrapDBI($checklist, "Cannot connect to the database");
return () unless ($dbh and $rv);
my $sql = "SELECT SQL_NO_CACHE $SERVERTABLPLUGINS.catalogID, $SERVERTABLPLUGINS.uKey, $SERVERTABLVIEWS.timeperiodID FROM `$SERVERTABLDISPLAYDMNS`, `$SERVERTABLVIEWS`, `$SERVERTABLPLUGINS` WHERE $SERVERTABLDISPLAYDMNS.pagedir = '$pagedir' AND $SERVE...
print "<", $sql, ">\n" if ($debug);
applications/display-test.pl view on Meta::CPAN
}
if ($debug) {
use Data::Dumper;
print Dumper ( $hash_catalogID_uKey_timeperiodID ), "\n\n";
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub inIncidentMonitoringWindow {
my ($catalogID, $uniqueKey, $timeslot, $startTime, $endTime, $endDate, $timeperiodID_days, $catalogID_uKey_timeperiodID, $debug) = @_;
my $InIMW;
my ($year, $month, $day) = split (/[-\/]/, $endDate);
if (defined $year and defined $month and defined $day) {
my $Year = $year-1900;
my $Month = $month-1;
my $wDay = (localtime( timelocal( 0, 0, 0, $day, $Month, $Year ) ))[6];
applications/display-test.pl view on Meta::CPAN
$InIMW = 1 unless (defined $InIMW);
} else {
$InIMW = 1;
}
return ($InIMW);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printHtmlHeader {
my $htmlTitle = shift(@_);
print_header (*HTML, $pagedir, "$pageset-cv", $htmlTitle, "Full View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef);
print HTML '<TABLE WIDTH="100%">', "\n";
print_header (*HTMLCV, $pagedir, "$pageset-mcv", $htmlTitle, "Condenced View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef);
print HTMLCV '<TABLE WIDTH="100%">', "\n";
print_header (*HTMLMCV, $pagedir, "$pageset", $htmlTitle, "Minimal Condenced View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef...
print HTMLMCV '<TABLE WIDTH="100%">', "\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printGroepHeader {
my ($title, $show) = @_;
if ($show) {
$groupFullView = $groupCondensedView = 0;
delete @multiarrayFullCondensedView[0..@multiarrayFullCondensedView];
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printStatusHeader {
my ($title, $configNumber, $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $playSoundStatus) = @_;
my ($emptyFullViewMessage, $emptyCondencedViewMessage, $emptyMinimalCondencedViewMessage);
if ( $configNumber ) { # Monitored Applications
if ( $emptyFullView ) {
$emptyMinimalCondencedViewMessage = $emptyCondencedViewMessage = $emptyFullViewMessage = 'Contact ASAP the server administrators, probably collector/config problems!';
} else {
$emptyCondencedViewMessage = 'All Monitored Applications are OK' if ( $emptyCondencedView );
$emptyMinimalCondencedViewMessage = 'All Monitored Applications are OK' if ( $emptyMinimalCondencedView );
applications/display-test.pl view on Meta::CPAN
} else {
print HTMLMCV '</TABLE>', "\n";
}
print_legend (*HTMLMCV);
print HTMLMCV '<TABLE WIDTH="100%">', "\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printItemHeader {
my ($environment, $resultsdir, $catalogID_uniqueKey, $catalogID, $uniqueKey, $command, $title, $help, $popup, $statusOverlib, $comment) = @_;
unless ( defined $creationTime ) {
my $htmlFilename = "$RESULTSPATH/$resultsdir/$command-$catalogID_uniqueKey";
$htmlFilename .= "-sql.html";
unless ( -e "$htmlFilename" ) {
my $rvOpen = open(PNG, ">$htmlFilename");
if ($rvOpen) {
applications/display-test.pl view on Meta::CPAN
}
my ($posTokenFrom, $posTokenTo, $groep, $test, $serverID);
$posTokenFrom = index $title, '[';
if ($posTokenFrom eq -1) {
$groep = '';
$test = $title;
} else {
$posTokenTo = index $title, ']', $posTokenFrom+1;
$groep = substr($title, $posTokenFrom, $posTokenTo+2);
$test = substr($title, $posTokenTo+2);
}
$posTokenFrom = index $test, ' {';
if ($posTokenFrom eq -1) {
$serverID = '';
} else {
$posTokenTo = index $test, '}', $posTokenFrom+2;
$serverID = substr($test, $posTokenFrom+2); chop ($serverID);
$test = substr($test, 0, $posTokenFrom);
}
# http://www.bosrup.com/web/overlib/?Command_Reference
my $_exclaim = '';
if (-s "$APPLICATIONPATH/custom/sde.pm") {
require "$APPLICATIONPATH/custom/sde.pm";
$_exclaim .= printRelationshipsSDE( $serverName, $checklist, $catalogID, $uniqueKey );
}
applications/display-test.pl view on Meta::CPAN
if ( $catalogID ne $CATALOGID or defined $creationTime ) {
$itemFullCondensedView .= ' <TD class="ItemHeader">'.$groep. encode_html_entities('T', $test) .'</TD>'. "\n";
} else {
$itemFullCondensedView .= ' <TD class="ItemHeader">'.$groep.'<A HREF="#" class="ItemHeaderTest" onClick="openPngImage(\''. $RESULTSURL .'/'. $resultsdir .'/'. $command .'-'. $catalogID_uniqueKey ."-sql.html',912,576,null,null,'ChartDirector',1...
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printGroepCV {
my ($title, $showGroup, $showFooter) = @_;
if ($showGroup and $title ne '') {
if ($groupFullView) {
$emptyFullView = ( scalar ( @multiarrayFullCondensedView ) ? 0 : 1 );
unless ( $emptyFullView ) {
print HTML '<TR><TD class="GroupHeader" COLSPAN=', $colspanDisplayTime, '>', encode_html_entities('T', $title), '</TD></TR>', "\n";
foreach my $arrayFullCondensedView ( @multiarrayFullCondensedView ) {
applications/display-test.pl view on Meta::CPAN
}
}
print HTMLCV '<tr style="{height: 4;}"><TD></TD></TR>', "\n", if $showFooter;
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printItemStatus {
my ($interval, $number, $status, $endTime, $acked, $timeslot, $activationTimeslot, $suspentionTimeslot, $instability, $persistent, $downtime, $suspentionTimeslotPersistentTrue, $suspentionTimeslotPersistentFalse, $catalogID_uniqueKey, $catalogID, $...
my $statusIcon = ($acked and ($activationTimeslot - $step < $timeslot) and ($suspentionTimeslot > $timeslot)) ? ( $instability ? $ICONSUNSTABLE {$status} : $ICONSACK {$status} ) : $ICONS{$status};
my ($debugInfo, $boldStart, $boldEnd);
$debugInfo = $boldStart = $boldEnd = '';
if ($number == 0) {
$printCondensedView = 1 unless ( $status eq 'IN PROGRESS' or $status eq 'OK' or $status eq 'NO TEST' or $status eq 'OFFLINE' );
if ($ERRORS{$status} <= $ERRORS{UNKNOWN} or $ERRORS{$status} == $ERRORS{'NO DATA'}) { $playSoundStatus = ($playSoundStatus > $ERRORS{$status}) ? $playSoundStatus : $ERRORS{$status}; }
applications/display-test.pl view on Meta::CPAN
if ($displayTime) {
$itemFullCondensedView .= ' <TD><IMG SRC="'. $IMAGESURL .'/'. $statusIcon .'" WIDTH="16" HEIGHT="16" BORDER=0 title="'. $status .'" alt="'. $status .'"></TD>'. "\n";
$itemFullCondensedView .= ' <TD class="ItemStatus"><FONT COLOR="'. $COLORS{$status} .'">'. $debugInfo . $boldStart . $endTime . $boldEnd .'</FONT></TD>'. "\n";
} else {
$itemFullCondensedView .= ' <TD><IMG SRC="'. $IMAGESURL .'/'. $statusIcon .'" WIDTH="16" HEIGHT="16" BORDER=0 title="'. $endTime .'" alt="'. $endTime .'"></TD>'. "\n";
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printStatusMessage {
my ($statusMessage) = @_;
my $break = '';
my $errorMessage;
# ***************************************************************************
# The 400 series of Web error codes indicate an error with your Web browser *
# ***************************************************************************
if ($statusMessage =~ /400 Bad Request/ ) {
$errorMessage = 'The request could not be understood by the server due to incorrect syntax';
applications/display-test.pl view on Meta::CPAN
$errorMessage = printStatusMessageCustom( decode_html_entities('E', $statusMessage) );
}
my $returnMessage = ' <TR><TD WIDTH="56"> </TD><TD VALIGN="TOP">' . $statusMessage . '</TD></TR>' . "\n";
$returnMessage .= ' <TR><TD WIDTH="56"> </TD><TD> </TD><TD> </TD><TD class="StatusMessageError">' . encode_html_entities('E', $errorMessage) . '</TD></TR>' . "\n" if ($errorMessage);
return ( $returnMessage );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printHtmlFooter {
my $title = @_;
print HTML "</BODY>\n</HTML>";
print HTMLCV "</BODY>\n</HTML>";
print HTMLMCV "</BODY>\n</HTML>";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printGroepFooter {
my ($title, $show) = @_;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printItemFooter {
my ($catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $status, $timeslot, $statusIcon, $insertInMCV, $inIMW, $itemFullCondensedView, $printCondensedView, $arrayStatusMessage, $catalogID_uKey_timeperiodID) = @_;
$itemFullCondensedView .= "</TR>\n";
if (@$arrayStatusMessage) {
$itemFullCondensedView .= '<TR style="{height: 0;}"><TD COLSPAN="'. $colspanDisplayTime .'"><DIV id="'.$catalogID_uniqueKey.'" style="display:none"><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=2>'. "\n";
foreach my $arrayStatusMessage ( @$arrayStatusMessage ) { $itemFullCondensedView .= printStatusMessage ( $arrayStatusMessage ); }
$itemFullCondensedView .= "</TABLE></DIV></TD></TR>\n";
}
applications/display-test.pl view on Meta::CPAN
$groupCondensedView += $printCondensedView;
my $groep = ( $title =~ /^\[(\d+)\]/ ? $1 : 0);
push ( @multiarrayFullCondensedView, [ $ERRORS{"$status"}, $groep, $timeslot, $statusIcon, $itemFullCondensedView, $printCondensedView ] );
my $priorityGroup = '-MCV-' . ( ( exists $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{priority} ) ? $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{priority} : 'P01' ) . '-';
push ( @multiarrayMinimalCondensedView, [ $ERRORS{"$status"}, $priorityGroup, $timeslot, $statusIcon, $itemFullCondensedView ] ) if ( ( ! $statusIcon or ( $statusIcon and $insertInMCV ) ) and $status !~ /(?:OK|DEPENDENT|OFFLINE|NO TEST|TRENDLINE)/ ...
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printStatusFooter {
my ($title, $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $playSoundStatus) = @_;
print HTML '</TABLE>', "\n";
print HTML <<EOH;
<script language="JavaScript" type="text/javascript">
function toggleDiv (div_id){
if (document.getElementById(div_id)) {
if (document.getElementById(div_id).style.display == 'none') {
document.getElementById(div_id).style.display = 'block';
applications/display-test.pl view on Meta::CPAN
playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
}
</script>
EOH
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub maskPassword {
my ($parameters) = @_;
# --dnPass=
if ($parameters =~ /--dnPass=/) {
$parameters =~ s/(--dnPass=)\w+/$1********/g;
}
# --proxy=user:pasword\@proxy
if ($parameters =~ /--proxy=/) {
$parameters =~ s/(--proxy=\w*:)\w*(\@\w+)/$1********$2/g;
applications/display-test.pl view on Meta::CPAN
# j_username= or j_password= (J2EE based Applications)
if ($parameters =~ /j_username=/ and $parameters =~ /j_password=/) {
$parameters =~ s/(j_password=)\w+/$1********/g;
}
return ($parameters);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_usage () {
print "Usage: $PROGNAME -H <MySQL hostname> [-C <Checklist>] [-P <pagedir>] [-L <loop>] [-t <trigger>] [-c <YYYY-MM-DD HH:MM:SS> ] [-T <displayTime>] [-l <lockMySQL>] [-D <debug>] [-V version] [-h help]\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Display for the '$APPLICATION'
-H, --hostname=<HOSTNAME>
HOSTNAME : hostname/address from the MySQL server
-C, --checklist=<FILENAME>
FILENAME : filename from the checklist for the html output loop (default 'DisplayCT')
-P, --pagedir=<PAGEDIR>
PAGEDIR : sub directory name for the html output (default 'index')
-L, --loop=F|T
F(alse) : loop off (default)
T(rue) : loop on
-t, --trigger=F|T
F(alse) : trigger off (default)
T(rue) : trigger on
-c, --creationTime=<YYYY-MM-DD HH:MM:SS>
YYYY-MM-DD HH:MM:SS: year, month, day, hours, minutes and seconds to use instead of the current time when --loop = F
-T, --displayTime=F|T
F(alse) : display timeslots into html output off
applications/display-test.pl view on Meta::CPAN
-l, --lockMySQL=F|T
F(alse) : lock MySQL table off (default)
T(rue) : lock MySQL table on
-D, --debug=F|T
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
-V, --version
-h, --help
Send email to $SENDEMAILTO if you have questions regarding
use of this software. To submit patches or suggest improvements, send
email to $SENDEMAILTO
";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/display.pl view on Meta::CPAN
my $creationTime; # default
my $displayTime = 1; # default
my $lockMySQL = 0; # default
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $displayTimeslot = 0; # only for extra debugging information
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help ();
sub print_usage ();
Getopt::Long::Configure('bundling');
GetOptions (
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"C:s" => \$opt_C, "checklist:s" => \$opt_C,
"P:s" => \$opt_P, "pagedir:s" => \$opt_P,
"D:s" => \$opt_D, "debug:s" => \$opt_D,
applications/display.pl view on Meta::CPAN
exit 0;
}
exit 0;
}
# if ($boolean_daemonControl) { waitpid($pid,0); }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub resultsdirCreate {
foreach $dchecklist (@checklisttable) {
my (undef, undef, $resultsdir, undef) = split(/\#/, $dchecklist, 4);
my $logging = $RESULTSPATH .'/'. $resultsdir;
create_dir ($logging);
$logging .= "/";
create_header ($logging ."HEADER.html");
create_footer ($logging ."FOOTER.html");
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub read_tableSoundStatusCache {
my ($checklist, $debug) = @_;
%tableSoundStatusCache = ();
if (-e "$APPLICATIONPATH/tmp/$checklist-sound-status.cache") {
my $rvOpen = open(READ, "$APPLICATIONPATH/tmp/$checklist-sound-status.cache");
if ($rvOpen) {
while (<READ>) {
chomp;
applications/display.pl view on Meta::CPAN
print "-->\n";
while ( my ($key, $value) = each(%tableSoundStatusCache) ) { print "'$key' => '$value'\n"; }
print "<--\n";
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub write_tableSoundStatusCache {
my ($checklist, $debug) = @_;
my $rvOpen = open(WRITE, ">$APPLICATIONPATH/tmp/$checklist-sound-status.cache");
if ($rvOpen) {
print "\n$APPLICATIONPATH/tmp/$checklist-sound-status.cache: WRITE\n-->\n" if ($debug);
while ( my ($key, $value) = each(%tableSoundStatusCache) ) {
print WRITE "$key=>$value\n";
print "'$key' => '$value'\n" if ($debug);
}
close(WRITE);
print "<--\n" if ($debug);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub do_crontab {
my ($Cenvironment) = @_;
$pagedir = $pagedirOrig;
$pagedir .= "/$Cenvironment" unless ($Cenvironment eq 'P');
my $directory = $HTTPSPATH .'/nav/'. $pagedir;
create_dir ($directory) unless ( -e "$directory" );
$htmlOutput = $directory .'/'. $pageset;
$rvOpen = open(HTML, ">$htmlOutput.tmp");
applications/display.pl view on Meta::CPAN
if ($rv) {
while (my $ref = $sth->fetchrow_hashref()) {
$timeslot = ( $step ? int(($lastTimeslot - $ref->{timeslot}) / $step) : 0 );
print "<", $timeslot, "><", $ref->{title}, "><", $ref->{startTime}, "><", $ref->{timeslot}, ">\n" if ($debug);
if ($timeslot >= 0) {
my $dstatus = ($ref->{status} eq '<NIHIL>') ? 'UNKNOWN' : $ref->{status};
$tstatus = $dstatus;
if ($dstatus eq 'OK' and $trendline) {
my $tSeconden = int(substr($ref->{duration}, 6, 2)) + int(substr($ref->{duration}, 3, 2)*60) + int(substr($ref->{duration}, 0, 2)*3600);
$tstatus = 'TRENDLINE' if ($tSeconden > $trendline);
}
$itemStatus[$timeslot] = $tstatus;
$itemStarttime[$timeslot] = $ref->{startTime};
$itemTimeslot[$timeslot] = $ref->{timeslot};
unless ( defined $ref->{perfdata} and $ref->{perfdata} ne '' ) { # remove performance data
# ($ref->{statusMessage}, undef) = split(/\|/, $ref->{statusMessage}, 2);
my $statusMessage = reverse $ref->{statusMessage};
applications/display.pl view on Meta::CPAN
close(HTMLCV);
rename("$htmlOutput-cv.tmp", "$htmlOutput-cv.html") if (-e "$htmlOutput-cv.tmp");
close(HTMLMCV);
rename("$htmlOutput-mcv.tmp", "$htmlOutput-mcv.html") if (-e "$htmlOutput-mcv.tmp");
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_DIE {
#print "kill -DIE <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signal_WARN {
#print "kill -WARN <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalQUIT {
print "kill -QUIT <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
unlink $pidfile;
$boolean_daemonQuit = 1;
use Sys::Hostname;
my $subject = "$prgtext\@". hostname() .": Config $APPLICATIONPATH/etc/$checklist successfully stopped at ". get_datetimeSignal();
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $subject ."\n", 0 );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
exit 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub signalHUP {
print "kill -HUP <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
$boolean_signal_hup = 1;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub write_pid {
print "write PID <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
if (-e "$pidfile") {
print "ERROR: couldn't create pid file <$pidfile> for <$PROGNAME v$version -C $checklist>\n";
exit 0;
} else {
open(PID,">$pidfile") || die "Cannot open $pidfile!!\n";
print PID $$;
close(PID);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub create_dir {
my ($directory) = @_;
unless ( -e "$directory" ) { # create $directory
my ($status, $stdout, $stderr) = call_system ("mkdir $directory", 0);
print " create_dir ---- : mkdir $directory: $status, $stdout, $stderr\n" if ( ! $status or $stderr ne '' );
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub errorTrapDBI {
my ($checklist, $error_message) = @_;
print $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";
unless ( -e "$RESULTSPATH/$checklist-MySQL-sql-error.txt" ) {
my $subject = "$prgtext / Current status for $checklist: " . get_datetimeSignal();
my $message = get_datetimeSignal() . " $error_message\n--> ERROR: $DBI::err ($DBI::errstr)\n";
my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $message, $debug );
print "Problem sending email to the '$APPLICATION' server administrators\n" unless ( $returnCode );
}
$rvOpen = open(DEBUG,">>$RESULTSPATH/$checklist-MySQL-sql-error.txt");
if ($rvOpen) {
print DEBUG get_datetimeSignal, ' ', $error_message, "\n--> ERROR: $DBI::err ($DBI::errstr)\n";
close(DEBUG);
} else {
print "Cannot open $RESULTSPATH/$checklist-MySQL-sql-error.txt to print debug information\n";
}
return 0;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub build_hash_timeperiodID_days {
my ($checklist, $pagedir, $hash_timeperiodID_days, $debug) = @_;
print "build_hash_timeperiodID_days: '$checklist', '$pagedir'\n" if ($debug);
my $rv = 1;
my $dbh = DBI->connect("DBI:mysql:$DATABASE:$serverName:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE") or $rv = errorTrapDBI($checklist, "Cannot connect to the database");
return () unless ($dbh and $rv);
# (localtime)[6]: weekday Number of days since Sunday (0 - 6)
my %WDAYS = ('sunday'=>'0','monday'=>'1','tuesday'=>'2','wednesday'=>'3','thursday'=>'4','friday'=>'5','saturday'=>'6');
applications/display.pl view on Meta::CPAN
$dbh->disconnect or $rv = errorTrapDBI($checklist, "Sorry, the database was unable to add your entry.") if ($dbh and $rv);
if ($debug) {
use Data::Dumper;
print Dumper ( $hash_timeperiodID_days ), "\n\n";
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub build_hash_catalogID_uKey_timeperiodID {
my ($checklist, $pagedir, $hash_catalogID_uKey_timeperiodID, $debug) = @_;
print "build_hash_catalogID_uKey_timeperiodID: '$checklist', '$pagedir'\n" if ($debug);
my $rv = 1;
my $dbh = DBI->connect("DBI:mysql:$DATABASE:$serverName:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE") or $rv = errorTrapDBI($checklist, "Cannot connect to the database");
return () unless ($dbh and $rv);
my $sql = "SELECT SQL_NO_CACHE $SERVERTABLPLUGINS.catalogID, $SERVERTABLPLUGINS.uKey, $SERVERTABLVIEWS.timeperiodID FROM `$SERVERTABLDISPLAYDMNS`, `$SERVERTABLVIEWS`, `$SERVERTABLPLUGINS` WHERE $SERVERTABLDISPLAYDMNS.pagedir = '$pagedir' AND $SERVE...
print "<", $sql, ">\n" if ($debug);
applications/display.pl view on Meta::CPAN
}
if ($debug) {
use Data::Dumper;
print Dumper ( $hash_catalogID_uKey_timeperiodID ), "\n\n";
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub inIncidentMonitoringWindow {
my ($catalogID, $uniqueKey, $timeslot, $startTime, $endTime, $endDate, $timeperiodID_days, $catalogID_uKey_timeperiodID, $debug) = @_;
my $InIMW;
my ($year, $month, $day) = split (/[-\/]/, $endDate);
if (defined $year and defined $month and defined $day) {
my $Year = $year-1900;
my $Month = $month-1;
my $wDay = (localtime( timelocal( 0, 0, 0, $day, $Month, $Year ) ))[6];
applications/display.pl view on Meta::CPAN
$InIMW = 1 unless (defined $InIMW);
} else {
$InIMW = 1;
}
return ($InIMW);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printHtmlHeader {
my $htmlTitle = shift(@_);
print_header (*HTML, $pagedir, "$pageset-cv", $htmlTitle, "Full View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef);
print HTML '<TABLE WIDTH="100%">', "\n";
print_header (*HTMLCV, $pagedir, "$pageset-mcv", $htmlTitle, "Condenced View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef);
print HTMLCV '<TABLE WIDTH="100%">', "\n";
print_header (*HTMLMCV, $pagedir, "$pageset", $htmlTitle, "Minimal Condenced View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef...
print HTMLMCV '<TABLE WIDTH="100%">', "\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printGroepHeader {
my ($title, $show) = @_;
if ($show) {
$groupFullView = $groupCondensedView = 0;
delete @multiarrayFullCondensedView[0..@multiarrayFullCondensedView];
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printStatusHeader {
my ($title, $configNumber, $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $playSoundStatus) = @_;
my ($emptyFullViewMessage, $emptyCondencedViewMessage, $emptyMinimalCondencedViewMessage);
if ( $configNumber ) { # Monitored Applications
if ( $emptyFullView ) {
$emptyMinimalCondencedViewMessage = $emptyCondencedViewMessage = $emptyFullViewMessage = 'Contact ASAP the server administrators, probably collector/config problems!';
} else {
$emptyCondencedViewMessage = 'All Monitored Applications are OK' if ( $emptyCondencedView );
$emptyMinimalCondencedViewMessage = 'All Monitored Applications are OK' if ( $emptyMinimalCondencedView );
applications/display.pl view on Meta::CPAN
} else {
print HTMLMCV '</TABLE>', "\n";
}
print_legend (*HTMLMCV);
print HTMLMCV '<TABLE WIDTH="100%">', "\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printItemHeader {
my ($environment, $resultsdir, $catalogID_uniqueKey, $catalogID, $uniqueKey, $command, $title, $help, $popup, $statusOverlib, $comment) = @_;
unless ( defined $creationTime ) {
my $htmlFilename = "$RESULTSPATH/$resultsdir/$command-$catalogID_uniqueKey";
$htmlFilename .= "-sql.html";
unless ( -e "$htmlFilename" ) {
my $rvOpen = open(PNG, ">$htmlFilename");
if ($rvOpen) {
applications/display.pl view on Meta::CPAN
}
my ($posTokenFrom, $posTokenTo, $groep, $test, $serverID);
$posTokenFrom = index $title, '[';
if ($posTokenFrom eq -1) {
$groep = '';
$test = $title;
} else {
$posTokenTo = index $title, ']', $posTokenFrom+1;
$groep = substr($title, $posTokenFrom, $posTokenTo+2);
$test = substr($title, $posTokenTo+2);
}
$posTokenFrom = index $test, ' {';
if ($posTokenFrom eq -1) {
$serverID = '';
} else {
$posTokenTo = index $test, '}', $posTokenFrom+2;
$serverID = substr($test, $posTokenFrom+2); chop ($serverID);
$test = substr($test, 0, $posTokenFrom);
}
# http://www.bosrup.com/web/overlib/?Command_Reference
my $_exclaim = '';
if (-s "$APPLICATIONPATH/custom/sde.pm") {
require "$APPLICATIONPATH/custom/sde.pm";
$_exclaim .= printRelationshipsSDE( $serverName, $checklist, $catalogID, $uniqueKey );
}
applications/display.pl view on Meta::CPAN
if ( $catalogID ne $CATALOGID or defined $creationTime ) {
$itemFullCondensedView .= ' <TD class="ItemHeader">'.$groep. encode_html_entities('T', $test) .'</TD>'. "\n";
} else {
$itemFullCondensedView .= ' <TD class="ItemHeader">'.$groep.'<A HREF="#" class="ItemHeaderTest" onClick="openPngImage(\''. $RESULTSURL .'/'. $resultsdir .'/'. $command .'-'. $catalogID_uniqueKey ."-sql.html',912,576,null,null,'ChartDirector',1...
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printGroepCV {
my ($title, $showGroup, $showFooter) = @_;
if ($showGroup and $title ne '') {
if ($groupFullView) {
$emptyFullView = ( scalar ( @multiarrayFullCondensedView ) ? 0 : 1 );
unless ( $emptyFullView ) {
print HTML '<TR><TD class="GroupHeader" COLSPAN=', $colspanDisplayTime, '>', encode_html_entities('T', $title), '</TD></TR>', "\n";
foreach my $arrayFullCondensedView ( @multiarrayFullCondensedView ) {
applications/display.pl view on Meta::CPAN
}
}
print HTMLCV '<tr style="{height: 4;}"><TD></TD></TR>', "\n", if $showFooter;
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printItemStatus {
my ($interval, $number, $status, $endTime, $acked, $timeslot, $activationTimeslot, $suspentionTimeslot, $instability, $persistent, $downtime, $suspentionTimeslotPersistentTrue, $suspentionTimeslotPersistentFalse, $catalogID_uniqueKey, $catalogID, $...
my $statusIcon = ($acked and ($activationTimeslot - $step < $timeslot) and ($suspentionTimeslot > $timeslot)) ? ( $instability ? $ICONSUNSTABLE {$status} : $ICONSACK {$status} ) : $ICONS{$status};
my ($debugInfo, $boldStart, $boldEnd);
$debugInfo = $boldStart = $boldEnd = '';
if ($number == 0) {
$printCondensedView = 1 unless ( $status eq 'IN PROGRESS' or $status eq 'OK' or $status eq 'NO TEST' or $status eq 'OFFLINE' );
if ($ERRORS{$status} <= $ERRORS{UNKNOWN} or $ERRORS{$status} == $ERRORS{'NO DATA'}) { $playSoundStatus = ($playSoundStatus > $ERRORS{$status}) ? $playSoundStatus : $ERRORS{$status}; }
applications/display.pl view on Meta::CPAN
if ($displayTime) {
$itemFullCondensedView .= ' <TD><IMG SRC="'. $IMAGESURL .'/'. $statusIcon .'" WIDTH="16" HEIGHT="16" BORDER=0 title="'. $status .'" alt="'. $status .'"></TD>'. "\n";
$itemFullCondensedView .= ' <TD class="ItemStatus"><FONT COLOR="'. $COLORS{$status} .'">'. $debugInfo . $boldStart . $endTime . $boldEnd .'</FONT></TD>'. "\n";
} else {
$itemFullCondensedView .= ' <TD><IMG SRC="'. $IMAGESURL .'/'. $statusIcon .'" WIDTH="16" HEIGHT="16" BORDER=0 title="'. $endTime .'" alt="'. $endTime .'"></TD>'. "\n";
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printStatusMessage {
my ($statusMessage) = @_;
my $break = '';
my $errorMessage;
# ***************************************************************************
# The 400 series of Web error codes indicate an error with your Web browser *
# ***************************************************************************
if ($statusMessage =~ /400 Bad Request/ ) {
$errorMessage = 'The request could not be understood by the server due to incorrect syntax';
applications/display.pl view on Meta::CPAN
$errorMessage = printStatusMessageCustom( decode_html_entities('E', $statusMessage) );
}
my $returnMessage = ' <TR><TD WIDTH="56"> </TD><TD VALIGN="TOP">' . $statusMessage . '</TD></TR>' . "\n";
$returnMessage .= ' <TR><TD WIDTH="56"> </TD><TD> </TD><TD> </TD><TD class="StatusMessageError">' . encode_html_entities('E', $errorMessage) . '</TD></TR>' . "\n" if ($errorMessage);
return ( $returnMessage );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printHtmlFooter {
my $title = @_;
print HTML "</BODY>\n</HTML>";
print HTMLCV "</BODY>\n</HTML>";
print HTMLMCV "</BODY>\n</HTML>";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printGroepFooter {
my ($title, $show) = @_;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printItemFooter {
my ($catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $status, $timeslot, $statusIcon, $insertInMCV, $inIMW, $itemFullCondensedView, $printCondensedView, $arrayStatusMessage, $catalogID_uKey_timeperiodID) = @_;
$itemFullCondensedView .= "</TR>\n";
if (@$arrayStatusMessage) {
$itemFullCondensedView .= '<TR style="{height: 0;}"><TD COLSPAN="'. $colspanDisplayTime .'"><DIV id="'.$catalogID_uniqueKey.'" style="display:none"><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=2>'. "\n";
foreach my $arrayStatusMessage ( @$arrayStatusMessage ) { $itemFullCondensedView .= printStatusMessage ( $arrayStatusMessage ); }
$itemFullCondensedView .= "</TABLE></DIV></TD></TR>\n";
}
applications/display.pl view on Meta::CPAN
$groupCondensedView += $printCondensedView;
my $groep = ( $title =~ /^\[(\d+)\]/ ? $1 : 0);
push ( @multiarrayFullCondensedView, [ $ERRORS{"$status"}, $groep, $timeslot, $statusIcon, $itemFullCondensedView, $printCondensedView ] );
my $priorityGroup = '-MCV-' . ( ( exists $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{priority} ) ? $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{priority} : 'P01' ) . '-';
push ( @multiarrayMinimalCondensedView, [ $ERRORS{"$status"}, $priorityGroup, $timeslot, $statusIcon, $itemFullCondensedView ] ) if ( ( ! $statusIcon or ( $statusIcon and $insertInMCV ) ) and $status !~ /(?:OK|DEPENDENT|OFFLINE|NO TEST|TRENDLINE)/ ...
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printStatusFooter {
my ($title, $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $playSoundStatus) = @_;
print HTML '</TABLE>', "\n";
print HTML <<EOH;
<script language="JavaScript" type="text/javascript">
function toggleDiv (div_id){
if (document.getElementById(div_id)) {
if (document.getElementById(div_id).style.display == 'none') {
document.getElementById(div_id).style.display = 'block';
applications/display.pl view on Meta::CPAN
playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
}
</script>
EOH
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub maskPassword {
my ($parameters) = @_;
# --dnPass=
if ($parameters =~ /--dnPass=/) {
$parameters =~ s/(--dnPass=)\w+/$1********/g;
}
# --proxy=user:pasword\@proxy
if ($parameters =~ /--proxy=/) {
$parameters =~ s/(--proxy=\w*:)\w*(\@\w+)/$1********$2/g;
applications/display.pl view on Meta::CPAN
# j_username= or j_password= (J2EE based Applications)
if ($parameters =~ /j_username=/ and $parameters =~ /j_password=/) {
$parameters =~ s/(j_password=)\w+/$1********/g;
}
return ($parameters);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_usage () {
print "Usage: $PROGNAME -H <MySQL hostname> [-C <Checklist>] [-P <pagedir>] [-L <loop>] [-t <trigger>] [-c <YYYY-MM-DD HH:MM:SS> ] [-T <displayTime>] [-l <lockMySQL>] [-D <debug>] [-V version] [-h help]\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Display for the '$APPLICATION'
-H, --hostname=<HOSTNAME>
HOSTNAME : hostname/address from the MySQL server
-C, --checklist=<FILENAME>
FILENAME : filename from the checklist for the html output loop (default 'DisplayCT')
-P, --pagedir=<PAGEDIR>
PAGEDIR : sub directory name for the html output (default 'index')
-L, --loop=F|T
F(alse) : loop off (default)
T(rue) : loop on
-t, --trigger=F|T
F(alse) : trigger off (default)
T(rue) : trigger on
-c, --creationTime=<YYYY-MM-DD HH:MM:SS>
YYYY-MM-DD HH:MM:SS: year, month, day, hours, minutes and seconds to use instead of the current time when --loop = F
-T, --displayTime=F|T
F(alse) : display timeslots into html output off
applications/display.pl view on Meta::CPAN
-l, --lockMySQL=F|T
F(alse) : lock MySQL table off (default)
T(rue) : lock MySQL table on
-D, --debug=F|T
F(alse) : screendebugging off (default)
T(true) : normal screendebugging on
-V, --version
-h, --help
Send email to $SENDEMAILTO if you have questions regarding
use of this software. To submit patches or suggest improvements, send
email to $SENDEMAILTO
";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/JSFX_Layer.js view on Meta::CPAN
{
JSFX.eventmasks = {
onabort:Event.ABORT, onblur:Event.BLUR, onchange:Event.CHANGE,
onclick:Event.CLICK, ondblclick:Event.DBLCLICK,
ondragdrop:Event.DRAGDROP, onerror:Event.ERROR,
onfocus:Event.FOCUS, onkeydown:Event.KEYDOWN,
onkeypress:Event.KEYPRESS, onkeyup:Event.KEYUP, onload:Event.LOAD,
onmousedown:Event.MOUSEDOWN, onmousemove:Event.MOUSEMOVE,
onmouseout:Event.MOUSEOUT, onmouseover:Event.MOUSEOVER,
onmouseup:Event.MOUSEUP, onmove:Event.MOVE, onreset:Event.RESET,
onresize:Event.RESIZE, onselect:Event.SELECT, onsubmit:Event.SUBMIT,
onunload:Event.UNLOAD
};
JSFX.Layer.prototype.addEventHandler = function(eventname, handler)
{
this.elem.captureEvents(JSFX.eventmasks[eventname]);
var xl = this;
this.elem[eventname] = function(event) {
event.clientX = event.pageX;
event.clientY = event.pageY;
event.button = event.which;
applications/htmlroot/cgi-bin/admin/countries.pl view on Meta::CPAN
my $action = (defined $cgi->param('action')) ? $cgi->param('action') : 'listView';
my $CcountryID = (defined $cgi->param('countryID')) ? $cgi->param('countryID') : '';
my $CcountryName = (defined $cgi->param('countryName')) ? $cgi->param('countryName') : '';
my $Cactivated = (defined $cgi->param('activated')) ? $cgi->param('activated') : 'off';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledPrimaryKey, $submitButton);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&countryID=$CcountryID&countryName=$CcountryName&activated=$Cactivated";
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>order by : $orderBy<br>action : $action<br>country ID ...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my ($matchingCountries, $navigationBar);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = $formDisabledPrimaryKey = '';
if ($action eq 'duplicateView' or $action eq 'insertView') {
$htmlTitle = "Insert Country";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Country $CcountryID exist before to insert";
$sql = "select countryID from $SERVERTABLCOUNTRIES WHERE countryID='$CcountryID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Country $CcountryID exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Country $CcountryID inserted";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLCOUNTRIES. ' SET countryID="' .$CcountryID. '", countryName="' .$CcountryName. '", activated="' .$dummyActivated. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'deleteView') {
$formDisabledAll = $formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Delete Country $CcountryID";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$matchingCountries = ($CcountryID eq '00') ? "<h1>Countries:</h1><table><th>ID</th><th>country</th><tr><td>00</td><td>+ All countries</td></tr></table>\n" : '';
$sql = "select holidayID, holiday from $SERVERTABLHOLIDYS where countryID = '$CcountryID' order by holiday";
($rv, $matchingCountries) = check_record_exist ($rv, $dbh, $sql, 'Holidays', 'ID', 'Holiday', $matchingCountries, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select holidayBundleID, holidayBundleName from $SERVERTABLHOLIDYSBNDL where countryID = '$CcountryID' order by holidayBundleID";
($rv, $matchingCountries) = check_record_exist ($rv, $dbh, $sql, 'Holiday Bundle', 'ID', 'Name', $matchingCountries, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ($matchingCountries eq '') {
$sql = 'DELETE FROM ' .$SERVERTABLCOUNTRIES. ' WHERE countryID="' .$CcountryID. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Country $CcountryID deleted";
} else {
$htmlTitle = "Country $CcountryID not deleted, still used by";
}
} elsif ($action eq 'displayView') {
$formDisabledAll = $formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Display country $CcountryID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Edit country $CcountryID";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$matchingCountries = ($CcountryID eq '00') ? "<h1>Countries:</h1><table><tr><th>ID</th><th>country</th><tr><td>00</td><td>+ All countries</td></tr></table>\n" : '';
unless ( $dummyActivated ) {
$sql = "select holidayID, holiday from $SERVERTABLHOLIDYS where countryID = '$CcountryID'";
($rv, $matchingCountries) = check_record_exist ($rv, $dbh, $sql, 'Holidays', 'ID', 'Name', $matchingCountries, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select holidayBundleID, holidayBundleName from $SERVERTABLHOLIDYSBNDL where countryID = '$CcountryID' order by holidayBundleID";
($rv, $matchingCountries) = check_record_exist ($rv, $dbh, $sql, 'Holiday Bundle', 'ID', 'Name', $matchingCountries, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
if ($dummyActivated or $matchingCountries eq '') {
$sql = 'UPDATE ' .$SERVERTABLCOUNTRIES. ' SET countryID="' .$CcountryID. '", countryName="' .$CcountryName. '", activated="' .$dummyActivated. '" WHERE countryID="' .$CcountryID. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Country $CcountryID updated";
} else {
$htmlTitle = "Country $CcountryID not deactivated and updated, still used by";
}
} elsif ($action eq 'listView') {
$htmlTitle = "All countries listed";
$sql = "select SQL_NO_CACHE count(countryID) from $SERVERTABLCOUNTRIES";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&orderBy=$orderBy");
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLCOUNTRIES, 'countryName', "'1'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID...
$sql = "select countryID, countryName, activated from $SERVERTABLCOUNTRIES order by $orderBy limit $pageOffset, $RECORDSONPAGE";
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=countryID desc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Country ID <a href=\"$urlWithAccessParameters&action=listView&orderBy=c...
($rv, $matchingCountries, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Country', 'countryID', '0', '', '', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $nextAction, $pagedir, $pageset, $pag...
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select countryID, countryName, activated from $SERVERTABLCOUNTRIES where countryID = '$CcountryID'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CcountryID, $CcountryName, $Cactivated) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_array: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if ($sth->rows);
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function validateForm() {
if ( document.countries.countryID.value == null || document.countries.countryID.value == '' ) {
document.countries.countryID.focus();
alert('Please enter a country ID!');
return false;
}
applications/htmlroot/cgi-bin/admin/countries.pl view on Meta::CPAN
return false;
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="countries" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"countries\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/countries.pl view on Meta::CPAN
<tr><td><b>Country ID: </b></td><td>
<input type="text" name="countryID" value="$CcountryID" size="2" maxlength="2" $formDisabledPrimaryKey>
</td></tr><tr><td><b>Country Name: </b></td><td>
<input type="text" name="countryName" value="$CcountryName" size="45" maxlength="45" $formDisabledAll>
</td></tr><tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Country: $htmlTitle</h1></td></tr>";
print " <tr><td align=\"center\">$matchingCountries</td></tr>" if (defined $matchingCountries and $matchingCountries ne '');
} else {
print " <tr><td align=\"center\"><br>$matchingCountries</td></tr>";
}
print " </table>\n";
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
my $CmonthOfTheYear = (defined $cgi->param('monthOfTheYear')) ? $cgi->param('monthOfTheYear') : '*';
my $CdayOfTheWeek = (defined $cgi->param('dayOfTheWeek')) ? $cgi->param('dayOfTheWeek') : '*';
my $CnoOffline = (defined $cgi->param('noOffline')) ? $cgi->param('noOffline') : '';
my $Cactivated = (defined $cgi->param('activated')) ? $cgi->param('activated') : 'off';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledPrimaryKey, $submitButton, $uKeySelect);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&lineNumber=$ClineNumber&uKey=...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>order by : $orderBy<br>action ...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my ($catalogIDSelect, $collectorDaemonSelect, $matchingCrontabs, $navigationBar);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&catalogID=$CcatalogID";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = $formDisabledPrimaryKey = '';
if ($action eq 'duplicateView' or $action eq 'insertView') {
$htmlTitle = "Insert Crontab";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
$CcatalogID = $CATALOGID if ($action eq 'insertView');
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Crontab $ClineNumber, $CuKey from $CcatalogID exist before to insert";
$sql = "select collectorDaemon from $SERVERTABLCRONTABS WHERE catalogID = '$CcatalogID' and lineNumber='$ClineNumber' and uKey='$CuKey'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Crontab $ClineNumber, $CuKey from $CcatalogID exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Crontab $ClineNumber, $CuKey from $CcatalogID inserted";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLCRONTABS. ' SET catalogID="' .$CcatalogID. '", lineNumber="' .$ClineNumber. '", uKey="' .$CuKey. '", collectorDaemon="' .$CcollectorDaemon. '", arguments="' .$Carguments. '", minute="' .$Cminute. '", hour="' ...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'crontabView') {
$htmlTitle = "Selected crontabs to be listed";
$submitButton = "Crontabs";
$nextAction = "crontab" if ($rv);
} elsif ($action eq 'deleteView') {
$formDisabledPrimaryKey = $formDisabledAll = 'disabled';
$htmlTitle = "Delete crontab $ClineNumber, $CuKey from $CcatalogID";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$htmlTitle = "Crontab $ClineNumber, $CuKey from $CcatalogID deleted";
$sql = 'DELETE FROM ' .$SERVERTABLCRONTABS. ' WHERE catalogID="' .$CcatalogID. '" and lineNumber="' .$ClineNumber. '" and uKey="' .$CuKey. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
} elsif ($action eq 'displayView') {
$formDisabledPrimaryKey = $formDisabledAll = 'disabled';
$htmlTitle = "Display crontab $ClineNumber, $CuKey from $CcatalogID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Edit crontab $ClineNumber, $CuKey from $CcatalogID";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$htmlTitle = "Crontab $ClineNumber, $CuKey from $CcatalogID updated";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'UPDATE ' .$SERVERTABLCRONTABS. ' SET catalogID="' .$CcatalogID. '", lineNumber="' .$ClineNumber. '", uKey="' .$CuKey. '", collectorDaemon="' .$CcollectorDaemon. '", arguments="' .$Carguments. '", minute="' .$Cminute. '", hour="' .$Chour...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
} elsif ($action eq 'listView' or $action eq 'crontab') {
my ($sqlWhereCount, $sqlWhereList, $urlWithAccessParametersQuery);
$sqlWhereCount = $sqlWhereList = $urlWithAccessParametersQuery = '';
if ( $CcatalogIDreload ) {
$pageNo = 1;
$pageOffset = 0;
}
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
} else {
$htmlTitle = "All crontabs listed";
$nextAction = "listView";
$sqlWhereCount = "where $SERVERTABLCRONTABS.catalogID='$CcatalogID'";
$sqlWhereList = " $SERVERTABLCRONTABS.catalogID='$CcatalogID' and";
$urlWithAccessParametersQuery = "&catalogID=$CcatalogID";
}
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select SQL_NO_CACHE count(lineNumber) from $SERVERTABLCRONTABS $sqlWhereCount";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=$nextAction&orderBy=$orderBy$urlWithAcces...
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLCRONTABS, 'uKey', "catalogID = '$CcatalogID'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISES...
my ($catalogID, $lineNumber, $uKey, $groupName, $minute, $hour, $dayOfTheMonth, $monthOfTheYear, $dayOfTheWeek, $noOffline, $activated, $title);
$sql = "select $SERVERTABLCRONTABS.catalogID, $SERVERTABLCRONTABS.lineNumber, $SERVERTABLCRONTABS.uKey, $SERVERTABLCLLCTRDMNS.groupName, $SERVERTABLCRONTABS.minute, $SERVERTABLCRONTABS.hour, $SERVERTABLCRONTABS.dayOfTheMonth, $SERVERTABLCRONTAB...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
$sth->bind_columns( \$catalogID, \$lineNumber, \$uKey, \$groupName, \$minute, \$hour, \$dayOfTheMonth, \$monthOfTheYear, \$dayOfTheWeek, \$noOffline, \$activated, \$title ) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $deb...
if ( $rv ) {
my $actionPressend = ($iconAdd or $iconDelete or $iconDetails or $iconEdit) ? 1 : 0;
my $actionHeader = ($actionPressend) ? "<th>Action</th>" : '';
$urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=1&pageOffset=0&action=$nextAction$urlWithAccessParametersQuery";
$matchingCrontabs = "\n <table align=\"center\" border=0 cellpadding=1 cellspacing=1 bgcolor='$COLORSTABLE{TABLE}'>\n <tr><th><a href=\"$urlWithAccessParameters&action=listView&orderBy=catalogID desc, lineNumber asc, uKey ...
$matchingCrontabs .= "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=title desc, groupName asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Title <a href=\"$urlWithAccessParameters&action=lis...
$urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset";
if ( $sth->rows ) {
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
$matchingCrontabs .= " <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>$catalogID-$lineNumber-$uKey</td><td>$groupName</td><td>$title</td><td>$minute $hour $dayOfTheMonth $monthOfTheYear $dayOfTheWeek</td><td>$noOffline</td><td>$activ...
}
$urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=1&pageOffset=0&catalogID=$CcatalogID";
} else {
$matchingCrontabs .= " <tr><td colspan=\"7\">No records found for any crontab</td></tr>\n";
}
$matchingCrontabs .= " <tr><td colspan=\"7\">$navigationBar</td></tr>\n" if ($navigationBar);
$matchingCrontabs .= " </table>\n";
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select catalogID, lineNumber, uKey, collectorDaemon, arguments, minute, hour, dayOfTheMonth, monthOfTheYear, dayOfTheWeek, noOffline, activated from $SERVERTABLCRONTABS where catalogID='$CcatalogID' and lineNumber='$ClineNumber' and uKe...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CcatalogID, $ClineNumber, $CuKey, $CcollectorDaemon, $Carguments, $Cminute, $Chour, $CdayOfTheMonth, $CmonthOfTheYear, $CdayOfTheWeek, $CnoOffline, $Cactivated) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchro...
$CcatalogID = $CATALOGID if ($action eq 'duplicateView');
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
if ($action eq 'insertView' or $action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'crontabView') {
if ($CuKey eq 'none' or $action eq 'duplicateView') {
$sql = "select uKey, concat( title, ' (', $SERVERTABLENVIRONMENT.label, ')' ) as optionValueTitle from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where catalogID = '$CcatalogID' and $SERVERTABLPLUGINS.environment = $SERVERTABLENVIRONMENT.envi...
} else {
$sql = "select uKey, concat( title, ' (', $SERVERTABLENVIRONMENT.label, ')' ) from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where uKey = '$CuKey' and catalogID = '$CcatalogID' and $SERVERTABLPLUGINS.environment = $SERVERTABLENVIRONMENT.envi...
}
($rv, $uKeySelect, $htmlTitle) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, $nextAction, $CuKey, 'uKey', 'none', '-Select-', $formDisabledPrimaryKey, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select collectorDaemon, groupName from $SERVERTABLCLLCTRDMNS where catalogID = '$CcatalogID' order by groupName";
($rv, $collectorDaemonSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcollectorDaemon, 'collectorDaemon', 'none', '-Select-', $formDisabledAll, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'crontabView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
my $crontabFormatDigits = '(?:[0-9]{1,2})';
my $crontabValueDigitsMin = '(?:[0-9]|[1-5][0-9])';
my $crontabValueDigitsHour = '(?:[0-9]|1[0-9]|2[0-3])';
my $crontabValueDigitsDayOfMonth = '(?:[1-9]|[1-2][0-9]|3[0-1])';
my $crontabValueDigitsMonthOfYear = '(?:[1-9]|1[0-2])';
my $crontabValueDigitsDayOfWeek = '(?:[0-6])';
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
print <<HTML;
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="crontabs" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'listView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
document.crontabs.catalogIDreload.value = 1;
document.crontabs.submit();
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="crontabs">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"crontabs\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'crontabView' or $action eq 'listView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
HTML
}
print <<HTML;
<tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Unique Key: $htmlTitle</h1></td></tr>";
print " <tr><td align=\"center\">$matchingCrontabs</td></tr>" if (defined $matchingCrontabs and $matchingCrontabs ne '');
} else {
print " <tr><td><br><table align=\"center\" border=0 cellpadding=1 cellspacing=1 bgcolor='#333344'><tr><td align=\"left\"><b>Catalog ID: </b></td><td>$catalogIDSelect</td></tr></table></td></tr>" if ($action ne 'crontab');
print " <tr><td align=\"center\"><br>$matchingCrontabs</td></tr>";
}
print " </table>\n";
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$Cplugin = (defined $cgi->param('plugin')) ? $cgi->param('plugin') : '';
$ChelpPluginFilename = (defined $cgi->param('helpPluginFilename')) ? $cgi->param('helpPluginFilename') : '';
$Ctodo = (defined $cgi->param('todo')) ? $cgi->param('todo') : '';
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $numberCentralServers, $nextAction, $formDisabledAll, $formDisabledPrimaryKey, $submitButton);
my (@matchingAsnmtapCollectorCTscript, @matchingAsnmtapDisplayCTscript, %ASNMTAP_PATH);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=$action&auto=$Cauto";
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>action : $action<br>auto : $Cauto<br>URL ... : $urlAccessParameters</pre>" i...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID";
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$htmlTitle = "Update Configuration";
} elsif ($action eq 'update') {
$htmlTitle = "Configuration Updated";
} else {
$action = "menuView";
$htmlTitle = "Configuration Menu";
}
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $onload = ( ( $action =~ /^(check|generate|compare|install)View$/ ) ? "ONLOAD=\"if (document.images) document.Progress.src='".$IMAGESURL."/spacer.gif';\"" : '' );
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, $onload, 'F', '', $sessionID);
print " <br>\n";
print "<IMG SRC=\"".$IMAGESURL."/gears.gif\" HSPACE=\"0\" VSPACE=\"0\" BORDER=\"0\" NAME=\"Progress\" title=\"Please Wait ...\" alt=\"Please Wait ...\">" if ( $onload );
$rv = 1;
if ($action eq 'checkView' or $action eq 'generateView') {
# open connection to database and query data
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subT...
if ($dbh and $rv) {
my ($serverID, $displayDaemon, $collectorDaemon, $resultsdir, $groupTitle, $pagedirs, $catalogID, $uKey, $test, $interval, $title, $helpPluginFilename, $environment, $trendline, $minute, $hour, $dayOfTheMonth, $monthOfTheYear, $dayOfTheWeek, $a...
my ($prevServerID, $prevTypeMonitoring, $prevTypeServers, $prevTypeActiveServer, $prevMasterFQDN, $prevMasterASNMTAP_PATH, $prevMasterRSYNC_PATH, $prevMasterSSH_PATH, $prevSlaveFQDN, $prevSlaveASNMTAP_PATH, $prevSlaveRSYNC_PATH, $prevSlaveSSH_P...
my ($centralServerID, $centralTypeMonitoring, $centralTypeServers, $centralTypeActiveServer, $centralMasterFQDN, $centralMasterASNMTAP_PATH, $centralMasterRSYNC_PATH, $centralMasterSSH_PATH, $centralMasterDatabaseFQDN, $centralSlaveFQDN, $centr...
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($warning, $error, $count, $sqlTmp, $sthTmp, $actionItem);
$matchingWarnings .= "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><th colspan=\"3\">Warnings:</th></tr>";
$matchingErrors .= "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><th colspan=\"3\">Errors:</th></tr>";
# displayDaemons <-> views - - - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Display Daemons <-> Views</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Display Daemon</td><td>Message</td><td align=\"center\">Action</td><...
$sql = "SELECT $SERVERTABLDISPLAYDMNS.displayDaemon, count($SERVERTABLVIEWS.displayDaemon) FROM $SERVERTABLDISPLAYDMNS LEFT JOIN $SERVERTABLVIEWS ON $SERVERTABLDISPLAYDMNS.catalogID = $SERVERTABLVIEWS.catalogID and $SERVERTABLDISPLAYDMNS.displa...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLDISPLAYDMNS but is not used into $SERVERTABLVIEWS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Display Daemons <-> Views</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Display Daemon</td><td>Message</td><td align=\"center\">Action</td></t...
$sql = "SELECT $SERVERTABLVIEWS.displayDaemon, count($SERVERTABLDISPLAYDMNS.displayDaemon) FROM $SERVERTABLVIEWS LEFT JOIN $SERVERTABLDISPLAYDMNS ON $SERVERTABLVIEWS.catalogID = $SERVERTABLDISPLAYDMNS.catalogID and $SERVERTABLVIEWS.displayDaemo...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLVIEWS but don't exist anymore into $SERVERTABLDISPLAYDMNS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# displayGroups <-> views - - - - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Display Daemons <-> Views</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Display Group</td><td>Message</td><td align=\"center\">Action</td></...
$sql = "SELECT $SERVERTABLDISPLAYGRPS.groupTitle, count($SERVERTABLVIEWS.displayGroupID) FROM $SERVERTABLDISPLAYGRPS LEFT JOIN $SERVERTABLVIEWS ON $SERVERTABLDISPLAYGRPS.catalogID = $SERVERTABLVIEWS.catalogID and $SERVERTABLDISPLAYGRPS.displayG...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLDISPLAYGRPS but is not used into $SERVERTABLVIEWS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Display Daemons <-> Views</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Display Group</td><td>Message</td><td align=\"center\">Action</td></tr...
$sql = "SELECT $SERVERTABLVIEWS.displayGroupID, count($SERVERTABLDISPLAYGRPS.displayGroupID) FROM $SERVERTABLVIEWS LEFT JOIN $SERVERTABLDISPLAYGRPS ON $SERVERTABLVIEWS.catalogID = $SERVERTABLDISPLAYGRPS.catalogID and $SERVERTABLVIEWS.displayGro...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLVIEWS but don't exist anymore into $SERVERTABLDISPLAYGRPS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# collectorDaemons <-> crontabs - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Collector Daemons <-> Crontabs</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Collector Daemon</td><td>Message</td><td align=\"center\">Actio...
$sql = "SELECT $SERVERTABLCLLCTRDMNS.collectorDaemon, count($SERVERTABLCRONTABS.collectorDaemon) FROM $SERVERTABLCLLCTRDMNS LEFT JOIN $SERVERTABLCRONTABS ON $SERVERTABLCLLCTRDMNS.catalogID = $SERVERTABLCRONTABS.catalogID and $SERVERTABLCLLCTRDM...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLCLLCTRDMNS but is not used into $SERVERTABLCRONTABS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Collector Daemons <-> Crontabs</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Collector Daemon</td><td>Message</td><td align=\"center\">Action<...
$sql = "SELECT $SERVERTABLCRONTABS.collectorDaemon, count($SERVERTABLCLLCTRDMNS.collectorDaemon) FROM $SERVERTABLCRONTABS LEFT JOIN $SERVERTABLCLLCTRDMNS ON $SERVERTABLCRONTABS.catalogID = $SERVERTABLCLLCTRDMNS.catalogID and $SERVERTABLCRONTABS...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLCRONTABS but don't exist anymore into $SERVERTABLCLLCTRDMNS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# pagedirs <-> displayDaemons - - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Pagedirs <-> Display Daemons</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Pagedir</td><td>Message</td><td align=\"center\">Action</td></tr>...
$sql = "SELECT $SERVERTABLPAGEDIRS.pagedir, count($SERVERTABLDISPLAYDMNS.pagedir) FROM $SERVERTABLPAGEDIRS LEFT JOIN $SERVERTABLDISPLAYDMNS ON $SERVERTABLPAGEDIRS.catalogID = $SERVERTABLDISPLAYDMNS.catalogID and $SERVERTABLPAGEDIRS.pagedir = $S...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLPAGEDIRS but is not used into $SERVERTABLDISPLAYDMNS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Pagedirs <-> Display Daemons</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Pagedir</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT $SERVERTABLDISPLAYDMNS.pagedir, count($SERVERTABLPAGEDIRS.pagedir) FROM $SERVERTABLDISPLAYDMNS LEFT JOIN $SERVERTABLPAGEDIRS ON $SERVERTABLDISPLAYDMNS.catalogID = $SERVERTABLPAGEDIRS.catalogID and $SERVERTABLDISPLAYDMNS.pagedir =...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLDISPLAYDMNS but don't exist anymore into $SERVERTABLPAGEDIRS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# pagedirs <-> plugins - - - - - - - - - - - - - - - - - - - - - -
$sqlTmp = "drop temporary table if exists tmp$SERVERTABLPLUGINS";
$sthTmp = $dbh->prepare( $sqlTmp ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sthTmp->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
$sthTmp->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sqlTmp = "create temporary table `tmp$SERVERTABLPLUGINS`(`catalogID` varchar(5) NOT NULL default '$CATALOGID', `pagedir` varchar(11) default '') TYPE=InnoDB";
$sthTmp = $dbh->prepare( $sqlTmp ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sthTmp->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
if ( $rv ) {
$sthTmp->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sql = "SELECT $SERVERTABLPLUGINS.pagedir FROM $SERVERTABLPLUGINS where catalogID = '$CATALOGID'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$pagedirs ) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
chop ($pagedirs);
$pagedirs = substr($pagedirs, 1);
my @pagedirs = split (/\//, $pagedirs);
foreach my $pagedirTmp (@pagedirs) {
$sqlTmp = "insert into tmp$SERVERTABLPLUGINS set catalogID = '$CATALOGID', pagedir = '$pagedirTmp'";
$sthTmp = $dbh->prepare( $sqlTmp ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sthTmp->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sthTmp->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Pagedirs <-> Plugins</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Pagedir</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT $SERVERTABLPAGEDIRS.pagedir, count(tmp$SERVERTABLPLUGINS.pagedir) FROM $SERVERTABLPAGEDIRS LEFT JOIN tmp$SERVERTABLPLUGINS ON $SERVERTABLPAGEDIRS.catalogID = tmp$SERVERTABLPLUGINS.catalogID and $SERVERTABLPAGEDIRS.pagedir = t...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLPAGEDIRS but is not used into $SERVERTABLPLUGINS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Pagedirs <-> Plugins</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Pagedir</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT tmp$SERVERTABLPLUGINS.pagedir, count($SERVERTABLPAGEDIRS.pagedir) FROM tmp$SERVERTABLPLUGINS LEFT JOIN $SERVERTABLPAGEDIRS ON tmp$SERVERTABLPLUGINS.catalogID = $SERVERTABLPAGEDIRS.catalogID and tmp$SERVERTABLPLUGINS.pagedir =...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLPLUGINS but don't exist anymore into $SERVERTABLPAGEDIRS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$sqlTmp = "drop temporary table tmp$SERVERTABLPLUGINS";
$sthTmp = $dbh->prepare( $sqlTmp ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sthTmp->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sthTmp->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
}
}
# pagedirs <-> users - - - - - - - - - - - - - - - - - - - - - - -
$sqlTmp = "drop temporary table if exists tmp$SERVERTABLUSERS";
$sthTmp = $dbh->prepare( $sqlTmp ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sthTmp->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
$sthTmp->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sqlTmp = "create temporary table `tmp$SERVERTABLUSERS`(`catalogID` varchar(5) NOT NULL default '$CATALOGID', `pagedir` varchar(11) default '') TYPE=InnoDB";
$sthTmp = $dbh->prepare( $sqlTmp ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sthTmp->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
if ( $rv ) {
$sthTmp->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sql = "SELECT $SERVERTABLUSERS.pagedir FROM $SERVERTABLUSERS where catalogID = '$CATALOGID'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$pagedirs ) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
chop ($pagedirs);
$pagedirs = substr($pagedirs, 1);
my @pagedirs = split (/\//, $pagedirs);
foreach my $pagedirTmp (@pagedirs) {
$sqlTmp = "insert into tmp$SERVERTABLUSERS set catalogID = '$CATALOGID', pagedir = '$pagedirTmp'";
$sthTmp = $dbh->prepare( $sqlTmp ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sthTmp->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sthTmp->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Pagedirs <-> Users</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Pagedir</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT $SERVERTABLPAGEDIRS.pagedir, count(tmp$SERVERTABLUSERS.pagedir) FROM $SERVERTABLPAGEDIRS LEFT JOIN tmp$SERVERTABLUSERS ON $SERVERTABLPAGEDIRS.catalogID = tmp$SERVERTABLUSERS.catalogID and $SERVERTABLPAGEDIRS.pagedir = tmp$SER...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLPAGEDIRS but is not used into $SERVERTABLUSERS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Pagedirs <-> Users</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Pagedir</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT tmp$SERVERTABLUSERS.pagedir, count($SERVERTABLPAGEDIRS.pagedir) FROM tmp$SERVERTABLUSERS LEFT JOIN $SERVERTABLPAGEDIRS ON tmp$SERVERTABLUSERS.catalogID = $SERVERTABLPAGEDIRS.catalogID and tmp$SERVERTABLUSERS.pagedir = $SERVER...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLUSERS but don't exist anymore into $SERVERTABLPAGEDIRS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$sqlTmp = "drop temporary table tmp$SERVERTABLUSERS";
$sthTmp = $dbh->prepare( $sqlTmp ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sthTmp->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sthTmp->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sqlTmp", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
}
}
# plugins <-> comments - - - - - - - - - - - - - - - - - - - - - -
# $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins <-> Comments</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Unique Key</td><td>Message</td><td align=\"center\">Action</td></tr>";
# $sql = "SELECT $SERVERTABLPLUGINS.uKey, count($SERVERTABLCOMMENTS.uKey) FROM $SERVERTABLPLUGINS LEFT JOIN $SERVERTABLCOMMENTS ON $SERVERTABLPLUGINS.catalogID = $SERVERTABLCOMMENTS.catalogID and $SERVERTABLPLUGINS.uKey = $SERVERTABLCOMMENTS.uK...
# $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
# $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
# $sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
# if ($rv) {
# if ( $sth->rows ) {
# while( $sth->fetch() ) {
# if ($count == 0) {
# $countWarnings++;
# $matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLPLUGINS but is not used into $SERVERTABLCOMMENTS</td><td> </td></tr>";
# }
# }
# }
#
# $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
# }
# $matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins <-> Comments</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Unique Key</td><td>Message</td><td align=\"center\">Action</td></tr>";
# $sql = "SELECT $SERVERTABLCOMMENTS.uKey, count($SERVERTABLPLUGINS.uKey) FROM $SERVERTABLCOMMENTS LEFT JOIN $SERVERTABLPLUGINS ON $SERVERTABLCOMMENTS.catalogID = $SERVERTABLPLUGINS.catalogID and $SERVERTABLCOMMENTS.uKey = $SERVERTABLPLUGINS.uK...
# $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
# $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
# $sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
# if ($rv) {
# if ( $sth->rows ) {
# while( $sth->fetch() ) {
# if ($count == 0) {
# $countErrors++;
# $matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLCOMMENTS but don't exist anymore into $SERVERTABLPLUGINS</td><td> </td></tr>";
# }
# }
# }
#
# $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
# }
# plugins <-> crontabs - - - - - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins <-> Crontabs</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Unique Key</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT $SERVERTABLPLUGINS.uKey, count($SERVERTABLCRONTABS.uKey) FROM $SERVERTABLPLUGINS LEFT JOIN $SERVERTABLCRONTABS ON $SERVERTABLPLUGINS.uKey = $SERVERTABLCRONTABS.uKey where $SERVERTABLPLUGINS.activated = 1 and $SERVERTABLPLUGINS.pr...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLPLUGINS but is not used into $SERVERTABLCRONTABS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins <-> Crontabs</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Unique Key</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT $SERVERTABLCRONTABS.uKey, count($SERVERTABLPLUGINS.uKey) FROM $SERVERTABLCRONTABS LEFT JOIN $SERVERTABLPLUGINS ON $SERVERTABLCRONTABS.catalogID = $SERVERTABLPLUGINS.catalogID and $SERVERTABLCRONTABS.uKey = $SERVERTABLPLUGINS.uKe...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLCRONTABS but don't exist anymore into $SERVERTABLPLUGINS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# plugins <-> views - - - - - - - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins <-> Views</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Unique Key</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT $SERVERTABLPLUGINS.uKey, count($SERVERTABLVIEWS.uKey) FROM $SERVERTABLPLUGINS LEFT JOIN $SERVERTABLVIEWS ON $SERVERTABLPLUGINS.catalogID = $SERVERTABLVIEWS.catalogID and $SERVERTABLPLUGINS.uKey = $SERVERTABLVIEWS.uKey where $SERV...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLPLUGINS but is not used into $SERVERTABLVIEWS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins <-> Views</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Unique Key</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT $SERVERTABLVIEWS.uKey, count($SERVERTABLPLUGINS.uKey) FROM $SERVERTABLVIEWS LEFT JOIN $SERVERTABLPLUGINS ON $SERVERTABLVIEWS.catalogID = $SERVERTABLPLUGINS.catalogID and $SERVERTABLVIEWS.uKey = $SERVERTABLPLUGINS.uKey where $SER...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLVIEWS but don't exist anymore into $SERVERTABLPLUGINS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# resultsdir <-> plugins - - - - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Resultsdir <-> Plugins</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Resultsdir</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT $SERVERTABLRESULTSDIR.resultsdir, count($SERVERTABLPLUGINS.resultsdir) FROM $SERVERTABLRESULTSDIR LEFT JOIN $SERVERTABLPLUGINS ON $SERVERTABLRESULTSDIR.catalogID = $SERVERTABLPLUGINS.catalogID and $SERVERTABLRESULTSDIR.resultsdi...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLRESULTSDIR but is not used into $SERVERTABLPLUGINS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Resultsdir <-> Plugins</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Resultsdir</td><td>Message</td><td align=\"center\">Action</td></tr>";
$sql = "SELECT $SERVERTABLPLUGINS.resultsdir, count($SERVERTABLRESULTSDIR.resultsdir) FROM $SERVERTABLPLUGINS LEFT JOIN $SERVERTABLRESULTSDIR ON $SERVERTABLPLUGINS.catalogID = $SERVERTABLRESULTSDIR.catalogID and $SERVERTABLPLUGINS.resultsdir = ...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLPLUGINS but don't exist anymore into $SERVERTABLRESULTSDIR</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# servers <-> collectorDaemons - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Servers <-> Collector Daemons</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Server ID</td><td>Message</td><td align=\"center\">Action</td></...
$sql = "SELECT $SERVERTABLSERVERS.serverID, count($SERVERTABLCLLCTRDMNS.serverID) FROM $SERVERTABLSERVERS LEFT JOIN $SERVERTABLCLLCTRDMNS ON $SERVERTABLSERVERS.catalogID = $SERVERTABLCLLCTRDMNS.catalogID and $SERVERTABLSERVERS.serverID = $SERVE...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLSERVERS but is not used into $SERVERTABLCLLCTRDMNS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Servers <-> Collector Daemons</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Server ID</td><td>Message</td><td align=\"center\">Action</td></tr...
$sql = "SELECT $SERVERTABLCLLCTRDMNS.serverID, count($SERVERTABLSERVERS.serverID) FROM $SERVERTABLCLLCTRDMNS LEFT JOIN $SERVERTABLSERVERS ON $SERVERTABLCLLCTRDMNS.catalogID = $SERVERTABLSERVERS.catalogID and $SERVERTABLCLLCTRDMNS.serverID = $SE...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLCLLCTRDMNS but don't exist anymore into $SERVERTABLSERVERS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# servers <-> displayDaemons - - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Servers <-> Display Daemons</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Server ID</td><td>Message</td><td align=\"center\">Action</td></tr...
$sql = "SELECT $SERVERTABLSERVERS.serverID, count($SERVERTABLDISPLAYDMNS.serverID) FROM $SERVERTABLSERVERS LEFT JOIN $SERVERTABLDISPLAYDMNS ON $SERVERTABLSERVERS.catalogID = $SERVERTABLDISPLAYDMNS.catalogID and $SERVERTABLSERVERS.serverID = $SE...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countWarnings++;
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>exists into $SERVERTABLSERVERS but is not used into $SERVERTABLDISPLAYDMNS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Servers <-> Display Daemons</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Server ID</td><td>Message</td><td align=\"center\">Action</td></tr>"...
$sql = "SELECT $SERVERTABLDISPLAYDMNS.serverID, count($SERVERTABLSERVERS.serverID) FROM $SERVERTABLDISPLAYDMNS LEFT JOIN $SERVERTABLSERVERS ON $SERVERTABLDISPLAYDMNS.catalogID = $SERVERTABLSERVERS.catalogID and $SERVERTABLDISPLAYDMNS.serverID =...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$error, \$count) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if ($count == 0) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$error</td><td>still used into $SERVERTABLDISPLAYDMNS but don't exist anymore into $SERVERTABLSERVERS</td><td> </td></tr>";
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# servers <-> servers - - - - - - - - - - - - - - - - - - - - - - -
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Servers <-> Servers</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Central Monitoring Servers</td><td>Message</td><td align=\"center\">Action</...
$sql = "SELECT count(typeMonitoring) FROM $SERVERTABLSERVERS where catalogID = '$CATALOGID' and typeMonitoring = 0 and activated = 1 group by typeMonitoring";
($rv, $numberCentralServers) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
unless ( defined $numberCentralServers ) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>0</td><td>there is no activated central monitoring server</td><td> </td></tr>";
} elsif ( $numberCentralServers != 1 ) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$numberCentralServers</td><td>there can be only one activated central monitoring server</td><td> </td></tr>";
} else {
$sql = "SELECT serverID, typeMonitoring, typeServers, typeActiveServer, masterFQDN, masterASNMTAP_PATH, masterRSYNC_PATH, masterSSH_PATH, masterDatabaseFQDN, slaveFQDN, slaveASNMTAP_PATH, slaveRSYNC_PATH, slaveSSH_PATH, slaveDatabaseFQDN FROM...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ($rv) {
if ( $sth->rows ) { ($centralServerID, $centralTypeMonitoring, $centralTypeServers, $centralTypeActiveServer, $centralMasterFQDN, $centralMasterASNMTAP_PATH, $centralMasterRSYNC_PATH, $centralMasterSSH_PATH, $centralMasterDatabaseFQDN, $cen...
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
}
$centralSlaveDatabaseFQDN = $centralMasterDatabaseFQDN unless ( $centralTypeServers );
}
# catalog <-> catalog - - - - - - - - - - - - - - - - - - - - - - -
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Catalog <-> Catalog</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Central Monitoring Servers into the Catalog</td><td>Message</td><td align=\"...
my ($numberCatalogCentralServers);
$sql = "SELECT count(catalogType) FROM $SERVERTABLCATALOG where catalogID = '$CATALOGID' and catalogType = 'Central' and activated = 1 group by catalogType";
($rv, $numberCatalogCentralServers) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
unless ( defined $numberCatalogCentralServers ) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>0</td><td>there is no activated central monitoring server into the catalog with catalogID '$CATALOGID'</td><td> </td></tr>";
} else {
$sql = "SELECT count(catalogType) FROM $SERVERTABLCATALOG where catalogType = 'Central' and activated = 1 group by catalogType";
($rv, $numberCatalogCentralServers) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( defined $numberCatalogCentralServers and $numberCatalogCentralServers != 1 ) {
$countErrors++;
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$numberCatalogCentralServers</td><td>there can be only one activated central monitoring server into the catalog</td><td> </td></tr>";
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{TABLE}\"><td align=\"center\" colspan=\"3\"> </td></tr>";
# plugins uploaded <-> plugins configurated - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins Uploaded <-> Plugins Configurated</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Plugin</td><td>Message</td><td align=\"center\">Acti...
$sql = "SELECT DISTINCT test FROM $SERVERTABLPLUGINS where catalogID = '$CATALOGID' and activated = 1";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$test) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
my @plugins = glob("$PLUGINPATH/*.pl");
while( $sth->fetch() ) {
my $teller = 0;
foreach my $plugin (@plugins) {
if ( defined $plugin and defined $test and $plugin eq "$PLUGINPATH/$test" ) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
foreach my $pluginPath (@plugins) {
if (defined $pluginPath) {
(undef, my $plugin) = split (/^$PLUGINPATH\//, $pluginPath);
$actionItem = "<a href=\"$urlWithAccessParameters&action=updateView&plugin=$plugin&todo=delete\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{delete}\" title=\"Delete Plugin\" alt=\"Delete Plugin\" border=\"0\"></a>"...
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$plugin</td><td>plugin uploaded without plugin configuration</td><td align=\"center\">$actionItem</td></tr>";
$countWarnings++;
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# plugins configurated <-> plugins uploaded - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins Configurated <-> Plugins Uploaded</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Plugin</td><td>Message</td><td align=\"center\">Acti...
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins Configurated <-> Plugins Uploaded</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Plugin</td><td>Message</td><td align=\"center\">Action...
$sql = "SELECT DISTINCT test FROM $SERVERTABLPLUGINS where catalogID = '$CATALOGID' and activated = 1";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$test) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if (! -e "$PLUGINPATH/$test") {
$actionItem = "<a href=\"$urlWithAccessParameters&action=updateView&plugin=$test&todo=edit\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{edit}\" title=\"Edit Plugin\" alt=\"Edit Plugin\" border=\"0\"></a>";
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$test</td><td>plugin configuration without plugin uploaded</td><td align=\"center\">$actionItem</td></tr>";
$countWarnings++;
} else {
my $sb = stat("$PLUGINPATH/$test");
unless ( $sb->mode == 33261 or $sb->mode == 33256 ) { # 0755 = 33261 & 0750 = 33256
$actionItem = "<a href=\"$urlWithAccessParameters&action=updateView&plugin=$test&todo=maintenance\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{maintenance}\" title=\"Rights Plugin\" alt=\"Rights Plugin\" border=\...
$matchingErrors .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$test</td><td>plugin configuration with plugin uploaded but without wanted excecution rights</td><td align=\"center\">$actionItem</td></tr>";
$countErrors++;
}
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{TABLE}\"><td align=\"center\" colspan=\"3\"> </td></tr>";
# help plugin filenames <-> plugin - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Help Plugin Filenames <-> Plugin</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Help Plugin Filename</td><td>Message</td><td align=\"center\"...
$sql = "SELECT DISTINCT helpPluginFilename FROM $SERVERTABLPLUGINS WHERE catalogID = '$CATALOGID' and helpPluginFilename != '<NIHIL>'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$helpPluginFilename) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
my @helpPluginFilenames = glob("$PDPHELPPATH/*");
while( $sth->fetch() ) {
my $teller = 0;
foreach my $helpPluginPathFilename (@helpPluginFilenames) {
if ( $helpPluginPathFilename eq "$PDPHELPPATH/$helpPluginFilename" ) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
foreach my $helpPluginPathFilename (@helpPluginFilenames) {
if (defined $helpPluginPathFilename) {
(undef, $helpPluginFilename) = split (/^$PDPHELPPATH\//, $helpPluginPathFilename);
$actionItem = "<a href=\"$urlWithAccessParameters&action=updateView&helpPluginFilename=$helpPluginFilename&todo=delete\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{delete}\" title=\"Delete Help Plugin Filename\" al...
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$helpPluginFilename</td><td>help plugin filename without plugin reference</td><td align=\"center\">$actionItem</td></tr>";
$countWarnings++;
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# plugins <-> help plugin filename - - - - - - - - - - - - - - - -
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td align=\"center\" colspan=\"3\">Plugins <-> Help Plugin Filename</td></tr><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>Unique Key</td><td>Message</td><td align=\"center\">Action</t...
$sql = "SELECT uKey, LTRIM(SUBSTRING_INDEX(title, ']', -1)) as shortTitle, helpPluginFilename FROM $SERVERTABLPLUGINS WHERE catalogID = '$CATALOGID' and activated = 1 order by shortTitle";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$warning, \$title, \$helpPluginFilename) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
if (! defined $helpPluginFilename or $helpPluginFilename eq '<NIHIL>') {
$actionItem = "<a href=\"$urlWithAccessParameters&action=updateView&helpPluginFilename=<NIHIL>&todo=duplicate\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{duplicate}\" title=\"Add Help Plugin Filename\" alt=\"Add H...
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>'$title' plugin without help plugin filename defined</td><td align=\"center\">$actionItem</td></tr>";
$countWarnings++;
} elsif ($helpPluginFilename !~ /^http(s)?\:\/\// and ! -e "$PDPHELPPATH/$helpPluginFilename") {
$actionItem = "<a href=\"$urlWithAccessParameters&action=updateView&helpPluginFilename=$helpPluginFilename&todo=edit\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{edit}\" title=\"Edit Help Plugin Filename\" alt=\"Ed...
$matchingWarnings .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$warning</td><td>'$title' plugin with missing help plugin filename '<b>$helpPluginFilename</b>'</td><td align=\"center\">$actionItem</td></tr>";
$countWarnings++;
}
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$matchingErrors .= "</table>\n";
$matchingWarnings .= "</table>\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'generateView') {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
}
}
$initializeGenerateView .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/\" target=\"_blank\">Browse directory list with all config files</a></td></tr>\n </table>";
my $configDateTime = get_csvfiledate .' '. get_csvfiletime;
$rvOpen = 0;
# ArchiveCT - - - - - - - - - - - - - - - - - - - - - - - - - - -
$sql = "select distinct $SERVERTABLSERVERS.serverID, $SERVERTABLSERVERS.typeMonitoring, $SERVERTABLSERVERS.typeServers, $SERVERTABLSERVERS.typeActiveServer, $SERVERTABLSERVERS.masterFQDN, $SERVERTABLSERVERS.masterASNMTAP_PATH, $SERVERTABLSERV...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$serverID, \$typeMonitoring, \$typeServers, \$typeActiveServer, \$masterFQDN, \$masterASNMTAP_PATH, \$masterRSYNC_PATH, \$masterSSH_PATH, \$slaveFQDN, \$slaveASNMTAP_PATH, \$slaveRSYNC_PATH, \$slaveSSH_PATH, \$collectorDa...
if ( $rv ) {
$matchingArchiveCT .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
if ( $sth->rows ) {
$prevTypeServers = $prevTypeActiveServer = 0;
$prevServerID = $prevMasterFQDN = $prevMasterASNMTAP_PATH = $prevMasterRSYNC_PATH = $prevMasterSSH_PATH = $prevSlaveFQDN = $prevSlaveASNMTAP_PATH = $prevSlaveRSYNC_PATH = $prevSlaveSSH_PATH = $prevResultsdir = '';
while( $sth->fetch() ) {
if ($prevServerID ne $serverID) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$matchingArchiveCT .= system_call ("cp", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/ArchiveCT $APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$t...
}
$matchingArchiveCT .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>ArchiveCT - $serverID, generated on $configDateTime, ASNMTAP v$version or higher</td></tr>";
}
} else {
$matchingArchiveCT .= "\n <tr><td>No records found for any ArchiveCT</td></tr>";
}
$matchingArchiveCT .= "\n </table>";
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# DisplayCT - - - - - - - - - - - - - - - - - - - - - - - - - - -
$sql = "select distinct $SERVERTABLSERVERS.serverID, $SERVERTABLSERVERS.typeMonitoring, $SERVERTABLSERVERS.typeServers, $SERVERTABLSERVERS.typeActiveServer, $SERVERTABLSERVERS.masterFQDN, $SERVERTABLSERVERS.masterASNMTAP_PATH, $SERVERTABLSERV...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$serverID, \$typeMonitoring, \$typeServers, \$typeActiveServer, \$masterFQDN, \$masterASNMTAP_PATH, \$masterRSYNC_PATH, \$masterSSH_PATH, \$slaveFQDN, \$slaveASNMTAP_PATH, \$slaveRSYNC_PATH, \$slaveSSH_PATH ) or $rv = err...
if ( $rv ) {
$sth->fetch();
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sql = "select distinct $SERVERTABLDISPLAYDMNS.displayDaemon, $SERVERTABLDISPLAYDMNS.pagedir, $SERVERTABLDISPLAYDMNS.loop, $SERVERTABLDISPLAYDMNS.trigger, $SERVERTABLDISPLAYDMNS.displayTime, $SERVERTABLDISPLAYDMNS.lockMySQL, $SERVERTABLDISP...
$sql .= "where $SERVERTABLSERVERS.catalogID = $SERVERTABLCATALOG.catalogID and $SERVERTABLCATALOG.activated = 1 and $SERVERTABLSERVERS.catalogID = $SERVERTABLDISPLAYDMNS.catalogID and $SERVERTABLSERVERS.serverID = $SERVERTABLDISPLAYDMNS.ser...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$displayDaemon, \$pagedirs, \$loop, \$trigger, \$displayTime, \$lockMySQL, \$debugDaemon, \$interval, \$groupTitle, \$resultsdir, \$catalogID, \$uKey, \$title, \$test, \$environment, \$trendline, \$helpPluginFilename ) ...
if ( $rv ) {
$matchingDisplayCT .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
if ( $sth->rows ) {
$prevDisplayDaemon = $prevGroupTitle = '';
while( $sth->fetch() ) {
if ( $prevDisplayDaemon ne $displayDaemon ) {
if ( $prevDisplayDaemon ne '' ) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$rvOpen = 0;
$typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
$matchingDisplayCT .= system_call ("cp", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/DisplayCT-$displayDaemon $APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoring...
$matchingDisplayCT .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>DisplayCT-$displayDaemon, generated on $configDateTime, ASNMTAP v$version or higher</td></tr>";
}
} else {
$matchingDisplayCT .= " <tr><td>No records found for any DisplayCT</td></tr>\n";
}
$matchingDisplayCT .= " </table>\n";
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Display Start/Stop scripts
$sql = "select $SERVERTABLSERVERS.serverID, $SERVERTABLSERVERS.typeMonitoring, $SERVERTABLSERVERS.typeServers, $SERVERTABLSERVERS.typeActiveServer, $SERVERTABLSERVERS.masterFQDN, $SERVERTABLSERVERS.masterASNMTAP_PATH, $SERVERTABLSERVERS.maste...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$serverID, \$typeMonitoring, \$typeServers, \$typeActiveServer, \$masterFQDN, \$masterASNMTAP_PATH, \$masterRSYNC_PATH, \$masterSSH_PATH, \$slaveFQDN, \$slaveASNMTAP_PATH, \$slaveRSYNC_PATH, \$slaveSSH_PATH, \$displayDaem...
if ( $rv ) {
$matchingAsnmtapDisplayCTscript .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
if ( $sth->rows ) {
$prevTypeServers = $prevTypeActiveServer = 0;
$prevServerID = $prevMasterFQDN = $prevMasterASNMTAP_PATH = $prevMasterRSYNC_PATH = $prevMasterSSH_PATH = $prevSlaveFQDN = $prevSlaveASNMTAP_PATH = $prevSlaveRSYNC_PATH = $prevSlaveSSH_PATH = '';
while( $sth->fetch() ) {
if ( $prevServerID ne $serverID ) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
}
$matchingAsnmtapDisplayCTscript .= createAsnmtapDisplayCTscript ($typeMonitoring, 'M', $typeActiveServer, $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, "master", $debug);
$matchingAsnmtapDisplayCTscript .= createAsnmtapDisplayCTscript ($typeMonitoring, 'S', $typeActiveServer, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH, "slave", $debug) if ( $typeServers );
$matchingAsnmtapDisplayCTscript .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>Display Start/Stop scripts - $serverID, generated on $configDateTime, ASNMTAP v$version or higher</td></tr>";
} else {
$matchingAsnmtapDisplayCTscript .= " <tr><td>No records found for any DisplayCT</td></tr>\n";
}
$matchingAsnmtapDisplayCTscript .= " </table>\n";
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# CollectorCT - - - - - - - - - - - - - - - - - - - - - - - - - -
$sql = "select $SERVERTABLSERVERS.serverID, $SERVERTABLSERVERS.typeMonitoring, $SERVERTABLSERVERS.typeServers, $SERVERTABLSERVERS.typeActiveServer, $SERVERTABLSERVERS.masterFQDN, $SERVERTABLSERVERS.masterASNMTAP_PATH, $SERVERTABLSERVERS.maste...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$serverID, \$typeMonitoring, \$typeServers, \$typeActiveServer, \$masterFQDN, \$masterASNMTAP_PATH, \$masterRSYNC_PATH, \$masterSSH_PATH, \$slaveFQDN, \$slaveASNMTAP_PATH, \$slaveRSYNC_PATH, \$slaveSSH_PATH, \$collectorDa...
if ( $rv ) {
$matchingCollectorCT .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
if ( $sth->rows ) {
$prevTypeServers = $prevTypeActiveServer = 0;
$prevServerID = $prevMasterFQDN = $prevMasterASNMTAP_PATH = $prevMasterRSYNC_PATH = $prevMasterSSH_PATH = $prevSlaveFQDN = $prevSlaveASNMTAP_PATH = $prevSlaveRSYNC_PATH = $prevSlaveSSH_PATH = $prevCollectorDaemon = $prevUniqueKey = '';
while( $sth->fetch() ) {
if ( $prevServerID ne $serverID or $prevCollectorDaemon ne $collectorDaemon ) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
}
}
$matchingCollectorCT .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>CollectorCT-$collectorDaemon - $serverID, generated on $configDateTime, ASNMTAP v$version or higher</td></tr>";
}
} else {
$matchingCollectorCT .= " <tr><td>No records found for any CollectorCT</td></tr>\n";
}
$matchingCollectorCT .= " </table>\n";
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Collector Start/Stop scripts
$sql = "select DISTINCT $SERVERTABLSERVERS.serverID, $SERVERTABLSERVERS.typeMonitoring, $SERVERTABLSERVERS.typeServers, $SERVERTABLSERVERS.typeActiveServer, $SERVERTABLSERVERS.masterFQDN, $SERVERTABLSERVERS.masterASNMTAP_PATH, $SERVERTABLSERV...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$serverID, \$typeMonitoring, \$typeServers, \$typeActiveServer, \$masterFQDN, \$masterASNMTAP_PATH, \$masterRSYNC_PATH, \$masterSSH_PATH, \$slaveFQDN, \$slaveASNMTAP_PATH, \$slaveRSYNC_PATH, \$slaveSSH_PATH, \$collectorDa...
if ( $rv ) {
$matchingAsnmtapCollectorCTscript .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
if ( $sth->rows ) {
$prevTypeServers = $prevTypeActiveServer = 0;
$prevServerID = $prevMasterFQDN = $prevMasterASNMTAP_PATH = $prevMasterRSYNC_PATH = $prevMasterSSH_PATH = $prevSlaveFQDN = $prevSlaveASNMTAP_PATH = $prevSlaveRSYNC_PATH = $prevSlaveSSH_PATH = '';
while( $sth->fetch() ) {
if ( $prevServerID ne $serverID ) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
}
$matchingAsnmtapCollectorCTscript .= createAsnmtapCollectorCTscript ($typeMonitoring, 'M', $typeActiveServer, $masterFQDN, $slaveFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, "master", $debug);
$matchingAsnmtapCollectorCTscript .= createAsnmtapCollectorCTscript ($typeMonitoring, 'S', $typeActiveServer, $slaveFQDN, $masterFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH, "slave", $debug) if ( $typeServers );
$matchingAsnmtapCollectorCTscript .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>Collector Start/Stop scripts - $serverID, generated on $configDateTime, ASNMTAP v$version or higher</td></tr>";
} else {
$matchingAsnmtapCollectorCTscript .= " <tr><td>No records found for any CollectorCT</td></tr>\n";
}
$matchingAsnmtapCollectorCTscript .= " </table>\n";
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# rsync-mirror - - - - - - - - - - - - - - - - - - - - - - - - -
$sql = "select distinct $SERVERTABLSERVERS.serverID, $SERVERTABLSERVERS.typeMonitoring, $SERVERTABLSERVERS.typeServers, $SERVERTABLSERVERS.typeActiveServer, $SERVERTABLSERVERS.masterFQDN, $SERVERTABLSERVERS.masterASNMTAP_PATH, $SERVERTABLSERV...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$serverID, \$typeMonitoring, \$typeServers, \$typeActiveServer, \$masterFQDN, \$masterASNMTAP_PATH, \$masterRSYNC_PATH, \$masterSSH_PATH, \$slaveFQDN, \$slaveASNMTAP_PATH, \$slaveRSYNC_PATH, \$slaveSSH_PATH, \$collectorDa...
if ( $rv ) {
$matchingRsyncMirror .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
if ( $sth->rows ) {
my ($matchingRsyncMirrorConfigFailover, $matchingRsyncMirrorConfigDistributedMaster, $matchingRsyncMirrorConfigDistributedSlave);
$matchingRsyncMirrorConfigFailover = $matchingRsyncMirrorConfigDistributedMaster = $matchingRsyncMirrorConfigDistributedSlave = '';
my ($sameServerID, $firstCollectorDaemon) = (0, 0);
$prevTypeMonitoring = $prevTypeServers = $prevTypeActiveServer = 0;
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$matchingRsyncMirror .= createRsyncMirrorScriptsFailover ($serverID, $typeMonitoring, $typeServers, $typeActiveServer, $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH,...
$matchingRsyncMirror .= createRsyncMirrorScriptsDistributed ($serverID, $typeMonitoring, $typeServers, $typeActiveServer, $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PA...
$matchingRsyncMirror .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>Rsync Mirror Scripts - $serverID, generated on $configDateTime, ASNMTAP v$version or higher</td></tr>";
} else {
$matchingRsyncMirror .= "\n <tr><td>No records found for any RsyncMirror</td></tr>";
}
$matchingRsyncMirror .= "\n </table>";
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
} elsif ($action eq 'compareView') {
# open connection to database and query data
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subT...
if ($dbh and $rv) {
my ( $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH );
$sql = "SELECT masterFQDN, masterASNMTAP_PATH, masterRSYNC_PATH, masterSSH_PATH, slaveFQDN, slaveASNMTAP_PATH, slaveRSYNC_PATH, slaveSSH_PATH FROM $SERVERTABLSERVERS where catalogID = '$CATALOGID' and activated = 1";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$masterFQDN, \$masterASNMTAP_PATH, \$masterRSYNC_PATH, \$masterSSH_PATH, \$slaveFQDN, \$slaveASNMTAP_PATH, \$slaveRSYNC_PATH, \$slaveSSH_PATH ) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pag...
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
$ASNMTAP_PATH { 'M' } { $masterFQDN } = $masterASNMTAP_PATH if ( defined $masterFQDN and $masterFQDN and defined $masterASNMTAP_PATH and $masterASNMTAP_PATH );
$ASNMTAP_PATH { 'S'} { $slaveFQDN } = $slaveASNMTAP_PATH if ( defined $slaveFQDN and $slaveFQDN and defined $slaveASNMTAP_PATH and $slaveASNMTAP_PATH );
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$compareView .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
$compareView .= "\n <tr><th>Compare Configurations</th></tr>";
my $compareDiff = system_call ("$DIFFCOMMAND -braq -I 'generated on 20[0-9][0-9]/[0-9][0-9]/[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]'", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated $APPLICATIONPATH/tmp/$CONFIGDIR/installed", $debug);
if ($compareDiff eq '') {
$compareView .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>The generated and installed configurations are identical.</td></tr>";
} else {
$compareView .= "\n $compareDiff";
}
$compareView .= "\n </table>";
} elsif ($action eq 'installView') {
# open connection to database and query data
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subT...
if ($dbh and $rv) {
my ( $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH );
$sql = "SELECT masterFQDN, masterASNMTAP_PATH, masterRSYNC_PATH, masterSSH_PATH, slaveFQDN, slaveASNMTAP_PATH, slaveRSYNC_PATH, slaveSSH_PATH FROM $SERVERTABLSERVERS where catalogID = '$CATALOGID' and activated = 1";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
$sth->bind_columns( \$masterFQDN, \$masterASNMTAP_PATH, \$masterRSYNC_PATH, \$masterSSH_PATH, \$slaveFQDN, \$slaveASNMTAP_PATH, \$slaveRSYNC_PATH, \$slaveSSH_PATH ) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pag...
if ($rv) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
$ASNMTAP_PATH { 'M' } { $masterFQDN } = $masterASNMTAP_PATH if ( defined $masterFQDN and $masterFQDN and defined $masterASNMTAP_PATH and $masterASNMTAP_PATH );
$ASNMTAP_PATH { 'S'} { $slaveFQDN } = $slaveASNMTAP_PATH if ( defined $slaveFQDN and $slaveFQDN and defined $slaveASNMTAP_PATH and $slaveASNMTAP_PATH );
}
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID) if $rv;
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, -1, '', $sessionID);
}
$installView .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
$installView .= "\n <tr><th>Install Configuration</th></tr>";
if ( -e "$APPLICATIONPATH/tmp/$CONFIGDIR/generated" ) {
my $compareDiff = system_call ("$DIFFCOMMAND -braq -E 'generated on 20[0-9][0-9]/[0-9][0-9]/[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]'", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated $APPLICATIONPATH/tmp/$CONFIGDIR/installed", $debug);
if ($compareDiff eq '') {
$installView .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>The generated and installed configurations are identical.</td></tr>";
} else {
$installView .= "\n <tr><td align=\"center\"><b>Under construction:</b></td></tr>";
$installView .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{NOBLOCK}\">$compareDiff</table></td></tr>";
$installView .= "\n <tr><td align=\"center\"> </td></tr>";
$installView .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>We only are allowed to press the <b>MOVE</b> button when all commands are successfully executed!</td></tr>" if ( $Cauto == 1 );
$installView .= "\n <tr align=\"left\"><td align=\"right\"><input type=\"submit\" value=\"". ( ( $Cauto == 1 ) ? 'MOVE' : 'INSTALL' ) ."\"> <input type=\"reset\" value=\"Reset\"></td></tr>\n";
}
} else {
$installView .= "\n <tr><td>The generated configuration doesn't exist.</td></tr>";
}
$installView .= "\n </table>";
} elsif ($action eq 'install') {
$installView .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
$installView .= "\n <tr><th>Configuration Installed</th></tr>";
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createCollectorCTscript {
my ($typeMonitoringCharDorC, $typeServersCharMorS, $typeActiveServer, $serverFQDN, $serverAdminCollectorFQDN, $serverASNMTAP_PATH , $serverRSYNC_PATH , $serverSSH_PATH, $databaseFQDN, $subdir, $collectorDaemon, $mode, $dumphttp, $status, $debugDaem...
my ($hostnameAdminCollector, undef) = split (/\./, $serverAdminCollectorFQDN, 2);
return ('') if ( "CollectorCT-$collectorDaemon.sh" eq "CollectorCT-${hostnameAdminCollector}.sh" );
my $filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/CollectorCT-$collectorDaemon.sh";
my $command = "cat $APPLICATIONPATH/tools/templates/CollectorCT-template.sh >> $filename";
my $rvOpen = open(CollectorCT, ">$filename");
if ($rvOpen) {
print CollectorCT <<STARTUPFILE;
#!/bin/bash
# ---------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ---------------------------------------------------------------
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if [ -f "\$AMPATH/sbin/bash_stop_root.sh" ]; then
source "\$AMPATH/sbin/bash_stop_root.sh"
fi
STARTUPFILE
close (CollectorCT);
}
my $statusMessage = do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/CollectorCT-$collectorDaemon.sh\" target=\"_blank\">CollectorCT-$collect...
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createAsnmtapCollectorCTscript {
my ($typeMonitoring, $typeServersCharMorS, $typeActiveServer, $serverFQDN, $serverAdminCollectorFQDN, $serverASNMTAP_PATH , $serverRSYNC_PATH , $serverSSH_PATH, $subdir, $debug) = @_;
my $typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
my $filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/root-collector.sh";
my $rvOpen = open(AsnmtapCollectorCTscript, ">$filename");
if ($rvOpen) {
print AsnmtapCollectorCTscript <<STARTUPFILE;
#!/bin/sh
su - $SSHLOGONNAME -c "cd $serverASNMTAP_PATH/applications/$subdir; ./asnmtap-collector.sh \$1"
exit 0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE
close (AsnmtapCollectorCTscript);
}
my $statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/root-collector.sh\" target=\"_blank\">root-collector.sh ($subdir)</a>...
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/asnmtap-collector.sh";
$rvOpen = open(AsnmtapCollectorCTscript, ">$filename");
if ($rvOpen) {
print AsnmtapCollectorCTscript <<STARTUPFILE;
#!/bin/sh
# ---------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping
AMNAME=\"All ASNMTAP Collectors\"
AMPATH=$serverASNMTAP_PATH/applications/$subdir
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE
foreach my $choise ('start', 'stop', 'reload', 'restart', 'status') {
print AsnmtapCollectorCTscript <<STARTUPFILE;
$choise() {
# $choise daemons
echo "\u$choise: '\$AMNAME' ..."
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
esac
exit 0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE
close (AsnmtapCollectorCTscript);
}
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/asnmtap-collector.sh\" target=\"_blank\">asnmtap-collector.sh ($subdir)<...
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createDisplayCTscript {
my ($typeMonitoringCharDorC, $typeServersCharMorS, $typeActiveServer, $serverFQDN, $serverASNMTAP_PATH , $serverRSYNC_PATH , $serverSSH_PATH, $databaseFQDN, $subdir, $displayDaemon, $pagedirs, $loop, $trigger, $displayTime, $lockMySQL, $debugDaemon...
my $filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/DisplayCT-$displayDaemon.sh";
my $command = "cat $APPLICATIONPATH/tools/templates/DisplayCT-template.sh >> $filename";
my $rvOpen = open(DisplayCT, ">$filename");
if ($rvOpen) {
print DisplayCT <<STARTUPFILE;
#!/bin/bash
# ---------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ---------------------------------------------------------------
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if [ -f "\$AMPATH/sbin/bash_stop_root.sh" ]; then
source "\$AMPATH/sbin/bash_stop_root.sh"
fi
STARTUPFILE
close (DisplayCT);
}
my $statusMessage = do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/DisplayCT-$displayDaemon.sh\" target=\"_blank\">DisplayCT-$displayDaemon...
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createAsnmtapDisplayCTscript {
my ($typeMonitoring, $typeServersCharMorS, $typeActiveServer, $serverFQDN, $serverASNMTAP_PATH , $serverRSYNC_PATH , $serverSSH_PATH, $subdir, $debug) = @_;
my $typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
my $filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/root-display.sh";
my $rvOpen = open(AsnmtapDisplayCTscript, ">$filename");
if ($rvOpen) {
print AsnmtapDisplayCTscript <<STARTUPFILE;
#!/bin/sh
su - $SSHLOGONNAME -c "cd $serverASNMTAP_PATH/applications/$subdir; ./asnmtap-display.sh \$1"
exit 0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE
close (AsnmtapDisplayCTscript);
}
my $statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/root-display.sh\" target=\"_blank\">root-display.sh ($subdir)</a></td...
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/asnmtap-display.sh";
$rvOpen = open(AsnmtapDisplayCTscript, ">$filename");
if ($rvOpen) {
print AsnmtapDisplayCTscript <<STARTUPFILE;
#!/bin/sh
# ---------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping
AMNAME=\"All ASNMTAP Displays\"
AMPATH=$serverASNMTAP_PATH/applications/$subdir
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE
foreach my $choise ('start', 'stop', 'reload', 'restart', 'status') {
print AsnmtapDisplayCTscript <<STARTUPFILE;
$choise() {
# $choise daemons
echo "\u$choise: '\$AMNAME' ..."
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
esac
exit 0
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE
close (AsnmtapDisplayCTscript);
}
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/asnmtap-display.sh\" target=\"_blank\">asnmtap-display.sh ($subdir)</a><...
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createRsyncMirrorScriptsFailover {
my ($serverID, $typeMonitoring, $typeServers, $typeActiveServer, $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH, $collectorDaemon, $matchingRsyncMirrorConfigFai...
my $typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
my ($filename, $command, $rvOpen);
my $statusMessage = '';
if ( $typeServers ) { # Failover
# --------------------------------------------------------------------------
# Failover between $masterFQDN and $slaveFQDN
# --------------------------------------------------------------------------
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
}
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-mirror-failover-$slaveFQDN-$collectorDaemon.conf\" target=\"_blank\">rsync-mirro...
}
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createRsyncMirrorScriptsDistributed {
my ($serverID, $typeMonitoring, $typeServers, $typeActiveServer, $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH, $centralTypeMonitoring, $centralTypeServers, $c...
my $typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
my ($filename, $command, $rvOpen);
my $statusMessage = '';
if ( $typeMonitoring ) { # Distributed
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CM-$centralTypeActiveServer-$centralMasterFQDN/master/rsync-wrapper-distributed-$centralMasterFQDN.sh";
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-mirror-distributed-$slaveFQDN-$collectorDaemon.conf\" target=\"_blank\">rsync-...
}
}
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub read_directory {
my ($directory, $subDirectory, $htmlBefore, $htmlAfter, $debug) = @_;
my $directoryAndFileList = ( $debug eq 'T' ) ? "$htmlBefore$directory$subDirectory$htmlAfter" : '';
my $rvOpendir = opendir (DIR, "$directory$subDirectory");
if ($rvOpendir) {
while ($_ = readdir (DIR)) {
next if ($_ eq "." or $_ eq ".." or $_ eq "HEADER.html" or $_ eq "FOOTER.html");
if (-d "$directory$subDirectory/$_") {
$directoryAndFileList .= read_directory("$directory", "$subDirectory/$_", $htmlBefore, $htmlAfter, $debug);
} else {
$directoryAndFileList .= "$htmlBefore$subDirectory/$_$htmlAfter";
}
}
closedir DIR;
}
return ($directoryAndFileList);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub do_compare_view {
my ($command, $details, $debug) = @_;
sub do_compare_diff {
my ($compareView, $type, $details, $debug) = @_;
my ($path, $generated, $installed, $compareDiff);
$path = $generated = $installed = '';
if ($type == 1) {
my (undef, $dummy) = split (/Only in generated\//, $compareView);
($path, $generated) = split (/: /, $dummy);
$compareDiff = "$path/$generated added" if ( $debug eq 'T' );
} elsif ($type == 2) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
my %commands;
my $_id = 0;
my $connectArguments = "-o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=$WWWKEYPATH/.ssh/known_hosts' -i '$WWWKEYPATH/.ssh/$SSHIDENTITY'";
foreach my $compareView (@compareView) {
chomp ($compareView);
$compareView =~ s/^\s+//g;
$compareView =~ s/$APPLICATIONPATH\/tmp\/$CONFIGDIR\///g;
if ($compareView ne '') {
my ($type, $activeServer, $server, $path, $subpath, $generated, $installed, $compareDiff, $compareText);
my $todo = $type = 0;
if ( $compareView =~ /^Only in generated\// ) {
($path, $generated, $installed, $compareDiff) = do_compare_diff ($compareView, 1, $details, $debug);
if ($details) {
$compareText = "File '$path/$generated' added to the generated configuration.";
} else {
($type, $activeServer, $server) = split (/-/, $path, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
($server, $subpath) = split (/\//, $server, 2);
$subpath .= ($subpath eq '') ? '' : '/';
# Copy '/opt/asnmtap/applications/tmp/$CONFIGDIR/generated/DM-[MS]-distributed.citap.com/etc/DisplayCT-distributed' to 'distributed.citap.com:/opt/asnmtap/applications/etc/DisplayCT-distributed'
# $APPLICATIONPATH/tmp/ /generated/<------- $path -------->/<--- $generated ----> <----- $server ----->:$APPLICATIONPATH/<---- $generated --->
# or
# Copy '/opt/asnmtap/applications/tmp/$CONFIGDIR/generated/CM-[MS]-asnmtap.citap.be/master/CollectorCT-index.sh' to 'asnmtap.citap.be:/opt/asnmtap/applications/master/CollectorCT-index.sh'
# $APPLICATIONPATH/tmp/ /generated/<------- $path -------->/<----------------- $generated ----------------> <------ $server ----->:$APPLICATIONPATH/$subpath/<------------ $generated ----------->
$commands {$server} {SCP} {++$_id} {auto} = 1;
$commands {$server} {SCP} {$_id} {label} = '+a';
$commands {$server} {SCP} {$_id} {active} = $active;
$commands {$server} {SCP} {$_id} {command} = "$SCPCOMMAND $connectArguments $APPLICATIONPATH/tmp/$CONFIGDIR/generated/$path/$generated $SSHLOGONNAME\@$server:". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$subpath$ge...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {SCP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
if (($generated =~ /^DisplayCT-[\w-]+.sh$/) or ($generated =~ /^CollectorCT-[\w-]+.sh$/)) {
$commands {$server} {CHMOD} {++$_id} {auto} = 1;
$commands {$server} {CHMOD} {$_id} {label} = '+b';
$commands {$server} {CHMOD} {$_id} {active} = $active;
$commands {$server} {CHMOD} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server chmod 755 ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$subpath$generated";
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {CHMOD} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {START} {++$_id} {auto} = 1;
$commands {$server} {START} {$_id} {label} = '+c';
$commands {$server} {START} {$_id} {active} = $active;
$commands {$server} {START} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$subpath$generated start";
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {START} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
} elsif (($generated =~ /rsync-wrapper-distributed-[\w\-.]+.sh$/) or ($generated =~ /rsync-wrapper-failover-[\w\-.]+.sh$/)) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '+d';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "'$generated' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$todo = 1;
} elsif (($generated =~ /rsync-mirror-failover-[\w\-.]+.sh$/) or ($generated =~ /rsync-mirror-distributed-[\w\-.]+.sh$/)) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if ($details) {
$compareText = "$compareView";
} else {
my (undef, $servername) = split (/: /, $compareView, 2);
($type, $activeServer, $server) = split (/-/, $servername, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
$commands {$server} {SCP} {++$_id} {auto} = 1;
$commands {$server} {SCP} {$_id} {label} = '+f';
$commands {$server} {SCP} {$_id} {active} = $active;
$commands {$server} {SCP} {$_id} {command} = "$SCPCOMMAND $connectArguments $APPLICATIONPATH/tmp/$CONFIGDIR/generated/$servername $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications';
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {SCP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '+g';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = read_directory ("$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$servername", '', '', '<br>', $debug) ." ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
if ($type =~ /^[CD]${activeServer}$/) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$compareText = "File '$path/$installed' removed from the generated configuration.";
} else {
my ($servername, $directory) = split (/\//, $path, 2);
($type, $activeServer, $server) = split (/-/, $servername, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
if (($installed =~ /^DisplayCT-[\w-]+.sh$/) or ($installed =~ /^CollectorCT-[\w-]+.sh$/)) {
$commands {$server} {STOP} {++$_id} {auto} = 0;
$commands {$server} {STOP} {$_id} {label} = '-a';
$commands {$server} {STOP} {$_id} {active} = $active;
$commands {$server} {STOP} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications'. ( (defined $directory) ? "/$directory" : '' ) ."/$installed stop"...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {STOP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
} elsif ((($type eq 'CS' or $type eq 'DS') and ($installed =~ /^rsync-mirror-failover-[\w\-.]+.sh$/))
or (($type eq 'DM' or $type eq 'DS') and ($installed =~ /^rsync-mirror-distributed-[\w\-.]+.sh$/))) {
$commands {$server} {CRONTAB} {++$_id} {auto} = 0;
$commands {$server} {CRONTAB} {$_id} {label} = '-b';
$commands {$server} {CRONTAB} {$_id} {active} = $active;
$commands {$server} {CRONTAB} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server DELETE ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications'. ( (defined $directory) ? "/$directory" : '' ) ."/$insta...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {CRONTAB} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
# my ($installedConf, undef) = split (/.sh/, $installed);
# $commands {$server} {REMOVE} {++$_id} {auto} = 0;
# $commands {$server} {REMOVE} {$_id} {label} = '-c';
# $commands {$server} {REMOVE} {$_id} {active} = $active;
# $commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications'. ( (defined $directory) ? "/$directory" : '' ) ."/$installedC...
# $compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$todo = 1;
} elsif ((($type eq 'CM' or $type eq 'DM') and ($installed =~ /^rsync-wrapper-failover-[\w\-.]+.sh$/))
or (($type eq 'CM' or $type eq 'CS') and ($installed =~ /^rsync-wrapper-distributed-[\w\-.]+.sh$/))) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '-d';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "'$installed' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$todo = 1;
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "UNKNOWN '$path' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
}
# Remove 'distributed.citap.com:/opt/asnmtap/applications/etc/DisplayCT-distributed-magweg'
# <----- $server ----->:$APPLICATIONPATH/<------- $installed ------->
$commands {$server} {REMOVE} {++$_id} {auto} = 1;
$commands {$server} {REMOVE} {$_id} {label} = '-f';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications'. ( (defined $directory) ? "/$directory" : '' ) ."/$installed";
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
}
} elsif ( $compareView =~ /^Only in installed:/ ) {
if ($details) {
$compareText = "$compareView";
} else {
my (undef, $servername) = split (/: /, $compareView, 2);
($type, $activeServer, $server) = split (/-/, $servername, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '-g';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = read_directory ("$APPLICATIONPATH/tmp/$CONFIGDIR/installed", '', '', '', $debug) ." ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {STOP} {++$_id} {auto} = 0;
$commands {$server} {STOP} {$_id} {label} = '-h';
$commands {$server} {STOP} {$_id} {active} = $active;
$commands {$server} {STOP} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/asnmt...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {STOP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {REMOVE} {++$_id} {auto} = 0;
$commands {$server} {REMOVE} {$_id} {label} = '-i';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {STOP} {++$_id} {auto} = 0;
$commands {$server} {STOP} {$_id} {label} = '-j';
$commands {$server} {STOP} {$_id} {active} = $active;
$commands {$server} {STOP} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/asnmt...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {STOP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {REMOVE} {++$_id} {auto} = 0;
$commands {$server} {REMOVE} {$_id} {label} = '-k';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {CRONTAB} {++$_id} {auto} = 0;
$commands {$server} {CRONTAB} {$_id} {label} = '-l';
$commands {$server} {CRONTAB} {$_id} {active} = $active;
$commands {$server} {CRONTAB} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server DELETE ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {CRONTAB} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {REMOVE} {++$_id} {auto} = 0;
$commands {$server} {REMOVE} {$_id} {label} = '-m';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {REMOVE} {++$_id} {auto} = 0;
$commands {$server} {REMOVE} {$_id} {label} = '-n';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$todo = 1;
}
} elsif ( $compareView =~ /^Files generated\// ) {
($path, $generated, $installed, $compareDiff) = do_compare_diff ($compareView, 3, $details, $debug);
if ($details) {
$compareText = "File '$generated' changed into the generated configuration.";
} else {
my (undef, $servername, $filename) = split (/\//, $generated, 3);
($type, $activeServer, $server) = split (/-/, $servername, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
# Replace 'distributed.citap.be:/opt/asnmtap/applications/slave/asnmtap-display.sh' with '/opt/asnmtap/applications/tmp/$CONFIGDIR/generated/DS-[SM]-distributed.citap.be/slave/asnmtap-display.sh'
# <----- $server ---->:$APPLICATIONPATH/<------ $filename -----> $APPLICATIONPATH/tmp/ /<---------------------- $generated ---------------------->
$commands {$server} {SCP} {++$_id} {auto} = 1;
$commands {$server} {SCP} {$_id} {label} = '=a';
$commands {$server} {SCP} {$_id} {active} = $active;
$commands {$server} {SCP} {$_id} {command} = "$SCPCOMMAND $connectArguments $APPLICATIONPATH/tmp/$CONFIGDIR/$generated $SSHLOGONNAME\@$server:". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$filename";
$compareText .= '<FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {SCP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
if (($filename =~ /^etc\/DisplayCT-[\w-]+$/) or ($filename =~ /^etc\/CollectorCT-[\w-]+$/)) {
$filename =~ s/etc\///g;
$commands {$server} {RELOAD} {++$_id} {auto} = 1;
$commands {$server} {RELOAD} {$_id} {label} = '=b';
$commands {$server} {RELOAD} {$_id} {active} = $active;
$commands {$server} {RELOAD} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/$...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {RELOAD} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
} elsif (($filename =~ /^(slave|master)\/asnmtap-display.sh$/) or ($filename =~ /^(slave|master)\/asnmtap-collector.sh$/)) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '=c';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "'$filename' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
} elsif (($filename =~ /^(slave|master)\/DisplayCT-[\w-]+\.sh$/) or ($filename =~ /^(slave|master)\/CollectorCT-[\w-]+\.sh$/)) {
$commands {$server} {START} {++$_id} {auto} = 0;
$commands {$server} {START} {$_id} {label} = '=d';
$commands {$server} {START} {$_id} {active} = $active;
$commands {$server} {START} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/$f...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {START} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
# } elsif ( $filename =~ /^master\/rsync-mirror-failover-[\w\-.]+.conf$/ or $filename =~ /^slave\/rsync-mirror-failover-[\w\-.]+.conf$/) {
# deze bestanden worden reeds gecopieerd door middel van bovenstaande SCP in deze sectie
}
}
} elsif ( $compareView =~ /^diff: installed: No such file or directory/ ) {
$compareText = "The installed configuration doesn't exist.";
} elsif ( $compareView =~ /^diff: generated: No such file or directory/ ) {
$compareText = "The generated configuration doesn't exist.";
} else {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
# APE #
# unless ($details)
# $action = 'errorView' unless ( $commandsToExecute eq $commandsExecuted );
# }
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub do_system_call {
my ($command, $debug) = @_;
my ($stdout, $stderr, $exit_value, $signal_num, $dumped_core, $status, $statusMessage);
if ($CAPTUREOUTPUT) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec("$command");
} else {
system ("$command"); $stdout = $stderr = '';
}
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$statusMessage .= "</td></tr>";
} else {
$statusMessage = '';
}
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub system_call {
my ($command, $parameters, $debug) = @_;
my $doSystemCall = 0;
my $statusMessage = '';
if ( $command eq "mkdir" ) {
$doSystemCall = 1 unless ( -e "$parameters" );
} elsif ( $command eq "rm -rf" ) {
if ($parameters =~ /$APPLICATIONPATH\/tmp\/$CONFIGDIR\// and -e "$parameters") { $doSystemCall = 1; }
} elsif ( $command eq "cp" ) {
applications/htmlroot/cgi-bin/admin/holidays.pl view on Meta::CPAN
my $Coffset = (defined $cgi->param('offset')) ? $cgi->param('offset') : 0;
my $CcountryID = (defined $cgi->param('countryID')) ? $cgi->param('countryID') : 'none';
my $Choliday = (defined $cgi->param('holiday')) ? $cgi->param('holiday') : '';
my $Cactivated = (defined $cgi->param('activated')) ? $cgi->param('activated') : 'off';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledPrimaryKey, $submitButton);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&holidayID=$CholidayID&formule...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>order by : $orderBy<br>action : $action<br>catalog ID ...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my ($catalogIDSelect, $countryIDSelect, $matchingHolidays, $navigationBar);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&catalogID=$CcatalogID";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = $formDisabledPrimaryKey = '';
if ($action eq 'duplicateView' or $action eq 'insertView') {
$htmlTitle = "Insert Holiday";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
$CcatalogID = $CATALOGID if ($action eq 'insertView');
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Holiday $CholidayID from $CcatalogID exist before to insert";
$CholidayID = "$Cformule-$Cmonth-$Cday-$Coffset-$CcountryID";
$sql = "select holidayID from $SERVERTABLHOLIDYS WHERE catalogID = '$CcatalogID' and holidayID = '$CholidayID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Holiday $CholidayID from $CcatalogID exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Holiday $CholidayID from $CcatalogID inserted";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLHOLIDYS. ' SET catalogID="' .$CcatalogID. '", holidayID="' .$CholidayID. '", formule="' .$Cformule. '", month="' .$Cmonth. '", day="' .$Cday. '", offset="' .$Coffset. '", countryID="' .$CcountryID. '", holida...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'deleteView') {
$formDisabledAll = $formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Delete Holiday $CholidayID from $CcatalogID";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$sql = "select holidayBundleID, holidayBundleName from $SERVERTABLHOLIDYSBNDL where catalogID='$CcatalogID' and holidayID REGEXP '/$CholidayID/' order by holidayBundleName";
($rv, $matchingHolidays) = check_record_exist ($rv, $dbh, $sql, 'Holiday Bundle from ' .$CcatalogID, 'ID', 'Name', '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ($matchingHolidays eq '') {
$sql = 'DELETE FROM ' .$SERVERTABLHOLIDYS. ' WHERE catalogID="' .$CcatalogID. '" and holidayID="' .$CholidayID. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Holiday $CholidayID from $CcatalogID deleted";
} else {
$htmlTitle = "Holiday $CholidayID from $CcatalogID not deleted, still used by";
}
} elsif ($action eq 'displayView') {
$formDisabledAll = $formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Display holiday $CholidayID from $CcatalogID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Edit holiday $CholidayID from $CcatalogID";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$matchingHolidays = '';
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
unless ( $dummyActivated ) {
$sql = "select holidayBundleID, holidayBundleName from $SERVERTABLHOLIDYSBNDL where catalogID = '$CcatalogID' and holidayID REGEXP '/$CholidayID/' order by holidayBundleName";
($rv, $matchingHolidays) = check_record_exist ($rv, $dbh, $sql, 'Holiday Bundle from ' .$CcatalogID, 'ID', 'Name', $matchingHolidays, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
if ($dummyActivated or $matchingHolidays eq '') {
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'UPDATE ' .$SERVERTABLHOLIDYS. ' SET catalogID="' .$CcatalogID. '", holidayID="' .$CholidayID. '", formule="' .$Cformule. '", month="' .$Cmonth. '", day="' .$Cday. '", offset="' .$Coffset. '", countryID="' .$CcountryID. '", holiday="' ...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Holiday $CholidayID from $CcatalogID updated";
} else {
$htmlTitle = "Holiday $CholidayID from $CcatalogID not deactivated and updated, still used by";
}
} elsif ($action eq 'listView') {
$htmlTitle = "All holidays listed";
if ( $CcatalogIDreload ) {
$pageNo = 1;
$pageOffset = 0;
}
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select SQL_NO_CACHE count(holidayID) from $SERVERTABLHOLIDYS where catalogID = '$CcatalogID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&catalogID=$CcatalogID&or...
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLHOLIDYS, 'holiday', "catalogID = '$CcatalogID'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGIS...
$sql = "select $SERVERTABLHOLIDYS.catalogID, $SERVERTABLHOLIDYS.holidayID, $SERVERTABLHOLIDYS.formule, $SERVERTABLHOLIDYS.month, $SERVERTABLHOLIDYS.day, $SERVERTABLHOLIDYS.offset, $SERVERTABLCOUNTRIES.countryName, $SERVERTABLHOLIDYS.holiday, $S...
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=catalogID desc, formule asc, countryName asc, holiday asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog ID <a href=\"$urlWithAccess...
$header .= "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=countryName desc, holiday asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Country <a href=\"$urlWithAccessParameters&action=listView&...
($rv, $matchingHolidays, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Holiday', 'catalogID|holidayID', '0|1', '1', '', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $nextAction, $pagedir, $p...
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select catalogID, holidayID, formule, month, day, offset, countryID, holiday, activated from $SERVERTABLHOLIDYS where catalogID = '$CcatalogID' and holidayID = '$CholidayID'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CcatalogID, $CholidayID, $Cformule, $Cmonth, $Cday, $Coffset, $CcountryID, $Choliday, $Cactivated) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_array: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTi...
if ($action eq 'duplicateView') {
$CcatalogID = $CATALOGID;
$CholidayID = '';
}
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
$sql = "select countryID, countryName from $SERVERTABLCOUNTRIES where activated = '1' order by countryName";
($rv, $countryIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcountryID, 'countryID', 'none', '-Select-', $formDisabledPrimaryKey, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, "onload=\"javascript:enableDisableFields();\"", 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function enableDisableFields() {
if ( document.holidays.formule.value == 0 ) {
document.holidays.month.disabled=false;
document.holidays.day.disabled=false;
document.holidays.offset.disabled=true;
document.holidays.offset.value=0;
applications/htmlroot/cgi-bin/admin/holidays.pl view on Meta::CPAN
return false;
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="holidays" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'listView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
document.holidays.catalogIDreload.value = 1;
document.holidays.submit();
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="holidays">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"holidays\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'listView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/holidays.pl view on Meta::CPAN
</td></tr>
<tr><td><b>Holiday: </b></td><td>
<input type="text" name="holiday" value="$Choliday" size="64" maxlength="64" $formDisabledAll>
</td></tr>
<tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Holiday: $htmlTitle</h1></td></tr>";
print " <tr><td align=\"center\">$matchingHolidays</td></tr>" if (defined $matchingHolidays and $matchingHolidays ne '');
} else {
print " <tr><td><br><table align=\"center\" border=0 cellpadding=1 cellspacing=1 bgcolor='#333344'><tr><td align=\"left\"><b>Catalog ID: </b></td><td>$catalogIDSelect</td></tr></table></td></tr>";
print " <tr><td align=\"center\"><br>$matchingHolidays</td></tr>";
}
print " </table>\n";
applications/htmlroot/cgi-bin/admin/holidaysBundle.pl view on Meta::CPAN
my @CholidayID = $cgi->param('holidayID');
my $Cactivated = (defined $cgi->param('activated')) ? $cgi->param('activated') : 'off';
my $CholidayID = (@CholidayID) ? '/'. join ('/', @CholidayID) .'/' : '';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledNoCountryID, $formDisabledPrimaryKey, $submitButton);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&holidayBundleID=$CholidayBund...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>order by : $orderBy<br>actio...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my ($catalogIDSelect, $countryIDSelect, $holidaysSelect, $matchingHolidaysBundle, $matchingPlugins, $navigationBar);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&catalogID=$CcatalogID";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = $formDisabledNoCountryID = $formDisabledPrimaryKey = '';
if ($CcountryIDreload) {
if ($action eq 'insert' or $action eq 'insertView') {
$action = 'insertView';
} elsif ($action eq 'edit' or $action eq 'editView') {
$action = 'editView';
} else {
$action = 'listView';
}
}
if ($action eq 'duplicateView' or $action eq 'insertView') {
$formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Insert Holiday Bundle";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Holiday Bundle $CholidayBundleID from $CcatalogID exist before to insert";
$sql = "select holidayBundleID from $SERVERTABLHOLIDYSBNDL WHERE catalogID = '$CcatalogID' and holidayBundleID = '$CholidayBundleID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Holiday Bundle $CholidayBundleID from $CcatalogID exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Holiday Bundle $CholidayBundleID from $CcatalogID inserted";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLHOLIDYSBNDL. ' SET catalogID="' .$CcatalogID. '", holidayBundleName="' .$CholidayBundleName. '", holidayID="' .$CholidayID. '", countryID="' .$CcountryID. '", activated="' .$dummyActivated. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'deleteView') {
$formDisabledAll = $formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Delete Holiday Bundle $CholidayBundleID from $CcatalogID";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$sql = "select uKey, test from $SERVERTABLPLUGINS where catalogID = '$CcatalogID' and holidayBundleID = '$CholidayBundleID' order by holidayBundleID";
($rv, $matchingHolidaysBundle) = check_record_exist ($rv, $dbh, $sql, 'Plugins from ' .$CcatalogID, 'Unique Key', 'Title', '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ($matchingHolidaysBundle eq '') {
$sql = 'DELETE FROM ' .$SERVERTABLHOLIDYSBNDL. ' WHERE catalogID="' .$CcatalogID. '" and holidayBundleID="' .$CholidayBundleID. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Holiday Bundle $CholidayBundleID from $CcatalogID deleted";
} else {
$htmlTitle = "Holiday Bundle $CholidayBundleID from $CcatalogID not deleted, still used by";
}
} elsif ($action eq 'displayView') {
$formDisabledAll = $formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Display Holiday Bundle $CholidayBundleID from $CcatalogID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Edit Holiday Bundle $CholidayBundleID from $CcatalogID";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$matchingHolidaysBundle = '';
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
unless ( $dummyActivated ) {
$sql = "select uKey, test from $SERVERTABLPLUGINS where catalogID='$CcatalogID' and holidayBundleID = '$CholidayBundleID' order by holidayBundleID";
($rv, $matchingHolidaysBundle) = check_record_exist ($rv, $dbh, $sql, 'Plugins from ' .$CcatalogID, 'Unique Key', 'Title', $matchingHolidaysBundle, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
if ($dummyActivated or $matchingHolidaysBundle eq '') {
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'UPDATE ' .$SERVERTABLHOLIDYSBNDL. ' SET catalogID="' .$CcatalogID. '", holidayBundleID="' .$CholidayBundleID. '", holidayBundleName="' .$CholidayBundleName. '", holidayID="' .$CholidayID. '", countryID="' .$CcountryID. '", activated="...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Holiday Bundle $CholidayBundleID from $CcatalogID updated";
} else {
$htmlTitle = "Holiday Bundle $CholidayBundleID from $CcatalogID not deactivated and updated, still used by";
}
} elsif ($action eq 'listView') {
$htmlTitle = "All holiday bundles listed";
if ( $CcatalogIDreload ) {
$pageNo = 1;
$pageOffset = 0;
}
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select SQL_NO_CACHE count(holidayBundleID) from $SERVERTABLHOLIDYSBNDL where catalogID = '$CcatalogID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&catalogID=$CcatalogID&or...
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLHOLIDYSBNDL, 'holidayBundleName', "catalogID = '$CcatalogID'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$...
$sql = "select $SERVERTABLHOLIDYSBNDL.catalogID, $SERVERTABLHOLIDYSBNDL.holidayBundleID, $SERVERTABLHOLIDYSBNDL.holidayBundleName, $SERVERTABLHOLIDYSBNDL.activated from $SERVERTABLHOLIDYSBNDL where $SERVERTABLHOLIDYSBNDL.catalogID = '$CcatalogI...
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=catalogID desc, holidayBundleName asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog ID <a href=\"$urlWithAccessParameters&action...
($rv, $matchingHolidaysBundle, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Holiday Bundle', 'catalogID|holidayBundleID', '0|1', '1', '', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $nextA...
}
if (!$CcountryIDreload and ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView')) {
$sql = "select catalogID, holidayBundleID, holidayBundleName, holidayID, countryID, activated from $SERVERTABLHOLIDYSBNDL where catalogID = '$CcatalogID' and holidayBundleID = '$CholidayBundleID'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CcatalogID, $CholidayBundleID, $CholidayBundleName, $CholidayID, $CcountryID, $Cactivated) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_array: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 360...
if ($action eq 'duplicateView') {
$CcatalogID = $CATALOGID;
$CholidayBundleID = 'new';
}
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
$sql = "select countryID, countryName from $SERVERTABLCOUNTRIES where activated = '1' order by countryName";
($rv, $countryIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcountryID, 'countryID', 'none', '-Select-', $formDisabledAll, 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $de...
if ( $CcountryID ne 'none' ) {
$sql = "select holidayID, holiday from $SERVERTABLHOLIDYS where catalogID = '$CcatalogID' and (countryID = '$CcountryID' or countryID = '00') order by holiday";
($rv, $holidaysSelect) = create_combobox_multiple_from_DBI ($rv, $dbh, $sql, $action, $CholidayID, 'holidayID', 'Country missing', 20, 64, $formDisabledAll, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$formDisabledNoCountryID = '';
} else {
$holidaysSelect = 'Country missing';
$formDisabledNoCountryID = 'disabled';
}
}
if (!$CcountryIDreload and ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'editView')) {
$matchingPlugins .= "<table border=0 cellpadding=1 cellspacing=1 bgcolor=\"$COLORSTABLE{TABLE}\"><tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><th colspan=\"5\">Plugins:</th></tr><tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>Catalog ID</td><td>Unique K...
my ($catalogID, $uKey, $title, $activated, $urlWithAccessParametersAction, $actionItem, $notActivated);
$sql = "select catalogID, uKey, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as optionValueTitle, activated from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where catalogID = '$CcatalogID' and holiday...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
$sth->bind_columns( \$catalogID, \$uKey, \$title, \$activated ) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
my $actionSkip = ( ( $catalogID eq $CATALOGID ) ? 0 : 1 );
$urlWithAccessParametersAction = "plugins.pl?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=1&pageOffset=0&catalogID=$catalogID&uKey=$uKey&orderBy=uKey&action";
$actionItem = " ";
$actionItem .= "<a href=\"$urlWithAccessParametersAction=displayView\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{details}\" title=\"Display View\" alt=\"Display View\" border=\"0\"></a> " if ($iconDetails);
$actionItem .= "<a href=\"$urlWithAccessParametersAction=editView\" target=\"_blank\"><img src=\"$IMAGESURL/$ICONSRECORD{edit}\" title=\"Edit View\" alt=\"Edit View\" border=\"0\"></a> " if ($iconEdit and ! $actionSkip);
$notActivated = ($activated) ? '' : ' not';
$matchingPlugins .= "<tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$catalogID</td><td>$uKey</td><td>$title</td><td><b>$notActivated activated</b></td><td>$actionItem</td></tr>\n";
}
} else {
$matchingPlugins .= "<tr><td>No records found</td></tr>\n";
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
$matchingPlugins .= "</table>\n";
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
if ( document.holidaysBundle.holidayBundleName.value == null || document.holidaysBundle.holidayBundleName.value == '' ) {
document.holidaysBundle.holidayBundleName.focus();
alert('Please enter a holiday bundle name!');
return false;
}
if ( document.holidaysBundle.countryID.value == null || document.holidaysBundle.countryID.value == 'none' ) {
document.holidaysBundle.countryID.focus();
alert('Please create/select a country!');
return false;
}
document.holidaysBundle.countryIDreload.value = 1;
document.holidaysBundle.submit();
return true;
}
function validateForm() {
if ( document.holidaysBundle.holidayBundleName.value == null || document.holidaysBundle.holidayBundleName.value == '' ) {
document.holidaysBundle.holidayBundleName.focus();
alert('Please enter a holiday bundle name!');
return false;
}
applications/htmlroot/cgi-bin/admin/holidaysBundle.pl view on Meta::CPAN
return false;
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="holidaysBundle" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'listView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
document.holidaysBundle.catalogIDreload.value = 1;
document.holidaysBundle.submit();
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="holidaysBundle">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"holidaysBundle\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'listView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/holidaysBundle.pl view on Meta::CPAN
</td></tr>
<tr><td><b>Holidays: </b></td><td>
$holidaysSelect
</td></tr>
<tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Holiday Bundle: $htmlTitle</h1></td></tr>";
print " <tr><td align=\"center\">$matchingHolidaysBundle</td></tr>" if (defined $matchingHolidaysBundle and $matchingHolidaysBundle ne '');
} else {
print " <tr><td><br><table align=\"center\" border=0 cellpadding=1 cellspacing=1 bgcolor='#333344'><tr><td align=\"left\"><b>Catalog ID: </b></td><td>$catalogIDSelect</td></tr></table></td></tr>";
print " <tr><td align=\"center\"><br>$matchingHolidaysBundle</td></tr>";
}
print " </table>\n";
applications/htmlroot/cgi-bin/admin/index.pl view on Meta::CPAN
my $cgi = new CGI;
my $pagedir = (defined $cgi->param('pagedir')) ? $cgi->param('pagedir') : '<NIHIL>'; $pagedir =~ s/\+/ /g;
my $pageset = (defined $cgi->param('pageset')) ? $cgi->param('pageset') : 'admin'; $pageset =~ s/\+/ /g;
my $debug = (defined $cgi->param('debug')) ? $cgi->param('debug') : 'F';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID";
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>URL ... : $urlAccessParameters</pre>" if ( $debug eq 'T' );
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td class="StatusItem"><font size="+1">Moderator</font></td></tr>
<tr><td class="StatusItem"> </td></tr>
<tr><td class="StatusItem"><a href="../moderator/sessions.pl?pagedir=$pagedir&pageset=$pageset&debug=F&CGISESSID=$sessionID">Session Console (for the Display)</a></td></tr>
<tr><td class="StatusItem"> </td></tr>
<tr><td class="StatusItem"><a href="../moderator/runStatusOnDemand.pl?pagedir=$pagedir&pageset=$pageset&debug=F&CGISESSID=$sessionID">Status Console (for the Collector/Display/Import Data Through Catalog)</a></td></tr>
applications/htmlroot/cgi-bin/admin/languages.pl view on Meta::CPAN
my $CkeyLanguage = (defined $cgi->param('keyLanguage')) ? $cgi->param('keyLanguage') : '';
my $ClanguageName = (defined $cgi->param('languageName')) ? $cgi->param('languageName') : '';
my $ClanguageFamily = (defined $cgi->param('languageFamily')) ? $cgi->param('languageFamily') : '';
my $ClanguageActive = (defined $cgi->param('languageActive')) ? $cgi->param('languageActive') : 'off';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledPrimaryKey, $submitButton);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&keyLanguage=$CkeyLanguage&languageName=$ClanguageName&languageFamily=$ClanguageFamily...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>order by : $orderBy<br>action : $action<br>unique key ...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my ($matchingLanguages, $navigationBar);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = $formDisabledPrimaryKey = '';
if ($action eq 'duplicateView' or $action eq 'insertView') {
$htmlTitle = "Insert Language";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Language $CkeyLanguage exist before to insert";
$sql = "select keyLanguage from $SERVERTABLLANGUAGE WHERE keyLanguage='$CkeyLanguage'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Language $CkeyLanguage exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Language $CkeyLanguage inserted";
my $dummyLanguageActive = ($ClanguageActive eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLLANGUAGE. ' SET keyLanguage="' .$CkeyLanguage. '", languageName="' .$ClanguageName. '", languageFamily="' .$ClanguageFamily. '", languageActive="' .$dummyLanguageActive. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'deleteView') {
$formDisabledAll = $formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Delete Language $CkeyLanguage";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$sql = "select remoteUser, email from $SERVERTABLUSERS where keyLanguage = '$CkeyLanguage' order by email, remoteUser";
($rv, $matchingLanguages) = check_record_exist ($rv, $dbh, $sql, 'Users', 'Remote User', 'Email', '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ($matchingLanguages eq '') {
$htmlTitle = "Language $CkeyLanguage deleted";
$sql = 'DELETE FROM ' .$SERVERTABLLANGUAGE. ' WHERE keyLanguage="' .$CkeyLanguage. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
} else {
$htmlTitle = "Language $CkeyLanguage not deleted, still used by";
}
} elsif ($action eq 'displayView') {
$formDisabledAll = $formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Display language $CkeyLanguage";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Edit language $CkeyLanguage";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$matchingLanguages = '';
my $dummyLanguageActive = ($ClanguageActive eq 'on') ? 1 : 0;
unless ( $dummyLanguageActive ) {
$sql = "select remoteUser, email from $SERVERTABLUSERS where keyLanguage = '$CkeyLanguage'";
($rv, $matchingLanguages) = check_record_exist ($rv, $dbh, $sql, 'Users', 'Remote User', 'Email', '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
if ($dummyLanguageActive or $matchingLanguages eq '') {
$sql = 'UPDATE ' .$SERVERTABLLANGUAGE. ' SET keyLanguage="' .$CkeyLanguage. '", languageName="' .$ClanguageName. '", languageFamily="' .$ClanguageFamily. '", languageActive="' .$dummyLanguageActive. '" WHERE keyLanguage="' .$CkeyLanguage. '"'...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Language $CkeyLanguage updated";
} else {
$htmlTitle = "Language $CkeyLanguage not deactivated and updated, still used by";
}
} elsif ($action eq 'listView') {
$htmlTitle = "All languages listed";
$sql = "select SQL_NO_CACHE count(keyLanguage) from $SERVERTABLLANGUAGE";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&orderBy=$orderBy");
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLLANGUAGE, 'languageName', "'1'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID...
$sql = "select keyLanguage, languageName, languageFamily, languageActive from $SERVERTABLLANGUAGE order by $orderBy limit $pageOffset, $RECORDSONPAGE";
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=keyLanguage desc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Key Language <a href=\"$urlWithAccessParameters&action=listView&order...
($rv, $matchingLanguages, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Language', 'keyLanguage', '0', '', '', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $nextAction, $pagedir, $pageset, $...
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select keyLanguage, languageName, languageFamily, languageActive from $SERVERTABLLANGUAGE where keyLanguage = '$CkeyLanguage'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CkeyLanguage, $ClanguageName, $ClanguageFamily, $ClanguageActive) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_array: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if ($s...
$ClanguageActive = ($ClanguageActive == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function validateForm() {
if ( document.languages.keyLanguage.value == null || document.languages.keyLanguage.value == '' ) {
document.languages.keyLanguage.focus();
alert('Please enter a language key!');
return false;
}
applications/htmlroot/cgi-bin/admin/languages.pl view on Meta::CPAN
return false;
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="languages" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"languages\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/languages.pl view on Meta::CPAN
</td></tr>
<tr><td><b>Language Family: </b></td><td>
<input type="text" name="languageFamily" value="$ClanguageFamily" size="24" maxlength="24" $formDisabledAll>
</td></tr>
<tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="languageActive" $languageActiveChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Language: $htmlTitle</h1></td></tr>";
print " <tr><td align=\"center\">$matchingLanguages</td></tr>" if (defined $matchingLanguages and $matchingLanguages ne '');
} else {
print " <tr><td align=\"center\"><br>$matchingLanguages</td></tr>";
}
print " </table>\n";
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
my $CholidayBundleID = (defined $cgi->param('holidayBundleID')) ? $cgi->param('holidayBundleID') : 1;
my $Cactivated = (defined $cgi->param('activated')) ? $cgi->param('activated') : 'off';
my $Cpagedir = (@Cpagedir) ? '/'. join ('/', @Cpagedir) .'/' : '';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledUniqueKey, $submitButton);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&filter=$filter&orderBy=$orderBy&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&uKey=$CuKey&te...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>filter : $filter<br>order by ...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
if ( $ChelpPluginFilename eq '' or $ChelpPluginFilename eq '<NIHIL>' ) {
$ChelpPluginFilename = ( $ChelpPluginTextname eq '' ? '<NIHIL>' : $ChelpPluginTextname );
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($catalogIDSelect, $environmentSelect, $holidayBundleSelect, $pagedirsSelect, $resultsdirSelect, $matchingPlugins, $navigationBar, $matchingViewsCrontabs, $generatePluginCrontabSchedulingReport);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&filter=$filter&catalogID=$CcatalogID";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = $formDisabledUniqueKey = '';
if ($action eq 'duplicateView' or $action eq 'insertView') {
$htmlTitle = "Insert Plugin";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
$CcatalogID = $CATALOGID if ($action eq 'insertView');
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Plugin $CuKey from $CcatalogID exist before to insert";
$sql = "select title from $SERVERTABLPLUGINS WHERE catalogID='$CcatalogID' and uKey='$CuKey'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Plugin $CuKey from $CcatalogID exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Plugin $CuKey inserted from $CcatalogID";
my $dummyOndemand = ($Condemand eq 'on') ? 1 : 0;
my $dummyProduction = ($Cproduction eq 'on') ? 1 : 0;
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLPLUGINS. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", test="' .$Ctest. '", environment="' .$Cenvironment. '", arguments="' .$Carguments. '", argumentsOndemand="' .$CargumentsOndemand. '", title="...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'deleteView') {
$formDisabledUniqueKey = $formDisabledAll = 'disabled';
$htmlTitle = "Delete plugin $CuKey from $CcatalogID";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$sql = "select uKey, title from $SERVERTABLCOMMENTS where catalogID = '$CcatalogID' and uKey = '$CuKey' order by title, uKey";
($rv, $matchingPlugins) = check_record_exist ($rv, $dbh, $sql, 'Comments from ' .$CcatalogID, 'Unique Key', 'Title', '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select lineNumber, uKey from $SERVERTABLCRONTABS where catalogID = '$CcatalogID' and uKey = '$CuKey' order by uKey, lineNumber";
($rv, $matchingPlugins) = check_record_exist ($rv, $dbh, $sql, 'Crontabs from ' .$CcatalogID, 'Unique Key', 'Linenumber', $matchingPlugins, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select uKey, displayDaemon from $SERVERTABLVIEWS where catalogID = '$CcatalogID' and uKey = '$CuKey' order by displayDaemon, uKey";
($rv, $matchingPlugins) = check_record_exist ($rv, $dbh, $sql, 'Views from ' .$CcatalogID, 'Unique Key', 'Display Daemon', $matchingPlugins, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select $SERVERTABLREPORTS.uKey, concat( LTRIM(SUBSTRING_INDEX($SERVERTABLPLUGINS.title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as title from $SERVERTABLREPORTS, $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where $SERVERTABLR...
($rv, $matchingPlugins) = check_record_exist ($rv, $dbh, $sql, 'Reports from ' .$CcatalogID, 'Unique Key', 'Title', $matchingPlugins, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ($matchingPlugins eq '') {
$htmlTitle = "Plugin $CuKey from $CcatalogID deleted";
$sql = 'DELETE FROM ' .$SERVERTABLPLUGINS. ' WHERE catalogID="' .$CcatalogID. '" and uKey="' .$CuKey. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
} else {
$htmlTitle = "Plugin $CuKey from $CcatalogID not deleted, still used by";
}
$nextAction = "listView" if ($rv);
} elsif ($action eq 'displayView') {
$formDisabledUniqueKey = $formDisabledAll = 'disabled';
$htmlTitle = "Display plugin $CuKey from $CcatalogID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$formDisabledUniqueKey = 'disabled';
$htmlTitle = "Edit plugin $CuKey from $CcatalogID";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$htmlTitle = "Plugin $CuKey updated from $CcatalogID";
my $dummyOndemand = ($Condemand eq 'on') ? 1 : 0;
my $dummyProduction = ($Cproduction eq 'on') ? 1 : 0;
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'UPDATE ' .$SERVERTABLPLUGINS. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", test="' .$Ctest. '", environment="' .$Cenvironment. '", arguments="' .$Carguments. '", argumentsOndemand="' .$CargumentsOndemand. '", title="' .$Cti...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
} elsif ($action eq 'listView') {
my $doFilter = ( ( defined $filter and $filter ne '' ) ? 1 : 0 );
$htmlTitle = ( $doFilter ) ? "All plugins matching filter: $filter" : "All plugins listed";
if ( $CcatalogIDreload ) {
$pageNo = 1;
$pageOffset = 0;
}
my $andFilter = ( ( $doFilter ) ? "AND title regexp '$filter'" : '' );
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select SQL_NO_CACHE count(uKey) from $SERVERTABLPLUGINS where catalogID = '$CcatalogID' $andFilter";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&catalogID=$CcatalogID&fi...
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLPLUGINS, 'title', "catalogID = '$CcatalogID' $andFilter", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug...
$sql = "select catalogID, uKey, title, environment, ondemand, production, pagedir, resultsdir, activated from $SERVERTABLPLUGINS where catalogID = '$CcatalogID' $andFilter order by $orderBy limit $pageOffset, $RECORDSONPAGE";
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=catalogID desc, uKey asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog ID <a href=\"$urlWithAccessParameters&action=listView&am...
$header .= "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=production desc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Production <a href=\"$urlWithAccessParameters&action=listView&orderBy...
($rv, $matchingPlugins, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Plugin', 'catalogID|uKey', '0|1', '', '', "&catalogID=$CcatalogID&filter=$filter", $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails,...
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select catalogID, uKey, test, environment, arguments, argumentsOndemand, title, shortDescription, trendline, percentage, tolerance, step, ondemand, production, pagedir, resultsdir, helpPluginFilename, holidayBundleID, activated from $SE...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CcatalogID, $CuKey, $Ctest, $Cenvironment, $Carguments, $CargumentsOndemand, $Ctitle, $CshortDescription, $Ctrendline, $Cpercentage, $Ctolerance, $Cstep, $Condemand, $Cproduction, $Cpagedir, $Cresultsdir, $ChelpPluginFilename, $CholidayBund...
$CcatalogID = $CATALOGID if ($action eq 'duplicateView');
$Condemand = ($Condemand == 1) ? 'on' : 'off';
$Cproduction = ($Cproduction == 1) ? 'on' : 'off';
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
$environmentSelect = create_combobox_from_keys_and_values_pairs ('P=>Production|A=>Acceptation|S=>Simulation|T=>Test|D=>Development|L=>Local', 'V', 0, $Cenvironment, 'environment', '', '', $formDisabledAll, '', $debug);
$sql = "select pagedir, groupName from $SERVERTABLPAGEDIRS where catalogID = '$CcatalogID' order by groupName";
($rv, $pagedirsSelect) = create_combobox_multiple_from_DBI ($rv, $dbh, $sql, $action, $Cpagedir, 'pagedirs', 'Pagedirs missing.', 5, 100, $formDisabledAll, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select resultsdir, groupName from $SERVERTABLRESULTSDIR where catalogID = '$CcatalogID' order by groupName";
($rv, $resultsdirSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $Cresultsdir, 'resultsdir', 'none', '-Select-', $formDisabledAll, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select holidayBundleID, holidayBundleName from $SERVERTABLHOLIDYSBNDL where catalogID = '$CcatalogID' and activated = '1' order by holidayBundleName";
($rv, $holidayBundleSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CholidayBundleID, 'holidayBundleID', '1', '+ No Holiday Bundle', $formDisabledAll, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'editView') {
$matchingViewsCrontabs .= "<table border=0 cellpadding=1 cellspacing=1 bgcolor=\"$COLORSTABLE{TABLE}\">";
my ($VdisplayDaemon, $Vactivated, $DGgroupTitle, $DGactivated, $DDdisplayDaemon, $DDgroupName, $DDactivated, $ScatalogID, $SserverID, $SserverTitle, $StypeServers, $StypeMonitoring, $StypeActiveServer, $SmasterFQDN, $SslaveFQDN, $Sactivated, $C...
my ($prevSserverID, $prevDDdisplayDaemon, $prevCDcollectorDaemon, $urlWithAccessParametersAction, $actionItem, $notActivated);
$matchingViewsCrontabs .= "<tr><th colspan=\"3\">Servers, Display Daemons, Views & Display Groups:</th></tr>\n";
$sql = "select $SERVERTABLVIEWS.displayDaemon, $SERVERTABLVIEWS.activated, $SERVERTABLDISPLAYGRPS.groupTitle, $SERVERTABLDISPLAYGRPS.activated, $SERVERTABLDISPLAYDMNS.displayDaemon, $SERVERTABLDISPLAYDMNS.groupName, $SERVERTABLDISPLAYDMNS.activ...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
$sth->bind_columns( \$VdisplayDaemon, \$Vactivated, \$DGgroupTitle, \$DGactivated, \$DDdisplayDaemon, \$DDgroupName, \$DDactivated, \$ScatalogID, \$SserverID, \$SserverTitle, \$StypeServers, \$StypeMonitoring, \$StypeActiveServer, \$SmasterFQDN...
if ( $rv ) {
$prevSserverID = $prevDDdisplayDaemon = '';
if ( $sth->rows ) {
while( $sth->fetch() ) {
my $actionSkip = ( ( $ScatalogID eq $CATALOGID ) ? 0 : 1 );
if ($prevSserverID eq '' or $prevSserverID ne $SserverID) {
$urlWithAccessParametersAction = "../sadmin/servers.pl?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=1&pageOffset=0&catalogID=$ScatalogID&serverID=$SserverID&orderBy=serverID ...
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
$notActivated = ($DGactivated) ? '' : ' not';
$matchingViewsCrontabs .= "<tr><td bgcolor=\"$COLORSTABLE{NOBLOCK}\">Display group title</td><td>$DGgroupTitle -<b>$notActivated activated</b></td><td> </td></tr>\n";
$prevSserverID = $SserverID;
$prevDDdisplayDaemon = $DDdisplayDaemon;
}
} else {
$matchingViewsCrontabs .= "<tr><td>No records found</td></tr>\n";
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
$matchingViewsCrontabs .= "<tr bgcolor=\"#000000\"><td colspan=\"3\"> </td></tr><tr><th colspan=\"3\">Servers, Collector Daemons & Crontabs:</th></tr>\n";
$sql = "select $SERVERTABLCRONTABS.linenumber, $SERVERTABLCRONTABS.collectorDaemon, $SERVERTABLCRONTABS.arguments, $SERVERTABLCRONTABS.minute, $SERVERTABLCRONTABS.hour, $SERVERTABLCRONTABS.dayOfTheMonth, $SERVERTABLCRONTABS.monthOfTheYear, $SER...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
$sth->bind_columns( \$CTlinenumber, \$CTcollectorDaemon, \$CTarguments, \$CTminute, \$CThour, \$CTdayOfTheMonth, \$CTmonthOfTheYear, \$CTdayOfTheWeek, \$CTnoOffline, \$CTactivated, \$CDcollectorDaemon, \$CDgroupName, \$CDactivated, \$ScatalogID...
if ( $rv ) {
$prevSserverID = $prevCDcollectorDaemon = '';
if ( $sth->rows ) {
while( $sth->fetch() ) {
my $actionSkip = ( ( $ScatalogID eq $CATALOGID ) ? 0 : 1 );
if ($prevSserverID eq '' or $prevSserverID ne $SserverID) {
$urlWithAccessParametersAction = "../sadmin/servers.pl?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=1&pageOffset=0&catalogID=$ScatalogID&serverID=$SserverID&orderBy=serverID ...
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
$prevSserverID = $SserverID;
$prevCDcollectorDaemon = $CDcollectorDaemon;
}
$generatePluginCrontabSchedulingReport = 1;
} else {
$matchingViewsCrontabs .= "<tr><td>No records found</td></tr>\n";
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
$matchingViewsCrontabs .= "</table>\n";
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function validateForm() {
HTML
if ($action eq 'duplicateView' or $action eq 'insertView') {
print <<HTML;
if ( document.plugins.uKey.value == null || document.plugins.uKey.value == '' ) {
document.plugins.uKey.focus();
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
}
if ( document.plugins.pagedirs.selectedIndex == -1 ) {
document.plugins.pagedirs.focus();
alert('Please create/select one or more view pagedirs!');
return false;
}
if ( document.plugins.resultsdir.options[document.plugins.resultsdir.selectedIndex].value == 'none' ) {
document.plugins.resultsdir.focus();
alert('Please create/select a results subdir!');
return false;
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="plugins" enctype="multipart/form-data" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'listView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
document.plugins.catalogIDreload.value = 1;
document.plugins.submit();
return true;
}
function validateForm() {
if ( document.plugins.filter.value != null || document.plugins.filter.value != "") {
document.plugins.pageNo.value = 1;
document.plugins.pageOffset.value = 0 ;
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="plugins" enctype="multipart/form-data" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"plugins\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'listView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
<input type="text" name="helpPluginTextname" value="$ChelpPluginFilename" size="100" maxlength="100" $formDisabledAll><br>
<input type="file" name="helpPluginFilename" size="100" accept="application/pdf" $formDisabledAll>
<tr><td>Holiday Bundle: </td><td>
$holidayBundleSelect
<tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Unique Key: $htmlTitle$ChelpPluginTextname</h1></td></tr>";
print " <tr><td align=\"center\">$matchingPlugins</td></tr>" if (defined $matchingPlugins and $matchingPlugins ne '');
} else {
print " <tr><td><br><table align=\"center\" border=0 cellpadding=1 cellspacing=1 bgcolor='#333344'><tr><td align=\"left\"><b>Catalog ID: </b></td><td>$catalogIDSelect</td><td> <input type=\"text\" name=\"filter\" size=\"25\" maxlength=\...
print " <tr><td align=\"center\"><br>$matchingPlugins</td></tr>";
}
print " </table>\n";
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'listView') {
print "</form>\n";
} else {
print "<br>\n";
}
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
my $CprinterFriendlyOutput = (defined $cgi->param('printerFriendlyOutput')) ? $cgi->param('printerFriendlyOutput') : 'off';
my $CformatOutput = (defined $cgi->param('formatOutput')) ? $cgi->param('formatOutput') : 'none';
my $CuserPassword = (defined $cgi->param('userPassword')) ? $cgi->param('userPassword') : '';
my $Cactivated = (defined $cgi->param('activated')) ? $cgi->param('activated') : 'off';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledPrimaryKey, $submitButton, $uKeySelect);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&id=$Cid&uKey=$CuKey&reportTit...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>order by : $orderBy<br>action : $action<br>catalog ID ...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my ($catalogIDSelect, $matchingReports, $navigationBar);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&catalogID=$CcatalogID";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = ''; $formDisabledPrimaryKey = "disabled";
if ($action eq 'duplicateView' or $action eq 'insertView') {
$htmlTitle = "Insert Report";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
$CcatalogID = $CATALOGID if ($action eq 'insertView');
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Report $Cid from $CcatalogID exist before to insert";
$sql = "select id from $SERVERTABLREPORTS WHERE catalogID='$CcatalogID' and id='$Cid'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Report $Cid from $CcatalogID exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Report $Cid from $CcatalogID inserted";
my $dummyStatus = ($Cstatus eq 'on') ? 1 : 0;
my $dummyErrorDetails = ($CerrorDetails eq 'on') ? 1 : 0;
my $dummyBar = ($Cbar eq 'on') ? 1 : 0;
my $dummyHourlyAverage = ($ChourlyAverage eq 'on') ? 1 : 0;
my $dummyDailyAverage = ($CdailyAverage eq 'on') ? 1 : 0;
my $dummyShowDetails = ($CshowDetails eq 'on') ? 1 : 0;
my $dummyShowComments = ($CshowComments eq 'on') ? 1 : 0;
my $dummyShowPerfdata = ($CshowPerfdata eq 'on') ? 1 : 0;
my $dummyShowTop20SlowTests = ($CshowTop20SlowTests eq 'on') ? 1 : 0;
my $dummyPrinterFriendlyOutput = ($CprinterFriendlyOutput eq 'on') ? 1 : 0;
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLREPORTS. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", reportTitle="' .$CreportTitle. '", periode="' .$Cperiode. '", timeperiodID="' .$CtimeperiodID. '", status="' .$dummyStatus. '", errorDetails=...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'deleteView') {
$formDisabledAll = "disabled";
$htmlTitle = "Delete Report $Cid from $CcatalogID";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$sql = "select id, $SERVERTABLREPORTS.uKey from $SERVERTABLREPORTS, $SERVERTABLREPORTSPRFDT where $SERVERTABLREPORTS.catalogID = '$CcatalogID' and id = '$Cid' and $SERVERTABLREPORTS.catalogID = $SERVERTABLREPORTSPRFDT.catalogID and $SERVERTABLR...
($rv, $matchingReports) = check_record_exist ($rv, $dbh, $sql, 'Reports from ' .$CcatalogID, 'ID', 'uKey', $matchingReports, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ($matchingReports eq '') {
$sql = 'DELETE FROM ' .$SERVERTABLREPORTS. ' WHERE catalogID="' .$CcatalogID. '" and id="' .$Cid. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Report $Cid from $CcatalogID deleted";
} else {
$htmlTitle = "Report $Cid from $CcatalogID not deleted, still used by";
}
} elsif ($action eq 'displayView') {
$formDisabledAll = "disabled";
$htmlTitle = "Display report $Cid from $CcatalogID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$htmlTitle = "Edit report $Cid from $CcatalogID";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$htmlTitle = "Report $Cid from updated $CcatalogID";
my $dummyStatus = ($Cstatus eq 'on') ? 1 : 0;
my $dummyErrorDetails = ($CerrorDetails eq 'on') ? 1 : 0;
my $dummyBar = ($Cbar eq 'on') ? 1 : 0;
my $dummyHourlyAverage = ($ChourlyAverage eq 'on') ? 1 : 0;
my $dummyDailyAverage = ($CdailyAverage eq 'on') ? 1 : 0;
my $dummyShowDetails = ($CshowDetails eq 'on') ? 1 : 0;
my $dummyShowComments = ($CshowComments eq 'on') ? 1 : 0;
my $dummyShowPerfdata = ($CshowPerfdata eq 'on') ? 1 : 0;
my $dummyShowTop20SlowTests = ($CshowTop20SlowTests eq 'on') ? 1 : 0;
my $dummyPrinterFriendlyOutput = ($CprinterFriendlyOutput eq 'on') ? 1 : 0;
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'UPDATE ' .$SERVERTABLREPORTS. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", reportTitle="' .$CreportTitle. '", periode="' .$Cperiode. '", timeperiodID="' .$CtimeperiodID. '", status="' .$dummyStatus. '", errorDetails="' .$du...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
} elsif ($action eq 'listView') {
$htmlTitle = "All reports listed";
$formDisabledPrimaryKey = '';
if ( $CcatalogIDreload ) {
$pageNo = 1;
$pageOffset = 0;
}
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select SQL_NO_CACHE count(id) from $SERVERTABLREPORTS where catalogID = '$CcatalogID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&catalogID=$CcatalogID&or...
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLREPORTS, 'reportTitle', "catalogID = '$CcatalogID'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&...
$sql = "select $SERVERTABLREPORTS.catalogID, $SERVERTABLREPORTS.id, $SERVERTABLREPORTS.uKey, $SERVERTABLREPORTS.reportTitle, $SERVERTABLREPORTS.periode, $SERVERTABLTIMEPERIODS.timeperiodName, $SERVERTABLREPORTS.formatOutput, $SERVERTABLREPORTS....
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=catalogID desc, reportTitle desc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog ID <a href=\"$urlWithAccessParameters&action=list...
$header .= "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=timeperiodName desc, reportTitle asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> SLA Window <a href=\"$urlWithAccessParameters&action...
($rv, $matchingReports, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Report', 'catalogID|id', '0|1', '1|2', '4#N=>Never|D=>Daily|W=>Weekly|M=>Monthly|Q=>Quarterly|Y=>Yearly', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDe...
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select catalogID, id, uKey, reportTitle, periode, timeperiodID, status, errorDetails, bar, hourlyAverage, dailyAverage, showDetails, showComments, showPerfdata, showTop20SlowTests, printerFriendlyOutput, formatOutput, userPassword, acti...
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CcatalogID, $Cid, $CuKey, $CreportTitle, $Cperiode, $CtimeperiodID, $Cstatus, $CerrorDetails, $Cbar, $ChourlyAverage, $CdailyAverage, $CshowDetails, $CshowComments, $CshowPerfdata, $CshowTop20SlowTests, $CprinterFriendlyOutput, $CformatOutp...
if ($action eq 'duplicateView') {
$CcatalogID = $CATALOGID;
$Cid = 'new';
}
$Cstatus = ($Cstatus == 1) ? 'on' : 'off';
$CerrorDetails = ($CerrorDetails == 1) ? 'on' : 'off';
$Cbar = ($Cbar == 1) ? 'on' : 'off';
$ChourlyAverage = ($ChourlyAverage == 1) ? 'on' : 'off';
$CdailyAverage = ($CdailyAverage == 1) ? 'on' : 'off';
$CshowDetails = ($CshowDetails == 1) ? 'on' : 'off';
$CshowComments = ($CshowComments == 1) ? 'on' : 'off';
$CshowPerfdata = ($CshowPerfdata == 1) ? 'on' : 'off';
$CshowTop20SlowTests = ($CshowTop20SlowTests == 1) ? 'on' : 'off';
$CprinterFriendlyOutput = ($CprinterFriendlyOutput == 1) ? 'on' : 'off';
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
if ($action eq 'insertView' or $action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'displayView' or $action eq 'editView') {
if ($CuKey eq 'none' or $action eq 'insertView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select uKey, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as optionValueTitle from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where $SERVERTABLPLUGINS.catalogID = '$CcatalogID' and $SERVERT...
} else {
$sql = "select uKey, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where uKey = '$CuKey' and $SERVERTABLPLUGINS.catalogID = '$CcatalogID' and $SERVERT...
}
($rv, $uKeySelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CuKey, 'uKey', 'none', '-Select-', $formDisabledAll, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, "onload=\"javascript:enableDisableFields();\"", 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function enableDisableFields() {
if ( document.reports.periode.value == 'Q' || document.reports.periode.value == 'Y' ) {
document.reports.hourlyAverage.disabled=true;
document.reports.hourlyAverage.checked=false;
document.reports.dailyAverage.disabled=true;
document.reports.dailyAverage.checked=false;
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
return false;
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="reports" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'listView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
document.reports.catalogIDreload.value = 1;
document.reports.submit();
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="reports">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"reports\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'listView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
my $showDetailsChecked = ($CshowDetails eq 'on') ? " checked" : '';
my $showCommentsChecked = ($CshowComments eq 'on') ? " checked" : '';
my $showPerfdataChecked = ($CshowPerfdata eq 'on') ? " checked" : '';
my $showTop20SlowTestsChecked = ($CshowTop20SlowTests eq 'on') ? " checked" : '';
my $printerFriendlyOutputChecked = ($CprinterFriendlyOutput eq 'on') ? " checked" : '';
my $activatedChecked = ($Cactivated eq 'on') ? " checked" : '';
my $formatPeriodeSelect = create_combobox_from_keys_and_values_pairs ('N=>Never|D=>Daily|W=>Weekly|M=>Monthly|Q=>Quarterly|Y=>Yearly', 'K', 0, $Cperiode, 'periode', 'none', '-Select-', $formDisabledAll, 'onChange="javascript:enableDisableFields...
my $slaWindowSelect = '';
($rv, $slaWindowSelect, undef) = create_combobox_from_DBI ($rv, $dbh, "select timeperiodID, timeperiodName from $SERVERTABLTIMEPERIODS where catalogID = '$CcatalogID' and activated = 1 order by timeperiodName", 1, '', $CtimeperiodID, 'timeperio...
my $formatOutputSelect = create_combobox_from_keys_and_values_pairs ('pdf=>PDF', 'V', 0, $CformatOutput, 'formatOutput', 'none', '-Select-', $formDisabledAll, '', $debug);
print <<HTML;
<tr><td> </td></tr>
<tr><td>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td><b>Catalog ID: </b></td><td>
<input type="text" name="catalogID" value="$CcatalogID" size="5" maxlength="5" disabled>
</td></tr>
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
</td></tr>
<tr><td> </td><td>This field contains the document user password, a string that is used by Adobe Acrobat to restrict viewing permissions on the file.<br>If this field is left blank, any user may view the document without entering a passw...
HTML
print <<HTML;
<tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Report: $htmlTitle</h1></td></tr>";
print " <tr><td align=\"center\">$matchingReports</td></tr>" if (defined $matchingReports and $matchingReports ne '');
} else {
print " <tr><td><br><table align=\"center\" border=0 cellpadding=1 cellspacing=1 bgcolor='#333344'><tr><td align=\"left\"><b>Catalog ID: </b></td><td>$catalogIDSelect</td></tr></table></td></tr>";
print " <tr><td align=\"center\"><br>$matchingReports</td></tr>";
}
print " </table>\n";
applications/htmlroot/cgi-bin/admin/reports_perfdata.pl view on Meta::CPAN
my $Ctimes = (defined $cgi->param('times')) ? $cgi->param('times') : '';
my $Cpercentiles = (defined $cgi->param('percentiles')) ? $cgi->param('percentiles') : '';
my $Cunit = (defined $cgi->param('unit')) ? $cgi->param('unit') : 's';
my $Cactivated = (defined $cgi->param('activated')) ? $cgi->param('activated') : 'off';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledNoMetricID, $formDisabledPrimaryKey, $submitButton, $uKeySelect, $metric_idSelect);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&uKeyReload=$CuKeyReload&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&uKey=...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>order by : $orderBy<br>action : $action<br>uKey Reload ...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my ($catalogIDSelect, $matchingReportsPerfdata, $navigationBar);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&catalogID=$CcatalogID";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = $formDisabledNoMetricID = $formDisabledPrimaryKey = '';
if ( $CuKeyReload ) {
if ($action eq 'insert' or $action eq 'insertView') {
$action = "insertView";
} elsif ($action eq 'edit' or $action eq 'editView') {
$action = "editView";
} else {
$action = "listView";
}
}
if ($action eq 'duplicateView' or $action eq 'insertView') {
$htmlTitle = "Insert Report Perfdata";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
$CcatalogID = $CATALOGID if ($action eq 'insertView');
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Report Perfdata $CuKey, $Cmetric_id from $CcatalogID exist before to insert";
$sql = "select catalogID, uKey, metric_id from $SERVERTABLREPORTSPRFDT WHERE catalogID='$CcatalogID' and uKey='$CuKey' and metric_id='$Cmetric_id'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Report Perfdata $CuKey, $Cmetric_id from $CcatalogID exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Report Perfdata $CuKey, $Cmetric_id from $CcatalogID inserted";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLREPORTSPRFDT. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", metric_id="' .$Cmetric_id. '", times="' .$Ctimes. '", percentiles="' .$Cpercentiles. '", unit="' .$Cunit. '", activated="' .$dummyActiva...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'deleteView') {
$formDisabledPrimaryKey = $formDisabledAll = 'disabled';
$htmlTitle = "Delete Report Perfdata $CuKey, $Cmetric_id from $CcatalogID";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$sql = 'DELETE FROM ' .$SERVERTABLREPORTSPRFDT. ' WHERE catalogID="' .$CcatalogID. '" and uKey="' .$CuKey. '" and metric_id="' .$Cmetric_id. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Report Perfdata $CuKey, $Cmetric_id from $CcatalogID deleted";
} elsif ($action eq 'displayView') {
$formDisabledPrimaryKey = $formDisabledAll = 'disabled';
$htmlTitle = "Display Report Perfdata $CuKey, $Cmetric_id from $CcatalogID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Edit Report Perfdata $CuKey, $Cmetric_id from $CcatalogID";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$htmlTitle = "Report Perfdata $CuKey, $Cmetric_id from $CcatalogID updated";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'UPDATE ' .$SERVERTABLREPORTSPRFDT. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", metric_id="' .$Cmetric_id. '", times="' .$Ctimes. '", percentiles="' .$Cpercentiles. '", unit="' .$Cunit. '", activated="' .$dummyActivated. '"...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
} elsif ($action eq 'listView') {
$htmlTitle = "All reports perfdata listed";
if ( $CcatalogIDreload ) {
$pageNo = 1;
$pageOffset = 0;
}
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select SQL_NO_CACHE count(uKey) from $SERVERTABLREPORTSPRFDT where catalogID = '$CcatalogID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&catalogID=$CcatalogID&or...
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLREPORTSPRFDT, 'uKey', "catalogID = '$CcatalogID'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CG...
$sql = "select $DATABASE.$SERVERTABLREPORTSPRFDT.catalogID, $DATABASE.$SERVERTABLREPORTSPRFDT.uKey, $DATABASE.$SERVERTABLREPORTSPRFDT.metric_id, concat( LTRIM(SUBSTRING_INDEX($DATABASE.$SERVERTABLPLUGINS.title, ']', -1)), ' (', $DATABASE.$SERVE...
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=catalog desc, title desc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog <a href=\"$urlWithAccessParameters&action=listView&or...
$header .= "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=metric_id desc, title asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Metric <a href=\"$urlWithAccessParameters&action=listView&o...
($rv, $matchingReportsPerfdata, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Report Perfdata', 'catalogID|uKey|metric_id', '0|1|2', '2', '', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $ne...
}
if (!$CuKeyReload and ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView')) {
$sql = "select catalogID, uKey, metric_id, times, percentiles, unit, activated from $SERVERTABLREPORTSPRFDT WHERE catalogID='$CcatalogID' and uKey='$CuKey' and metric_id='$Cmetric_id'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CcatalogID, $CuKey, $Cmetric_id, $Ctimes, $Cpercentiles, $Cunit, $Cactivated) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_array: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessi...
$CcatalogID = $CATALOGID if ($action eq 'duplicateView');
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
if ($action eq 'insertView' or $action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'displayView' or $action eq 'editView') {
if ($CuKey eq 'none' or $action eq 'insertView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select uKey, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as optionValueTitle from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where $SERVERTABLPLUGINS.catalogID = '$CcatalogID' and $SERVERT...
} else {
$sql = "select uKey, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where uKey = '$CuKey' and $SERVERTABLPLUGINS.catalogID = '$CcatalogID' and $SERVERT...
}
($rv, $uKeySelect, $htmlTitle) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, $nextAction, $CuKey, 'uKey', 'none', '-Select-', $formDisabledPrimaryKey, 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionI...
if ( $CuKey ne 'none' ) {
my $sqlWherePERFDATA;
my $catalogID_uKey = ( ( $CcatalogID eq 'CID' ) ? '' : $CcatalogID .'_' ) . $CuKey;
if ( $PERFPARSEVERSION eq '20' ) {
$sqlWherePERFDATA = "where service_id in (select service_id from $PERFPARSEDATABASE.perfdata_service where service_description = '$catalogID_uKey')";
} else {
$sqlWherePERFDATA = "where service_description = '$catalogID_uKey'";
}
if ( $rv ) {
$sql = "select metric_id, metric from $PERFPARSEDATABASE.perfdata_service_metric $sqlWherePERFDATA and metric not regexp '^(Compilation|Execution|Duration)\$' and unit regexp '^(s|ms)\$' order by metric";
($rv, $metric_idSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, $nextAction, $Cmetric_id, 'metric_id', 'none', '-Select-', $formDisabledPrimaryKey, '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
$formDisabledNoMetricID = '';
} else {
$metric_idSelect = "Application missing";
$formDisabledNoMetricID = 'disabled';
}
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, "", 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
if ( document.reports_perfdata.uKey.value == null || document.reports_perfdata.uKey.value == 'none' ) {
document.reports_perfdata.uKey.focus();
alert('Please create/select a Application!');
return false;
}
document.reports_perfdata.uKeyReload.value = 1;
document.reports_perfdata.submit();
return true;
}
function validateForm() {
HTML
if ($action eq 'duplicateView' or $action eq 'insertView') {
print <<HTML;
if ( document.reports_perfdata.uKey.options[document.reports_perfdata.uKey.selectedIndex].value == 'none' ) {
document.reports_perfdata.uKey.focus();
applications/htmlroot/cgi-bin/admin/reports_perfdata.pl view on Meta::CPAN
}
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="reports_perfdata" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'listView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, "", 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
document.reports_perfdata.catalogIDreload.value = 1;
document.reports_perfdata.submit();
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="reports_perfdata">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"reports\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'listView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/reports_perfdata.pl view on Meta::CPAN
</td></tr>
<tr><td><b>Unit: </b></td><td>
$unitSelect
</td></tr>
<tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Report Perfdata: $htmlTitle</h1></td></tr>";
print " <tr><td align=\"center\">$matchingReportsPerfdata</td></tr>" if (defined $matchingReportsPerfdata and $matchingReportsPerfdata ne '');
} else {
print " <tr><td><br><table align=\"center\" border=0 cellpadding=1 cellspacing=1 bgcolor='#333344'><tr><td align=\"left\"><b>Catalog ID: </b></td><td>$catalogIDSelect</td></tr></table></td></tr>";
print " <tr><td align=\"center\"><br>$matchingReportsPerfdata</td></tr>";
}
print " </table>\n";
applications/htmlroot/cgi-bin/admin/resultsdirs.pl view on Meta::CPAN
my $CcatalogIDreload = (defined $cgi->param('catalogIDreload')) ? $cgi->param('catalogIDreload') : 0;
my $Cresultsdir = (defined $cgi->param('resultsdir')) ? $cgi->param('resultsdir') : '';
my $CgroupName = (defined $cgi->param('groupName')) ? $cgi->param('groupName') : '';
my $Cactivated = (defined $cgi->param('activated')) ? $cgi->param('activated') : 'off';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledPrimaryKey, $submitButton);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&resultsdir=$Cresultsdir&group...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>order by : $orderBy<br>action ...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my ($catalogIDSelect, $matchingResultsdir, $navigationBar);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&catalogID=$CcatalogID";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = $formDisabledPrimaryKey = '';
if ($action eq 'duplicateView' or $action eq 'insertView') {
$htmlTitle = "Insert Resultsdir";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
$CcatalogID = $CATALOGID if ($action eq 'insertView');
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Resultsdir $Cresultsdir from $CcatalogID exist before to insert";
$sql = "select resultsdir from $SERVERTABLRESULTSDIR WHERE catalogID='$CcatalogID' and resultsdir='$Cresultsdir'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Resultsdir $Cresultsdir from $CcatalogID exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Resultsdir $Cresultsdir from $CcatalogID inserted";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLRESULTSDIR. ' SET catalogID="' .$CcatalogID. '", resultsdir="' .$Cresultsdir. '", groupName="' .$CgroupName. '", activated="' .$dummyActivated. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'deleteView') {
$formDisabledPrimaryKey = $formDisabledAll = 'disabled';
$htmlTitle = "Delete Resultsdir $Cresultsdir from $CcatalogID";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$sql = "select uKey, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where catalogID = '$CcatalogID' and resultsdir = '$Cresultsdir' and $SERVERTABLPLUGIN...
($rv, $matchingResultsdir) = check_record_exist ($rv, $dbh, $sql, 'Plugins from ' .$CcatalogID, 'Unique Key', 'Title', '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ($matchingResultsdir eq '') {
$htmlTitle = "Resultsdir $Cresultsdir from $CcatalogID deleted";
$sql = 'DELETE FROM ' .$SERVERTABLRESULTSDIR. ' WHERE catalogID="' .$CcatalogID. '" and resultsdir="' .$Cresultsdir. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
} else {
$htmlTitle = "Resultsdir $Cresultsdir from $CcatalogID not deleted, still used by";
}
$nextAction = "listView" if ($rv);
} elsif ($action eq 'displayView') {
$formDisabledPrimaryKey = $formDisabledAll = 'disabled';
$htmlTitle = "Display Resultsdir $Cresultsdir from $CcatalogID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$formDisabledPrimaryKey = 'disabled';
$htmlTitle = "Edit Resultsdir $Cresultsdir from $CcatalogID";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$htmlTitle = "Resultsdir $Cresultsdir from $CcatalogID updated";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'UPDATE ' .$SERVERTABLRESULTSDIR. ' SET catalogID="' .$CcatalogID. '", resultsdir="' .$Cresultsdir. '", groupName="' .$CgroupName. '", activated="' .$dummyActivated. '" WHERE catalogID="' .$CcatalogID. '" and resultsdir="' .$Cresultsdir....
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
} elsif ($action eq 'listView') {
$htmlTitle = "All resultsdir listed";
if ( $CcatalogIDreload ) {
$pageNo = 1;
$pageOffset = 0;
}
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select SQL_NO_CACHE count(resultsdir) from $SERVERTABLRESULTSDIR where catalogID = '$CcatalogID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&catalogID=$CcatalogID&or...
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLRESULTSDIR, 'groupName', "catalogID = '$CcatalogID'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&...
$sql = "select catalogID, resultsdir, groupName, activated from $SERVERTABLRESULTSDIR where catalogID = '$CcatalogID' order by $orderBy limit $pageOffset, $RECORDSONPAGE";
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=catalogID desc, resultsdir asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog ID <a href=\"$urlWithAccessParameters&action=listVi...
($rv, $matchingResultsdir, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Resultsdir', 'catalogID|resultsdir', '0|1', '', '', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $nextAction, $pagedi...
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select catalogID, resultsdir, groupName, activated from $SERVERTABLRESULTSDIR where catalogID='$CcatalogID' and resultsdir='$Cresultsdir'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CcatalogID, $Cresultsdir, $CgroupName, $Cactivated) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_array: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if ($sth->rows);
$CcatalogID = $CATALOGID if ($action eq 'duplicateView');
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function validateForm() {
HTML
if ($action eq 'duplicateView' or $action eq 'insertView') {
print <<HTML;
var objectRegularExpressionResultsdirFormat = /\^[a-zA-Z0-9-]\+\$/;
applications/htmlroot/cgi-bin/admin/resultsdirs.pl view on Meta::CPAN
return false;
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="resultsdir" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'listView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
document.resultsdir.catalogIDreload.value = 1;
document.resultsdir.submit();
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="resultsdir">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"resultsdir\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'listView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/resultsdirs.pl view on Meta::CPAN
<tr><td><b>Resultsdir: </b></td><td>
<input type="text" name="resultsdir" value="$Cresultsdir" size="64" maxlength="64" $formDisabledPrimaryKey>
<tr><td><b>Group Name: </b></td><td>
<input type="text" name="groupName" value="$CgroupName" size="64" maxlength="64" $formDisabledAll>
<tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Unique Key: $htmlTitle</h1></td></tr>";
print " <tr><td align=\"center\">$matchingResultsdir</td></tr>" if (defined $matchingResultsdir and $matchingResultsdir ne '');
} else {
print " <tr><td><br><table align=\"center\" border=0 cellpadding=1 cellspacing=1 bgcolor='#333344'><tr><td align=\"left\"><b>Catalog ID: </b></td><td>$catalogIDSelect</td></tr></table></td></tr>";
print " <tr><td align=\"center\"><br>$matchingResultsdir</td></tr>";
}
print " </table>\n";
applications/htmlroot/cgi-bin/admin/timeperiods.pl view on Meta::CPAN
my $Cthursday = (defined $cgi->param('thursday')) ? $cgi->param('thursday') : '';
my $Cfriday = (defined $cgi->param('friday')) ? $cgi->param('friday') : '';
my $Csaturday = (defined $cgi->param('saturday')) ? $cgi->param('saturday') : '';
my $Cactivated = (defined $cgi->param('activated')) ? $cgi->param('activated') : 'off';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledPrimaryKey, $submitButton);
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'admin', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&timeperiodID=$CtimeperiodID&t...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>page no : $pageNo<br>page offset : $pageOffset<br>order by : $orderBy<br>action : $action<br>catalog ID ...
if ( defined $sessionID and ! defined $errorUserAccessControl ) {
my ($catalogIDSelect, $matchingTimeperiods, $navigationBar);
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&catalogID=$CcatalogID";
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...
if ($dbh and $rv) {
$formDisabledAll = ''; $formDisabledPrimaryKey = 'disabled';
if ($action eq 'duplicateView' or $action eq 'insertView') {
$htmlTitle = "Insert Timeperiod";
$submitButton = "Insert";
$nextAction = "insert" if ($rv);
$CcatalogID = $CATALOGID if ($action eq 'insertView');
} elsif ($action eq 'insert') {
$htmlTitle = "Check if Timeperiod $CtimeperiodID from $CcatalogID exist before to insert";
$sql = "select timeperiodID from $SERVERTABLTIMEPERIODS WHERE catalogID='$CcatalogID' and timeperiodID='$CtimeperiodID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $numberRecordsIntoQuery ) {
$htmlTitle = "Timeperiod $CtimeperiodID from $CcatalogID exist already";
$nextAction = "insertView";
} else {
$htmlTitle = "Timeperiod $CtimeperiodID from $CcatalogID inserted";
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'INSERT INTO ' .$SERVERTABLTIMEPERIODS. ' SET catalogID="' .$CcatalogID. '", timeperiodID="' .$CtimeperiodID. '", timeperiodAlias="' .$CtimeperiodAlias. '", timeperiodName="' .$CtimeperiodName. '", sunday="' . $Csunday. '", monday="' ....
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
}
} elsif ($action eq 'deleteView') {
$formDisabledAll = 'disabled';
$htmlTitle = "Delete Timeperiod $CtimeperiodID from $CcatalogID";
$submitButton = "Delete";
$nextAction = "delete" if ($rv);
} elsif ($action eq 'delete') {
$sql = "select id, uKey from $SERVERTABLREPORTS where catalogID = '$CcatalogID' and timeperiodID = '$CtimeperiodID' order by id";
($rv, $matchingTimeperiods) = check_record_exist ($rv, $dbh, $sql, 'Reports from ' .$CcatalogID, 'ID', 'uKey', $matchingTimeperiods, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ($matchingTimeperiods eq '') {
$sql = 'DELETE FROM ' .$SERVERTABLTIMEPERIODS. ' WHERE catalogID="' .$CcatalogID. '" and timeperiodID="' .$CtimeperiodID. '"';
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Timeperiod $CtimeperiodID from $CcatalogID deleted";
} else {
$htmlTitle = "Timeperiod $CtimeperiodID from $CcatalogID not deleted, still used by";
}
} elsif ($action eq 'displayView') {
$formDisabledAll = 'disabled';
$htmlTitle = "Display timeperiod $CtimeperiodID from $CcatalogID";
$nextAction = "listView" if ($rv);
} elsif ($action eq 'editView') {
$htmlTitle = "Edit timeperiod $CtimeperiodID from $CcatalogID";
$submitButton = "Edit";
$nextAction = "edit" if ($rv);
} elsif ($action eq 'edit') {
$matchingTimeperiods = '';
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
unless ( $dummyActivated ) {
$sql = "select id, uKey from $SERVERTABLREPORTS where from catalogID = '$CcatalogID' and timeperiodID = '$CtimeperiodID' order by id";
($rv, $matchingTimeperiods) = check_record_exist ($rv, $dbh, $sql, 'Reports from ' .$CcatalogID, 'ID', 'uKey', $matchingTimeperiods, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
}
if ($dummyActivated or $matchingTimeperiods eq '') {
my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
$sql = 'UPDATE ' .$SERVERTABLTIMEPERIODS. ' SET catalogID="' .$CcatalogID. '", timeperiodID="' .$CtimeperiodID. '", timeperiodAlias="' .$CtimeperiodAlias. '", timeperiodName="' .$CtimeperiodName. '", sunday="' . $Csunday. '", monday="' . $Cmo...
$dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$nextAction = "listView" if ($rv);
$htmlTitle = "Timeperiod $CtimeperiodID from $CcatalogID updated";
} else {
$htmlTitle = "Timeperiod $CtimeperiodID from $CcatalogID not deactivated and updated, still used by";
}
} elsif ($action eq 'listView') {
$formDisabledPrimaryKey = '';
$htmlTitle = "All timeperiods listed";
if ( $CcatalogIDreload ) {
$pageNo = 1;
$pageOffset = 0;
}
$sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sql = "select SQL_NO_CACHE count(timeperiodID) from $SERVERTABLTIMEPERIODS where catalogID = '$CcatalogID'";
($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&action=listView&catalogID=$CcatalogID&or...
$navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLTIMEPERIODS, 'timeperiodName', "catalogID = '$CcatalogID'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$deb...
$sql = "select catalogID, timeperiodID, timeperiodName, activated from $SERVERTABLTIMEPERIODS where $SERVERTABLTIMEPERIODS.catalogID = '$CcatalogID' order by $orderBy limit $pageOffset, $RECORDSONPAGE";
$header = "<th><a href=\"$urlWithAccessParameters&action=listView&orderBy=catalogID desc, timeperiodID asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog ID <a href=\"$urlWithAccessParameters&action=list...
($rv, $matchingTimeperiods, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Timeperiod', 'catalogID|timeperiodID', '0|1', '', '', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $nextAction, $pag...
}
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
$sql = "select catalogID, timeperiodID, timeperiodAlias, timeperiodName, sunday, monday, tuesday, wednesday, thursday, friday, saturday, activated from $SERVERTABLTIMEPERIODS where catalogID = '$CcatalogID' and timeperiodID = '$CtimeperiodID'";
$sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
($CcatalogID, $CtimeperiodID, $CtimeperiodAlias, $CtimeperiodName, $Csunday, $Cmonday, $Ctuesday, $Cwednesday, $Cthursday, $Cfriday, $Csaturday, $Cactivated) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_arr...
if ($action eq 'duplicateView') {
$CcatalogID = $CATALOGID;
$CtimeperiodID = 'new';
}
$Cactivated = ($Cactivated == 1) ? 'on' : 'off';
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
if ( $rv ) {
# HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function validateForm() {
var objectRegularExpressionTimeFormat = /\^\\d\\d:\\d\\d-\\d\\d:\\d\\d(,\\d\\d:\\d\\d-\\d\\d:\\d\\d){0,2}\$/;
var objectRegularExpressionTimeValue = /\^(([0-1]\\d|2[0-3]):[0-5]\\d|24:00)-(([0-1]\\d|2[0-3]):[0-5]\\d|24:00)(,(([0-1]\\d|2[0-3]):[0-5]\\d|24:00)-(([0-1]\\d|2[0-3]):[0-5]\\d|24:00)){0,3}\$/;
if ( document.timeperiods.timeperiodAlias.value == null || document.timeperiods.timeperiodAlias.value == '' ) {
document.timeperiods.timeperiodAlias.focus();
alert('Please enter a timeperiod alias!');
applications/htmlroot/cgi-bin/admin/timeperiods.pl view on Meta::CPAN
}
}
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="timeperiods" onSubmit="return validateForm();">
HTML
} elsif ($action eq 'listView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print <<HTML;
<script language="JavaScript1.2" type="text/javascript">
function submitForm() {
document.timeperiods.catalogIDreload.value = 1;
document.timeperiods.submit();
return true;
}
</script>
<form action="$ENV{SCRIPT_NAME}" method="post" name="timeperiods">
HTML
} elsif ($action eq 'deleteView') {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
print "<form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"timeperiods\">\n";
$pageNo = 1; $pageOffset = 0;
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
}
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'listView') {
print <<HTML;
<input type="hidden" name="pagedir" value="$pagedir">
<input type="hidden" name="pageset" value="$pageset">
<input type="hidden" name="debug" value="$debug">
<input type="hidden" name="CGISESSID" value="$sessionID">
<input type="hidden" name="pageNo" value="$pageNo">
<input type="hidden" name="pageOffset" value="$pageOffset">
applications/htmlroot/cgi-bin/admin/timeperiods.pl view on Meta::CPAN
</td></tr><tr><td><b>Friday: </b></td><td>
<input type="text" name="friday" value="$Cfriday" size="36" maxlength="36" $formDisabledAll> format: [00:00-24:00[,00:00-24:00]{0,2}]
</td></tr><tr><td><b>Saturday: </b></td><td>
<input type="text" name="saturday" value="$Csaturday" size="36" maxlength="36" $formDisabledAll> format: [00:00-24:00[,00:00-24:00]{0,2}]
</td></tr><tr><td><b>Activated: </b></td><td>
<input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
</td></tr>
HTML
print " <tr><td> </td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...
print " <tr align=\"left\"><td align=\"right\"><br><input type=\"submit\" value=\"$submitButton\"></td><td><br><input type=\"reset\" value=\"Reset\"></td></tr>\n" if ($action ne 'displayView');
print " </table>\n";
} elsif ($action eq 'delete' or $action eq 'edit' or $action eq 'insert') {
print " <tr><td align=\"center\"><br><br><h1>Timeperiod: $htmlTitle</h1></td></tr>";
print " <tr><td align=\"center\">$matchingTimeperiods</td></tr>" if (defined $matchingTimeperiods and $matchingTimeperiods ne '');
} else {
print " <tr><td><br><table align=\"center\" border=0 cellpadding=1 cellspacing=1 bgcolor='#333344'><tr><td align=\"left\"><b>Catalog ID: </b></td><td>$catalogIDSelect</td></tr></table></td></tr>";
print " <tr><td align=\"center\"><br>$matchingTimeperiods</td></tr>";
}
print " </table>\n";