view release on metacpan or search on metacpan
# ------------------------------------
ArchiveCT, CollectorCT-* & DisplayCT-*
- replace '<uniqueKey>' with '[<catalogID>_]<uniqueKey>'
Implemented catalogID to all *.pl & *.pm files
Plugin templates
- NEW WebTransact XML Monitoring plugin template for testing the 'Application Monitor' for Monitoring-1.2.xml
- check_template-mail-xml-fingerprint-xml-monitoring-1.2.pl
- check_template-WebTransact-XML-Monitoring-1.2.pl
- /dtd/Fingerprint-1.0-and-monitoring-1.2-xml-validator.html
- /dtd/Monitoring-1.2.dtd
- /xml/Monitoring-1.2.xml
- /xml/Monitoring-1.2-doNotValidate.xml
- /xml/Monitoring-1.2-errorParsing.xml
Version 3.000.021, 2009/xx/yy, by Alex Peeters
- ASNMTAP
- NEW /cgi-bin/moderator/downtimes.pl
Set downtimes by uploading of a uKey file
- NEW /plugins/templates/check_template-cluster.pl
- check_template-WebTransact-XML-Monitoring-1.1.pl
- NEW common variable RUNCMDONDEMAND to Asnmtap.cnf
# RUNCMDONDEMAND localhost # localhost or probe
Version 3.000.019, 2009/01/03, by Alex Peeters with contributions from Yves Van den Hove.
- ASNMTAP
UPDATE '#!/bin/env perl' with '#!/usr/bin/env perl'
replace '[a-z|A-Z|0-9|-]' with '[a-zA-Z0-9-]'
- plugins/templates
NEW /dtd/Monitoring-1.1.dtd
NEW /dtd/Fingerprint-1.0-and-monitoring-1.0-xml-validator.html
NEW /dtd/Fingerprint-1.0-and-monitoring-1.1-xml-validator.html
NEW /xml/Monitoring-1.1.xml
NEW /xml/Monitoring-1.1-doNotValidate.xml
NEW /xml/Monitoring-1.1-errorParsing.xml
- /cgi-bin/runCmdOnDemand.pl
On Demand test now launched on the same probe as the collector that runs the test
- check_MySQL-database-replication.pl
- Added Slave IO detection
- /plugins/junit, making weblogic 10 compatible
- UPDATE check_jUnit.pl
- UPDATE create_ASNMTAP_jUnit_configuration_for_jUnit.pl
- UPDATE TABLE `wls_snmptt_CONFIG`
- ALTER TABLE `wls_snmptt_CONFIG` CHANGE COLUMN `trapMBeanType` `trapMBeanType` varchar(128) NOT NULL default '';
- ALTER TABLE `wls_snmptt_CONFIG` CHANGE COLUMN `trapAttributeName` `trapAttributeName` varchar(128) NOT NULL default '';
- ALTER TABLE `wls_snmptt_CONFIG` CHANGE COLUMN `trapMonitorType` `trapMonitorType` varchar(128) NOT NULL default '';
- 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
- NEW $SERVERMYSQLVERSION = '4.x # '4.x' or '5.0.x'
- NEW $SERVERMYSQLMERGE = '0' # '0' or '1'
- UPDATE create_sql_query_events_from_range_year_month with MERGE when $SERVERMYSQLMERGE = 1 for much faster year and quarter statistics
ASNMTAP::Asnmtap::Plugins
- NEW create_NCPL_weblogic_configuration_for_SNMP.pl
- NEW create_weblogic_configuration_database_with_SNMP.pl
- NEW create_weblogic_configuration_database_with_SNMP.SQL
ASNMTAP::Asnmtap::Plugins::Mail.pm
- FIX regarding MIME-Encoding '7bit' and code optimalisation
- NEW MIME-Encoding: '8bit', 'binhex', 'binary', 'x-gzip64', 'x-uu' & 'x-uuencode'
- overview MIME-Encoding: '7bit', '8bit', 'quoted-printable', 'base64', 'binhex', 'binary', 'x-gzip64', 'x-uu' & 'x-uuencode'
ASNMTAP::Asnmtap::Plugins::Nagios
- NEW check_network_interface_status.pl
- NEW snmptt_traps_remove_pending_and_duplicated.pl
ASNMTAP::Asnmtap::SOAP.pm
- NEW added basic authentication and credentials
- NEW added soapaction and readable
ASNMTAP::Asnmtap::Plugins::WebTransact.pm
- NEW Inherited LWP user agent object: $objectWebTransact->ua = LWP::UserAgent->new;
check_template-WebTransact-XML-Monitoring.pl & check_template-WebTransact-XML-Monitoring.t
- NEW WebTransact plugin template for XML Monitoring
- FIX <\\/embed> added
- FIX stop caching sound during refresh when sound off
- FIX when downtime into the future, problem with the 'Condended View'
- UPDATE replace '$TcommentData =~ s/<br><br>/<br>/g;' with '$TcommentData =~ s/(?:<br>)+/<br>/g;'
display.pl and plugins.pl
- FIX interval/step must be greather then 0!
getArchivedDisplays.pl
- NEW Archived Displays
generateConfig.pl
- FIX all SQL select statements regarding *.activated = 1 and add when needed
- added print text to fix rights regarding chmod 755 for new CollectorCT-.*sh or DisplayCT-.*sh script
- added edit, delete, duplicate and maintenance button for 'Plugin' and 'Help Plugin Filename'
holidayBundleSetDowntimes.pl
- FIX Global symbol "$SERVERTABLENVIRONMENT" requires explicit package name at ./holidayBundleSetDowntimes.pl line 152.
plugins.pl
- making it possible to edit 'Help Plugin Filename' manual or by uploading and to clear with '<NIHIL>'
runStatusOnDemand.pl
- UPDATE doRequestedActions: added -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=$WWWKEYPATH/.ssh/known_hosts'
rsync-wrapper-*.sh
- UPDATE advanced debug information
- UPDATE making rsync version 2.6.7
PM - This hash will contain a list of all ASNMTAP files
MANIFEST.SKIP
- A file full of regular expressions to exclude when using 'make manifest' to generate the MANIFEST.
- used by 'make manifest' to build the file MANIFEST
- also used by 'make skipcheck' & 'make distcheck'
Shared PERL & SSL support
- added environment variable PERL5LIB, MANPATH & LD_LIBRARY_PATH to Asnmtap.cnf
Windows Internet Explorer 7.0
- tested and did look OK
ASNMTAP::Asnmtap
- replace `::VERSION = 3.000.xxx` with `::VERSION = do { my @r = (q$Revision: 3.000.012$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };`
- replace `my $version = '3.000.xxx'` with `my $VERSION = do { my @r = (q$Revision: 3.000.012$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };`
ASNMTAP::Asnmtap::Applications
- NEW purge_table.pl
- add Environment after the Plugin Titles
- add our %ENVIRONMENT = ('P'=>'Production', 'S'=>'Simulation', 'A'=>'Acceptation', 'T'=>'Test', 'D'=>'Development', 'L'=>'Local');
- used into display.pl, comments.pl, contact.pl, getHelpPlugin.pl, info.pl, perfparse.pl, runCmdOnDemand.pl & users.pl
- Applications.pod updated regarding 'perl Makefile.PL INSTALL_BASE=/opt/asnmtap/cpan-shared'
ASNMTAP::Asnmtap::Plugins
- FIX replace: _programGetOptions => [..., 'password|passwd|p=s', ...],
with : _programGetOptions => [..., 'password|p|passwd=s', ...],
- FIX replace: push ( @{ $_[0]->{_programGetOptions} }, 'status|S:s', 'asnmtapEnv|A:s', 'onDemand|O:s', 'logging|L:s', 'debugfile|dumphttp|httpdump|D:s', 'debug|d:s' );
with : push ( @{ $_[0]->{_programGetOptions} }, 'status|S:s', 'asnmtapEnv|A:s', 'onDemand|O:s', 'logging|L:s', 'debugfile|D|dumphttp|httpdump:s', 'debug|d:s' );
- check_memory-top.pl, now also Solaris 10 compatible
- FIX '<environment>PROD</environment>' into check_template-mail-xml.pl & check_template-mail-xml-fingerprint-xml.pl
- replaced 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; ASNMTAP; U;' with 'Mozilla/4.7 (compatible; ASNMTAP; U;'
- NEW $ENV{HTTPS_VERSION} for v2, v3 and v23
ASNMTAP::Asnmtap::Plugins::Nagios
- NEW check_nagios-comments-cleanup.pl
- NEW EPN (Embedded Perl Nagios) compatible
ASNMTAP::Asnmtap::Plugins::NPTest
- upgrade van version NPTest v1.11 to v1.13
- replace NPTest->testCmd with ASNMTAP::Asnmtap::Plugins::NPTest->testCmd
ASNMTAP::Asnmtap::Plugins::SOAP
- add $SOAP::Constants::PATCH_HTTP_KEEPALIVE
ASNMTAP CPAN module ASNMTAP::Asnmtap::Applications::Collector
ASNMTAP::Asnmtap::Plugins::Mail
- Mail::POP3Client instead of Net::POP3
replace $pop3->delete with $pop3->Delete in your mail scripts!!!
- MIME::Tools
Asnmtap plugins added:
- check_file-counter.pl
- check_template-mail.pl
- check_template-mail-fingerprint-xml.pl
- check_template-mail-xml-fingerprint-xml.pl
- check_template-mail-xml-fingerprint-xml-monitoring.pl
- check_template-mail-xml.pl
- check_sendAndReceiveMail.pl
Nagios plugins added:
- check_memory-free.pl
- check_memory-top.pl
- check_nagios-comments-cleanup.pl
- check_snmptt_traps.pl
- check_swap.pl
- check_swap-allocated.pl
<COMMON>
SMTPUNIXSYSTEM 1
SERVERLISTSMTP localhost
SERVERSMTP localhost
SENDMAILFROM asnmtap@localhost
HTTPSSERVER asnmtap.localhost
REMOTE_HOST localhost
REMOTE_ADDR 127.0.0.1
OPTIONS --bodyimage /opt/asnmtap/applications/htmlroot/img/logos/bodyimage.gif --charset iso-8859-1 --format pdf14 --size A4 --landscape --browserwidth 1280 --top 10mm --bottom 10mm --left 10mm --right 10mm --fontsize 10.0 --fontspacing ...
</COMMON>
...
<DATABASE_ACCOUNT>
...
</DATABASE_ACCOUNT>
...
SSH access for the 'Application Monitor'
----------------------------------------
t/Asnmtap/Plugins/XML.t
t/Asnmtap/Plugins/WebTransact.t
t/Templates/Plugins/check_dummy.t
t/Templates/Plugins/check_MySQL-database-replication.t
t/Templates/Plugins/check_template.t
t/Templates/Plugins/IO/check_template-IO.t
t/Templates/Plugins/Mail/check_template-mail.t
t/Templates/Plugins/Mail/check_template-mail-fingerprint-xml.t
t/Templates/Plugins/Mail/check_template-mail-xml-fingerprint-xml.t
t/Templates/Plugins/Mail/check_template-mail-xml-fingerprint-xml-monitoring.t
t/Templates/Plugins/Mail/check_template-mail-xml-fingerprint-xml-monitoring-1.1.t
t/Templates/Plugins/Mail/check_template-mail-xml.t
t/Templates/Plugins/Mail/check_template-mail-without-fingerprint.t
t/Templates/Plugins/Modem/check_template-modem.t
t/Templates/Plugins/Modem/check_template-ras.t
t/Templates/Plugins/Nagios/check_template-ftp.t
t/Templates/Plugins/Nagios/check_template-ldap.t
t/Templates/Plugins/Nagios/check_template-nagios.t
t/Templates/Plugins/Nagios/check_xml-monitoring.t
t/Templates/Plugins/Nagios/check_xml.t
plugins/snmptt/snmptt_traps_remove_pending_and_duplicated.pl
plugins/templates/check_dummy.pl
plugins/templates/check_file-counter.pl
plugins/templates/check_MySQL-database-replication.pl
plugins/templates/check_sendAndReceiveMail.pl
plugins/templates/check_template.pl
plugins/templates/check_template-cluster.pl
plugins/templates/check_template-IO.pl
plugins/templates/check_template-mail.pl
plugins/templates/check_template-mail-fingerprint-xml.pl
plugins/templates/check_template-mail-xml-fingerprint-xml.pl
plugins/templates/check_template-mail-xml-fingerprint-xml-monitoring.pl
plugins/templates/check_template-mail-xml-fingerprint-xml-monitoring-1.1.pl
plugins/templates/check_template-mail-xml.pl
plugins/templates/check_template-mail-fingerprint.pl
plugins/templates/check_template-modem.pl
plugins/templates/check_template-ras.pl
plugins/templates/check_template-SOAP.pl
plugins/templates/check_template-SNMPTT.pl
plugins/templates/check_template-WebTransact.pl
plugins/templates/check_template-WebTransact-Perfdata.pl
plugins/templates/check_template-WebTransact-with-client-authorization.pl
plugins/templates/check_template-WebTransact-with-client-certificate.pl
plugins/templates/check_template-WebTransact-XML.pl
plugins/templates/check_template-WebTransact-XML-Cactus-parser.pl
plugins/templates/check_template-WebTransact-XML-Monitoring.pl
plugins/templates/check_template-WebTransact-XML-Monitoring-1.1.pl
plugins/templates/check_template-WebTransact-XML-Monitoring-1.2.pl
plugins/templates/check_template-XML.pl
plugins/templates/dtd/email-upgrade-1.0.dtd
plugins/templates/dtd/FingerprintEmail-1.0.dtd
plugins/templates/dtd/Monitoring-1.0.dtd
plugins/templates/dtd/Monitoring-1.1.dtd
plugins/templates/dtd/Monitoring-1.2.dtd
plugins/templates/dtd/Fingerprint-1.0-and-monitoring-1.0-xml-validator.html
plugins/templates/dtd/Fingerprint-1.0-and-monitoring-1.1-xml-validator.html
plugins/templates/dtd/Fingerprint-1.0-and-monitoring-1.2-xml-validator.html
plugins/templates/jUnit/create_ASNMTAP_jUnit_configuration_for_jUnit-3.002.003_mysql-v5.0.x.SQL
plugins/templates/snmptt/create_weblogic_configuration_database_with_SNMP-3.002.003_mysql-v5.0.x.SQL
plugins/templates/snmptt/snmptt-bea-weblogic.conf
plugins/templates/snmptt/snmptt-oracle.conf
plugins/templates/snmptt/snmptt-3.002.003-v5.0.x.sql
plugins/templates/snmptt/snmptt.ini
plugins/templates/xml/email-upgrade-1.0.xml
plugins/templates/xml/FingerprintEmail-1.0.xml
plugins/templates/xml/Monitoring-1.0.xml
plugins/templates/xml/Monitoring-1.0-doNotValidate.xml
plugins/templates/xml/Monitoring-1.0-errorParsing.xml
plugins/templates/xml/Monitoring-1.1.xml
plugins/templates/xml/Monitoring-1.1-doNotValidate.xml
plugins/templates/xml/Monitoring-1.1-errorParsing.xml
plugins/templates/xml/Monitoring-1.2.xml
plugins/templates/xml/Monitoring-1.2-doNotValidate.xml
plugins/templates/xml/Monitoring-1.2-errorParsing.xml
plugins/templates/xml/ServletTestRunner-FailureError.xml
Makefile.PL view on Meta::CPAN
# Module section - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use Config qw(%Config);
use ExtUtils::MakeMaker qw(WriteMakefile prompt);
my $module = 'ExtUtils::MakeMaker';
my $version = '6.32';
unless ( eval ( "require $module; Exporter::require_version ( '$module', $version );" ) ) {
print "\n$module v$version, required for 'perl Makefile.PL' via CPAN\n";
print "\nperl -MCPAN -e 'install $module'\n\n";
exit;
}
# $module = 'ExtUtils::Autoconf';
# $version = '0.02';
# unless ( eval ( "require $module; Exporter::require_version ( '$module', $version );" ) ) {
# print "\n$module v$version, required for 'perl Makefile.PL' via CPAN\n";
# print "\nperl -MCPAN -e 'install $module'\n\n";
# exit;
# }
# Configuration section - - - - - - - - - - - - - - - - - - - - - - - - -
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 $PERL_AUTOINSTALL = exists $ENV{PERL_AUTOINSTALL} ? $ENV{PERL_AUTOINSTALL} : 0;
my $ASNMTAP_APPLICATIONS = exists $ENV{ASNMTAP_APPLICATIONS} ? $ENV{ASNMTAP_APPLICATIONS} : 0;
my $ASNMTAP_PLUGINS = exists $ENV{ASNMTAP_PLUGINS} ? $ENV{ASNMTAP_PLUGINS} : 0;
my $ASNMTAP_UID = exists $ENV{ASNMTAP_UID} ? $ENV{ASNMTAP_UID} : '500';
my $ASNMTAP_GID = exists $ENV{ASNMTAP_GID} ? $ENV{ASNMTAP_GID} : '500';
my $ASNMTAP_PATH = exists $ENV{ASNMTAP_PATH} ? $ENV{ASNMTAP_PATH} : '/opt/asnmtap';
my $ASNMTAP_PROXY = exists $ENV{ASNMTAP_PROXY} ? $ENV{ASNMTAP_PROXY} : '0.0.0.0';
# End Configuration - You should not have to change anything below this line
Makefile.PL view on Meta::CPAN
unlink ('t/PLUGINS_ENABLED') if ( -e 't/PLUGINS_ENABLED' );
unlink ('t/PLUGINS_NPTEST_ENABLED') if ( -e 't/PLUGINS_NPTEST_ENABLED' );
unlink ('t/PLUGINS_MAIL_ENABLED') if ( -e 't/PLUGINS_MAIL_ENABLED' );
unlink ('t/PLUGINS_MODEM_ENABLED') if ( -e 't/PLUGINS_MODEM_ENABLED' );
unlink ('t/PLUGINS_NAGIOS_ENABLED') if ( -e 't/PLUGINS_NAGIOS_ENABLED' );
unlink ('t/PLUGINS_SOAP_ENABLED') if ( -e 't/PLUGINS_SOAP_ENABLED' );
unlink ('t/PLUGINS_WEBTRANSACT_ENABLED') if ( -e 't/PLUGINS_WEBTRANSACT_ENABLED' );
unlink ('t/PLUGINS_XML_ENABLED') if ( -e 't/PLUGINS_XML_ENABLED' );
if ( $prompt ) {
print <<EOT;
Note that you can avoid these questions by passing the '-n' option
to 'Makefile.PL'.
The DEFAULT AUTO for automatic installation of dependencies via CPAN is '$PERL_AUTOINSTALL'.
The Applications are installed when the value equals 1.
The DEFAULT APPLICATIONS for the the plugin templates is '$ASNMTAP_APPLICATIONS'.
The Plugin templates are installed when the value equals 1.
Makefile.PL view on Meta::CPAN
$ASNMTAP_APPLICATIONS = ( ExtUtils::MakeMaker::prompt( "\nDo you want to install the Applications?" => ( $ASNMTAP_APPLICATIONS ? 'yes' : 'no' ) ) =~ /^\s*(y)/i );
$ASNMTAP_PLUGINS = ( ExtUtils::MakeMaker::prompt( "\nDo you want to install the Plugin templates?" => ( $ASNMTAP_PLUGINS ? 'yes' : 'no' ) ) =~ /^\s*(y)/i );
if ( $ASNMTAP_APPLICATIONS or $ASNMTAP_PLUGINS ) {
$ASNMTAP_UID = prompt ("\nThe wanted UID for the applications and/or plugins?", $ASNMTAP_UID);
$ASNMTAP_GID = prompt ("\nThe wanted GID for the applications and/or plugins?", $ASNMTAP_GID);
do {
$ASNMTAP_PATH = prompt ("\nWhere do want to install the applications and/or plugins?", $ASNMTAP_PATH);
unless ( -d $ASNMTAP_PATH ) { mkdir $ASNMTAP_PATH or print "- invalid directory: '$ASNMTAP_PATH'\n" };
} while ( ! -d $ASNMTAP_PATH );
}
} else {
if ( $ASNMTAP_APPLICATIONS or $ASNMTAP_PLUGINS ) {
print "\nCreate directory: '$ASNMTAP_PATH':\n";
unless ( -d $ASNMTAP_PATH ) { mkdir $ASNMTAP_PATH or die "- invalid directory '$ASNMTAP_PATH'\n"; }
}
}
if ( $ASNMTAP_APPLICATIONS or $ASNMTAP_PLUGINS ) {
print "- created (when not already exists): '$ASNMTAP_PATH'\n\n";
chown ( $ASNMTAP_UID, $ASNMTAP_GID, $ASNMTAP_PATH ) or die "- chown $ASNMTAP_UID:$ASNMTAP_GID $ASNMTAP_PATH failed: $!";
if ( $ASNMTAP_APPLICATIONS ) {
unlink <$ASNMTAP_PATH/applications/htmlroot/nav/*/reports-*.html> if ( -e "$ASNMTAP_PATH/applications/htmlroot/nav" );
if ( -e "$ASNMTAP_PATH/results" ) {
unlink <$ASNMTAP_PATH/results/FOOTER.html>;
unlink <$ASNMTAP_PATH/results/*/FOOTER.html>;
unlink <$ASNMTAP_PATH/results/*/debug/FOOTER.html>;
unlink <$ASNMTAP_PATH/results/*/reports/FOOTER.html>;
Makefile.PL view on Meta::CPAN
We are about to install ASNMTAP::Asnmtap and for your convenience will
provide you with list of modules and prerequisites, so you'll be able
to choose only modules you need for your configuration.
EOI
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 ||= '';
Makefile.PL view on Meta::CPAN
# 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 );
Makefile.PL view on Meta::CPAN
@{$prerequisite}[4] = $u_default;
}
}
# Initialize the entire prerequisites table
foreach my $prerequisites ( @prerequisites ) { update_prerequisites_table( @$prerequisites[0], @$prerequisites[4] ); }
my $proceed = 0;
do {
print "\n". generate_PREREQ_PM_table() ."\n";
$proceed = ( $prompt ? ExtUtils::MakeMaker::prompt( "Do you want to proceed with this configuration?" => 'yes' ) =~ /^\s*y/i : 1 );
print "\nActivate test:\n" if ($proceed);
%PREREQ_PM = ();
foreach my $prerequisite ( @prerequisites ) {
my ($level, $feature, $dependency, $modules, $default) = @{$prerequisite}[0..4];
next unless ( $dependency ne '' );
unless ( $proceed || $default >= 2 ) {
$default = ( ( ExtUtils::MakeMaker::prompt( "Do you plan to use ${feature}?" => ( $default ? 'yes' : 'no' ) ) =~ /^\s*(y)/i ) ? 1 : 0 );
@{$prerequisite}[4] = $default;
}
update_prerequisites_table( $level, $default );
if ( $proceed and ( $default == 1 || $default == 2 ) ) {
if ( $dependency =~ /^ASNMTAP::Asnmtap::/ ) {
my $t = uc($');
$t =~ s/::/_/g;
my $enabled = 't/'. $t .'_ENABLED';
open (ENABLED, ">$enabled") or die "- activate test '$enabled' failed: $!\n";
close (ENABLED);
print "- activated test: '$enabled'\n";
}
foreach ( keys %$modules ) {
my $version = $modules->{$_};
next if ( $version =~ /^\*\d{2,2}(?:\d{2,2}(?:\d{2,2})?)?$/ );
$PREREQ_PM{$_} = $version unless ( defined $PREREQ_PM{$_} and $PREREQ_PM{$_} >= $version );
}
}
}
} while (! $proceed);
print "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ( $ASNMTAP_PLUGINS or $ASNMTAP_APPLICATIONS ) {
foreach my $prerequisite ( @prerequisites ) {
my ($feature, $default, $files) = ( @{$prerequisite}[1], @{$prerequisite}[4..5] );
if ( $default == 1 || $default == 2 ) {
if ( defined $files ) {
foreach ( @$files ) {
Makefile.PL view on Meta::CPAN
$destination .= '/.exists';
}
$PM{$file} = $destination;
}
}
}
}
}
print "\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ( $PERL_AUTOINSTALL ) {
my ($module, $version, $installed);
$module = 'Module::AutoInstall';
$version = '1.03';
$installed = eval ( "require $module; Exporter::require_version ( '$module', $version );" );
if ( $installed ) {
print "\nAutomatic install of dependencies via CPAN\n";
eval ( "
use Module::AutoInstall ( -config => { force => 1, do_once => 1 } );
Module::AutoInstall->install( [], %PREREQ_PM );
" );
print "\n";
} else {
print "\n$module required for automatic install of dependencies via CPAN\n";
print "\nperl -MCPAN -e 'install $module'\n\n";
}
}
# Ok, now it is time to really generate the Makefile - - - - - - - - - -
# my $ac = ExtUtils::Autoconf->new;
# $ac->configure;
WriteMakefile(
NAME => 'ASNMTAP',
applications/Applications.cnf view on Meta::CPAN
# ENABLED 1 # '0' or '1'
# </AWSTATS>
# <CHARTDIRECTOR>
# LIB /opt/ChartDirector/lib/.
# </CHARTDIRECTOR>
# <HTMLTOPDF>
# PRG htmldoc # '<nihil>' or 'htmldoc'
# HOW shell # '<nihil>', 'cgi' or 'shell'
# OPTIONS --bodyimage /opt/asnmtap/applications/htmlroot/img/logos/bodyimage.gif --charset iso-8859-1 --format pdf14 --size A4 --landscape --browserwidth 1280 --fontsize 8.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Helvetica --...
# OPTIONS --bodyimage /opt/asnmtap/applications/htmlroot/img/logos/bodyimage.gif --charset iso-8859-1 --format pdf14 --size A4 --landscape --browserwidth 1280 --top 10mm --bottom 10mm --left 10mm --right 10mm --fontsize 8.0 --fontspacing 1...
# </HTMLTOPDF>
# <PERFPARSE>
# BIN /opt/asnmtap/perfparse20/bin
# ETC /opt/asnmtap/perfparse20/etc
# LIB /opt/asnmtap/perfparse20/lib
# SHARE /opt/asnmtap/perfparse20/share
# CGI /perfparse20/perfparse.php
# ENABLED 1 # '0' or '1'
# VERSION 20 # '19' or '20'
applications/archive.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications qw(:APPLICATIONS :ARCHIVE :DBARCHIVE $SERVERTABLPLUGINS $SERVERTABLVIEWS $SERVERTABLDISPLAYDMNS $SERVERTABLCRONTABS $SERVERTABLCLLCTRDMNS $SERVERTABLSERVERS );
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($opt_A $opt_c $opt_r $opt_d $opt_y $opt_f $opt_D $opt_V $opt_h $PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "archive.pl";
my $prgtext = "Archiver 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 $doCgisess = 1; # default
my $doReports = 1; # default
my $doDatabase = 0; # default
my $doYearsAgo = -1; # default
my $doForce = 0; # default
my $debug = 0; # default
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,
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"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}; }
if ($opt_h) { print_help(); exit $ERRORS{OK}; }
if ($opt_A) { $archivelist = $1 if ($opt_A =~ /([-.A-Za-z0-9]+)/); }
if ($opt_c) {
if ($opt_c eq 'F' || $opt_c eq 'T') {
$doCgisess = ($opt_c eq 'F') ? 0 : 1;
} else {
usage("Invalid cgisess: $opt_c\n");
}
}
applications/archive.pl view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $logger = LOG_init_log4perl ( 'archive', undef, $debug );
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my @archivelisttable;
if ( $debug ) {
print "Current day : <", scalar(localtime($currentEpoch)), "><", $currentEpoch, ">\n";
print "Yesterday : <", scalar(localtime($yesterdayEpoch)), "><", $yesterdayEpoch, ">\n";
print "First day of yesterday week : <", scalar(localtime($firstDayOfWeekEpoch)), "><", $firstDayOfWeekEpoch, ">\n";
print "GZIP not debug files older then : <", scalar(localtime($gzipEpoch)), "><", $gzipEpoch, ">\n";
print "GZIP debug files older then : <", scalar(localtime($gzipDebugEpoch)), "><", $gzipDebugEpoch, ">\n";
print "Remove All/Nok files older then : <", scalar(localtime($removeAllNokEpoch)), "><", $removeAllNokEpoch, ">\n";
print "Remove GZIP files older then : <", scalar(localtime($removeGzipEpoch)), "><", $removeGzipEpoch, ">\n";
print "Remove Debug files older then : <", scalar(localtime($removeDebugEpoch)), "><", $removeDebugEpoch, ">\n";
print "Remove Week files older then : <", scalar(localtime($removeWeeksEpoch)), "><", $removeWeeksEpoch, ">\n";
print "Remove Cgisess files older then : <", scalar(localtime($removeCgisessEpoch)), "><", $removeCgisessEpoch, ">\n";
print "Remove Report files older then : <", scalar(localtime($removeReportsEpoch)), "><", $removeReportsEpoch, ">\n";
}
my ($emailReport, $rvOpen) = init_email_report (*EMAILREPORT, "archiverEmailReport.txt", $debug);
if ( $rvOpen ) {
@archivelisttable = read_table($prgtext, $archivelist, 0, $debug) if (defined $archivelist);
doBackupCsvSqlErrorWeekDebugReport ($RESULTSPATH, $DEBUGDIR, $REPORTDIR, $gzipEpoch, $removeAllNokEpoch, $removeGzipEpoch, $removeDebugEpoch, $removeReportsEpoch, $removeWeeksEpoch, $firstDayOfWeekEpoch, $yesterdayEpoch, $currentEpoch) if ($doRepor...
createCommentsAndEventsArchiveTables ( "-$doYearsAgo year" ) if ($doYearsAgo != -1);
if ($doDatabase) {
my $month = get_month ('today');
my $day = get_day ('today');
createCommentsAndEventsArchiveTables ( '+1 year' ) if ($month == 12 and $day >= 24);
archiveCommentsAndEventsTables ( '-14 days', '-1 year' );
}
removeCgisessFiles ($removeCgisessEpoch) if ($doCgisess);
my $emailreport = "\nRemove *-MySQL-sql-error.txt:\n-----------------------------\n";
if ( $debug ) { print "$emailreport"; } else { print EMAILREPORT "$emailreport"; }
my @sqlErrorTxtFiles = glob("$RESULTSPATH/*-MySQL-sql-error.txt");
foreach my $sqlErrorTxtFile (@sqlErrorTxtFiles) {
if ($debug) {
print "E- unlink <$sqlErrorTxtFile>\n";
} else {
print EMAILREPORT "E- unlink <$sqlErrorTxtFile>\n";
}
unlink ($sqlErrorTxtFile);
}
} 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);
if ($dbh and $rv) {
$year = get_year ($eventsAgo);
$month = get_month ($eventsAgo);
$day = get_day ($eventsAgo);
$timeslot = timelocal ( 0, 0, 0, $day, ($month-1), ($year-1900) );
if ($debug) {
$sql = "select SQL_NO_CACHE catalogID, id, endDate, startDate, timeslot, uKey from $SERVERTABLEVENTS force index (key_timeslot) where timeslot < '" .$timeslot. "'";
print "\nTable: '$SERVERTABLEVENTS', Year: '$year', Month: '$month', Day: '$day', Timeslot: '$timeslot', Date: " .scalar(localtime($timeslot)). "\n<$sql>\n";
} else {
$sql = "select SQL_NO_CACHE catalogID, id, endDate from $SERVERTABLEVENTS force index (key_timeslot) where timeslot < '" .$timeslot. "'";
print EMAILREPORT "\nTable: '$SERVERTABLEVENTS', Year: '$year', Month: '$month', Day: '$day', Timeslot: '$timeslot'\n";
}
$sth = $dbh->prepare($sql) or $rv = errorTrapDBI("dbh->prepare: $sql", $debug);
$rv = $sth->execute() or $rv = errorTrapDBI("sth->execute: $sql", $debug) if $rv;
if ( $rv ) {
while (my $ref = $sth->fetchrow_hashref()) {
($yearMOVE, $monthMOVE, undef) = split (/-/, $ref->{endDate});
print "\n", $ref->{catalogID}, " ", $ref->{id}, " ", $ref->{uKey}, " ", $ref->{startDate}, " ", $ref->{endDate}, " ",$ref->{timeslot}, " \n" if ($debug);
$sqlMOVE = 'REPLACE INTO `' .$SERVERTABLEVENTS. '_' .$yearMOVE. '_' .$monthMOVE. '` SELECT * FROM `' .$SERVERTABLEVENTS. '` WHERE catalogID = "' .$ref->{catalogID}. '" and id = "' .$ref->{id}. '"';
if ( $yearMOVE ne '0000' and $monthMOVE ne '00' ) {
print "$sqlMOVE\n" if ($debug);
$dbh->do( $sqlMOVE ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug) unless ( $debug );
if ( $rv ) {
$sqlMOVE = 'DELETE FROM `' .$SERVERTABLEVENTS. '` WHERE catalogID = "' .$ref->{catalogID}. '" and id = "' .$ref->{id}. '"';
print "$sqlMOVE\n" if ($debug);
$dbh->do( $sqlMOVE ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug) unless ( $debug );
}
} else {
if ($debug) {
print "DATABASE ERROR ... CRITICAL: Update table ${SERVERTABLEVENTS}_${yearMOVE}_${monthMOVE}' not possible for '$sqlMOVE'\n";
} else {
print EMAILREPORT "DATABASE ERROR ... CRITICAL: Update table ${SERVERTABLEVENTS}_${yearMOVE}_${monthMOVE}' not possible for '$sqlMOVE'\n";
}
}
}
$sth->finish() or $rv = errorTrapDBI("sth->finish", $debug);
}
$sql = "select SQL_NO_CACHE distinct $SERVERTABLCOMMENTS.catalogID, $SERVERTABLCOMMENTS.uKey, $SERVERTABLCOMMENTS.commentData from $SERVERTABLCOMMENTS, $SERVERTABLPLUGINS, $SERVERTABLVIEWS, $SERVERTABLDISPLAYDMNS, $SERVERTABLCRONTABS as crontabOu...
if ($debug) {
print "\nUpdate table '$SERVERTABLCOMMENTS': <$sql>\n";
} else {
print EMAILREPORT "\nUpdate table '$SERVERTABLCOMMENTS': <$sql>\n";
}
$sth = $dbh->prepare($sql) or $rv = errorTrapDBI("dbh->prepare: $sql", $debug);
$rv = $sth->execute() or $rv = errorTrapDBI("sth->execute: $sql", $debug) if $rv;
if ( $rv ) {
my ($localYear, $localMonth, $currentYear, $currentMonth, $currentDay, $currentHour, $currentMin, $currentSec) = ((localtime)[5], (localtime)[4], ((localtime)[5] + 1900), ((localtime)[4] + 1), (localtime)[3,2,1,0]);
my $solvedDate = "$currentYear-$currentMonth-$currentDay";
my $solvedTime = "$currentHour:$currentMin:$currentSec";
my $solvedTimeslot = timelocal($currentSec, $currentMin, $currentHour, $currentDay, $localMonth, $localYear);
while (my $ref = $sth->fetchrow_hashref()) {
$sqlUPDATE = 'UPDATE ' .$SERVERTABLCOMMENTS. ' SET replicationStatus="U", problemSolved="1", solvedDate="' .$solvedDate. '", solvedTime="' .$solvedTime. '", solvedTimeslot="' .$solvedTimeslot. '", commentData="' .$ref->{commentData}. '<br>AUT...
print "$sqlUPDATE;\n" if ($debug);
$dbh->do( $sqlUPDATE ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug) unless ( $debug );
}
$sth->finish() or $rv = errorTrapDBI("sth->finish", $debug);
}
$year = get_year ($commentsAgo);
$month = get_month ($commentsAgo);
$day = get_day ($commentsAgo);
$timeslot = timelocal ( 0, 0, 0, $day, ($month-1), ($year-1900) );
$sql = "select SQL_NO_CACHE catalogID, id, solvedDate, solvedTimeslot, uKey from $SERVERTABLCOMMENTS force index (solvedTimeslot) where problemSolved = '1' and solvedTimeslot < '" .$timeslot. "'";
if ($debug) {
print "\nTable: '$SERVERTABLCOMMENTS', Year: '$year', Month: '$month', Day: '$day', Timeslot: '$timeslot', Date: " .scalar(localtime($timeslot)). "\n<$sql>\n";
} else {
print EMAILREPORT "\nTable: '$SERVERTABLCOMMENTS', Year: '$year', Month: '$month', Day: '$day', Timeslot: '$timeslot'\n";
}
$sth = $dbh->prepare($sql) or $rv = errorTrapDBI("dbh->prepare: $sql", $debug);
$rv = $sth->execute() or $rv = errorTrapDBI("sth->execute: $sql", $debug) if $rv;
if ( $rv ) {
while (my $ref = $sth->fetchrow_hashref()) {
($yearMOVE, undef, undef) = split (/-/, $ref->{solvedDate});
print "\n", $ref->{catalogID}, " ", $ref->{id}, " ", $ref->{uKey}, " ", $ref->{solvedDate}, " ", $ref->{solvedTimeslot}, "\n" if ($debug);
$sqlMOVE = 'REPLACE INTO `' .$SERVERTABLCOMMENTS. '_' .$yearMOVE. '` SELECT * FROM `' .$SERVERTABLCOMMENTS. '` WHERE catalogID = "' .$ref->{catalogID}. '" and id = "' .$ref->{id}. '"';
if ( $yearMOVE ne '0000' ) {
print "$sqlMOVE\n" if ($debug);
$dbh->do( $sqlMOVE ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug) unless ( $debug );
if ( $rv ) {
$sqlMOVE = 'DELETE FROM `' .$SERVERTABLCOMMENTS. '` WHERE catalogID = "' .$ref->{catalogID}. '" and id = "' .$ref->{id}. '"';
print "$sqlMOVE\n" if ($debug);
$dbh->do( $sqlMOVE ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug) unless ( $debug );
}
} else {
if ($debug) {
print "DATABASE ERROR ... CRITICAL: Update table ${SERVERTABLCOMMENTS}_${yearMOVE}' not possible for '$sqlMOVE'\n";
} else {
print EMAILREPORT "DATABASE ERROR ... CRITICAL: Update table ${SERVERTABLCOMMENTS}_${yearMOVE}' not possible for '$sqlMOVE'\n";
}
}
}
$sth->finish() or $rv = errorTrapDBI("sth->finish", $debug);
}
# cleanup automatically scheduled donwtimes when sheduled OFFLINE
my ($localYear, $localMonth, $currentYear, $currentMonth, $currentDay, $currentHour, $currentMin, $currentSec) = ((localtime)[5], (localtime)[4], ((localtime)[5] + 1900), ((localtime)[4] + 1), (localtime)[3,2,1,0]);
my $solvedDate = "$currentYear-$currentMonth-$currentDay";
my $solvedTime = "$currentHour:$currentMin:$currentSec";
my $solvedTimeslot = timelocal($currentSec, $currentMin, $currentHour, $currentDay, $localMonth, $localYear);
my $sqlUPDATE = 'UPDATE ' .$SERVERTABLCOMMENTS. ' SET replicationStatus="U", problemSolved="1", solvedDate="' .$solvedDate. '", solvedTime="' .$solvedTime. '", solvedTimeslot="' .$solvedTimeslot. '" where catalogID="'. $CATALOGID. '" and problemS...
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;
if ( $rv ) {
while (my $ref = $sth->fetchrow_hashref()) {
$Table = $ref->{Table};
$Op = $ref->{Op};
$Msg_type = $ref->{Msg_type};
$Msg_text = $ref->{Msg_text};
print "<- <$Table>, <$Op>, <$Msg_type>, <$Msg_text>\n" if ($debug);
}
$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);
if ($dbh and $rv) {
foreach $month ('01'..'12') {
$sql = 'CREATE TABLE IF NOT EXISTS `'. $SERVERTABLEVENTS .'_'. $year .'_'. $month .'` LIKE `'. $SERVERTABLEVENTS .'`';
$rv = ! checkTableDBI ($dbh, $DATABASE, $SERVERTABLEVENTS .'_'. $year .'_'. $month, 'check', 'status', 'OK');
if ($rv) {
if ($debug) {
print "\nTable: '$SERVERTABLEVENTS', Year: '$year', Month: '$month'\n<$sql>\n";
} else {
print EMAILREPORT "\nTable: '$SERVERTABLEVENTS', Year: '$year', Month: '$month', Status: ";
$dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
$rv = checkTableDBI ($dbh, $DATABASE, $SERVERTABLEVENTS .'_'. $year .'_'. $month, 'check', 'status', 'OK');
if ($rv) { print EMAILREPORT "Created\n"; } else { print EMAILREPORT "NOT CREATED, PLEASE VERIFY\n"; }
}
} else {
$rv = 1;
print "Table: '$SERVERTABLEVENTS', Year: '$year', Month: '$month', Status: ALREADY CREATED\n" if ($debug);
}
if ( $SERVERMYSQLMERGE eq '1' ) {
if ($debug) {
print "Table: '$SERVERTABLEVENTS', Year: '$year', Month: '$month', Status: ENGINE\n";
} else {
print EMAILREPORT "Table: '$SERVERTABLEVENTS', Year: '$year', Month: '$month', Status: ENGINE\n";
$sql = sprintf ("ALTER TABLE `%s_%s_%02d` ENGINE = MyISAM", $SERVERTABLEVENTS, $year, $month);
$dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
if ($rv) { print EMAILREPORT "ENGINE = MyISAM\n\n"; } else { print EMAILREPORT "NOT ENGINE = MyISAM, PLEASE VERIFY '$sql'\n\n"; }
}
}
}
if ( $SERVERMYSQLMERGE eq '1' ) {
if ($debug) {
print "\nTable: '$SERVERTABLEVENTS', Year: '$year', Status: MERGE\n";
} else {
print EMAILREPORT "\nTable: '$SERVERTABLEVENTS', Year: '$year', Status: MERGE\n";
$sql = 'DROP TABLE IF EXISTS `'. $SERVERTABLEVENTS .'_'. $year .'`';
$dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
if ($rv) {
$sql = 'CREATE TABLE IF NOT EXISTS `'. $SERVERTABLEVENTS .'_'. $year .'` LIKE `'. $SERVERTABLEVENTS .'_'. $year .'_01`';
$dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
}
if ($rv) {
$sql = 'ALTER TABLE `'. $SERVERTABLEVENTS .'_'. $year .'` ENGINE=MERGE UNION=(`'. $SERVERTABLEVENTS .'_'. $year .'_01`, `'. $SERVERTABLEVENTS .'_'. $year .'_02`, `'. $SERVERTABLEVENTS .'_'. $year .'_03`, `'. $SERVERTABLEVENTS .'_'. $year .'...
$dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
}
if ($rv) { print EMAILREPORT "MERGED\n\n"; } else { print EMAILREPORT "NOT MERGED, PLEASE VERIFY '$sql'\n\n"; }
}
foreach my $quarter (1..4) {
if ($debug) {
print "\nTable: '$SERVERTABLEVENTS', Year: '$year' Quarter: 'Q$quarter', Status: MERGE\n";
} else {
print EMAILREPORT "\nTable: '$SERVERTABLEVENTS', Year: '$year' Quarter: 'Q$quarter', Status: MERGE\n";
$sql = 'DROP TABLE IF EXISTS `'. $SERVERTABLEVENTS .'_'. $year .'_Q'. $quarter .'`';
$dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
if ($rv) {
$sql = 'CREATE TABLE IF NOT EXISTS `'. $SERVERTABLEVENTS .'_'. $year .'_Q'. $quarter .'` LIKE `'. $SERVERTABLEVENTS .'_'. $year .'_'. sprintf ("%02d", ($quarter * 3 ) - 2) .'`';
$dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
}
if ($rv) {
$sql = 'ALTER TABLE `'. $SERVERTABLEVENTS .'_'. $year .'_Q'. $quarter .'` ENGINE=MERGE UNION=(`'. $SERVERTABLEVENTS .'_'. $year .'_'. sprintf ("%02d", ($quarter * 3 ) - 2) .'`, `'. $SERVERTABLEVENTS .'_'. $year .'_'. sprintf ("%02d", ($qu...
$dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
}
if ($rv) { print EMAILREPORT "MERGED\n\n"; } else { print EMAILREPORT "NOT MERGED, PLEASE VERIFY '$sql'\n\n"; }
}
}
}
$sql = "CREATE TABLE IF NOT EXISTS `". $SERVERTABLCOMMENTS .'_'. $year ."` LIKE `$SERVERTABLCOMMENTS`";
$rv = ! checkTableDBI ($dbh, $DATABASE, $SERVERTABLCOMMENTS .'_'. $year, 'check', 'status', 'OK');
if ($rv) {
if ($debug) {
print "\nTable: '$SERVERTABLCOMMENTS', Year: '$year'\n<$sql>\n";
} else {
print EMAILREPORT "\nTable: '$SERVERTABLCOMMENTS', Year: '$year', Status: ";
$dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
$rv = checkTableDBI ($dbh, $DATABASE, $SERVERTABLCOMMENTS .'_'. $year, 'check', 'status', 'OK');
if ($rv) { print EMAILREPORT "Created\n\n"; } else { print EMAILREPORT "NOT CREATED, PLEASE VERIFY\n\n"; }
}
} 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);
$path = $RESULTSPATH .'/'. $pagedir;
$debugPath = $path .'/'. $DEBUGDIR;
$reportPath = $path .'/'. $REPORTDIR;
if ($debug) {
print "\n", "<$RESULTSPATH><$pagedir><$path><$DEBUGDIR><$REPORTDIR>\n"
} else {
print EMAILREPORT "\nPlugin: '$ttest', results directory: '$path'\n";
}
$rvOpendir = opendir(DIR, $path);
if ($rvOpendir) {
@files = readdir(DIR);
closedir(DIR);
}
if (-e $debugPath) {
$rvOpendir = opendir(DIR, $debugPath);
if ($rvOpendir) {
while ($debugFilename = readdir(DIR)) {
print "Debug Filename: <$debugFilename>\n" if ($debug >= 2);
gzipOrRemoveHttpDumpDebug ($gzipDebugEpoch, $removeDebugEpoch, $debugPath, $debugFilename);
}
closedir(DIR);
}
}
if (-e $reportPath) {
$rvOpendir = opendir(DIR, $reportPath);
if ($rvOpendir) {
while ($reportFilename = readdir(DIR)) {
print "Report Filename: <$reportFilename>\n" if ($debug >= 2);
removeOldReportFiles ($removeReportsEpoch, $removeGzipEpoch, $reportPath, $reportFilename);
}
closedir(DIR);
}
}
foreach $dtest (@stest) {
my ($catalogID_uKey, $test) = split(/\#/, $dtest);
($command, undef) = split(/\.pl/, $test);
applications/archive.pl view on Meta::CPAN
unless ( defined $uKey ) {
$uKey = $catalogID;
$catalogID = $CATALOGID;
$catalogID_uKey = $catalogID .'_'. $uKey unless ( $catalogID eq 'CID' );
}
my ( $tWeek, $tYear ) = get_week('yesterday');
$weekFilename = get_year('yesterday') ."w$tWeek-$command-$catalogID_uKey-csv-week.txt";
if (-e "$path/$weekFilename") { unlink ($path.'/'.$weekFilename); }
print "Test : <$dtest>\n" if ($debug);
foreach $filename (@files) {
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 {
print EMAILREPORT "A- <$datum><", get_yearMonthDay($removeAllNokEpoch), "> unlink <$path><$filename>\n";
unlink ($path.'/'.$filename);
}
}
} elsif ( $staart eq "$command-$catalogID_uKey-csv.txt" ) {
if ($datum le get_yearMonthDay($gzipEpoch)) {
if ($debug) {
print "C+ <$datum><", get_yearMonthDay($gzipEpoch), "><$path><$filename>\n";
} else {
print EMAILREPORT "C+ <$datum><", get_yearMonthDay($gzipEpoch), "> gzip <$path><$filename>\n";
my ($status, $stdout, $stderr) = call_system ('gzip --force '.$path.'/'.$filename, $debug);
print EMAILREPORT "C+ E R R O R: <$stderr>\n" unless ( $status );
}
}
} elsif ( $staart eq "$command-$catalogID_uKey-csv.txt.gz" ) {
if ($datum le get_yearMonthDay($removeGzipEpoch)) {
if ($debug) {
print "C- <$datum><", get_yearMonthDay($removeGzipEpoch), "><$path><$filename>\n";
} else {
print EMAILREPORT "C- <$datum><", get_yearMonthDay($removeGzipEpoch), "> unlink <$path><$filename>\n";
unlink ($path.'/'.$filename);
}
}
} elsif ( $staart eq "$command-$catalogID_uKey-csv-week.txt" ) {
my ($jaar, $week) = split(/w/, $datum);
my $jaarWeekFilename = int($jaar.$week);
my ( $tWeek, $tYear ) = get_week ('yesterday');
my $jaarWeekYesterday = int(get_year('yesterday'). $tWeek);
if ( $jaarWeekFilename lt $jaarWeekYesterday ) {
if ($debug) {
print "CW+<$jaarWeekYesterday><$jaarWeekFilename><$path><$filename>\n";
} else {
print EMAILREPORT "CW+<$jaarWeekYesterday><$jaarWeekFilename> gzip <$path><$filename>\n";
my ($status, $stdout, $stderr) = call_system ('gzip --force '.$path.'/'.$filename, $debug);
print EMAILREPORT "CW+ E R R O R: <$stderr>\n" unless ( $status );
}
}
} elsif ( $staart eq "$command-$catalogID_uKey-csv-week.txt.gz" ) {
my ($jaar, $week) = split(/w/, $datum);
my $jaarWeekFilename = int($jaar.$week);
my ( $tWeek, $tYear ) = get_week ('-'. $removeGzipWeeksAgo. ' weeks');
my $jaarWeekRemove = int(get_year('-'. $removeGzipWeeksAgo. ' weeks') .$tWeek);
if ( $jaarWeekFilename le $jaarWeekRemove ) {
if ($debug) {
print "CW-<$jaarWeekRemove><$jaarWeekFilename><", get_yearMonthDay($removeWeeksEpoch), "<$path><$filename>\n";
} else {
print EMAILREPORT "CW-<$jaarWeekRemove><$jaarWeekFilename><", get_yearMonthDay($removeWeeksEpoch), " unlink <$path><$filename>\n";
unlink ($path.'/'.$filename);
}
}
} elsif ( $staart eq "$command-$catalogID_uKey.sql" ) {
if ($debug) {
print "S+ <$datum><", get_yearMonthDay($gzipEpoch), "><$path><$filename>\n" if ($datum le get_yearMonthDay($gzipEpoch));
} elsif (! $doDatabase) {
# APE # TODO - REMOVE
# Init parameters
# my ($rv, $dbh, $sql);
# open connection to database and query data
# $rv = 1;
# $dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = errorTrapDBI("Cannot connect to the database", $debug);
# if ($dbh and $rv) {
# $sql = "LOAD DATA LOW_PRIORITY LOCAL INFILE '$path/$filename' INTO TABLE $SERVERTABLEVENTS FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\\n'";
# $dbh->do( $sql ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug);
# if ( $rv ) {
# my $mysqlInfo = $dbh->{mysql_info};
# my ($records, $deleted, $skipped, $warnings) = ($mysqlInfo =~ /^Records:\s+(\d+)\s+Deleted:\s+(\d+)\s+Skipped:\s+(\d+)\s+Warnings: (\d+)$/);
# if ($deleted eq '0' and $skipped eq '0' and $warnings eq '0') {
# print EMAILREPORT "S+ LOAD DATA ... : $records record(s) added for $filename\n";
# my ($status, $stdout, $stderr) = call_system ('gzip --force '.$path.'/'.$filename, $debug);
# print EMAILREPORT "S+ E R R O R: <$stderr>\n" unless ( $status );
# } else {
# print EMAILREPORT "S+ LOAD DATA ... WARNING for $filename: $mysqlInfo, <$records> <$deleted> <$skipped> <$warnings>\n";
# rename("$path/$filename", "$path/$filename-LOAD-DATA-FAILED");
# }
# }
# $dbh->disconnect or $rv = errorTrapDBI("Sorry, the database was unable to add your entry.", $debug);
# }
my $_debug = ( ( $debug eq 'T' ) ? 1 : 0);
my $dbh = CSV_prepare_table ("$path/", $filename, '', $SERVERTABLEVENTS, \@EVENTS, \%EVENTS, \$logger, $_debug);
my $rv = CSV_import_from_table (1, $dbh, $SERVERTABLEVENTS, \@EVENTS, 'id', $doForce, \$logger, $_debug);
if ( $rv ) {
if ($debug) {
print "S+ IMPORT CSV DATA ... OK: ALL records imported from $path/$filename\n";
} else {
print EMAILREPORT "S+ IMPORT CSV DATA ... OK: ALL records imported from $path/$filename\n";
my ($status, $stdout, $stderr) = call_system ('gzip --force '.$path.'/'.$filename, $debug);
print EMAILREPORT "S+ E R R O R: <$stderr>\n" unless ( $status );
}
} else {
if ($debug) {
print "S- IMPORT CSV DATA ... CRITICAL: ZERO records imported from $path/$filename\n";
} else {
print EMAILREPORT "S- IMPORT CSV DATA ... CRITICAL: ZERO records imported from $path/$filename\n";
rename("$path/$filename", "$path/$filename-LOAD-DATA-FAILED");
}
}
CSV_cleanup_table ($dbh, \$logger, $_debug);
}
} elsif ( $staart eq "$command-$catalogID_uKey.sql.gz" ) {
if ($datum le get_yearMonthDay($removeGzipEpoch)) {
if ($debug) {
print "S- <$datum><", get_yearMonthDay($removeGzipEpoch), "><$path><$filename>\n";
} else {
print EMAILREPORT "S- <$datum><", get_yearMonthDay($removeGzipEpoch), "> unlink <$path><$filename>\n";
unlink ($path.'/'.$filename);
}
}
} elsif ( $staart eq "$command-$catalogID_uKey-sql-error.txt" ) {
if ($datum le get_yearMonthDay($removeGzipEpoch)) {
if ($debug) {
print "SE-<$datum><", get_yearMonthDay($removeDebugEpoch), "><$path><$filename>\n";
} else {
print EMAILREPORT "SE-<$datum><", get_yearMonthDay($removeDebugEpoch), "> unlink <$path><$filename>\n";
unlink ($path.'/'.$filename);
}
}
} elsif ( $staart eq "nok.txt" ) {
if ($datum le get_yearMonthDay($removeAllNokEpoch)) {
if ($debug) {
print "N- <$datum><", get_yearMonthDay($removeAllNokEpoch), "><$path><$filename>\n";
} else {
print EMAILREPORT "N- <$datum><", get_yearMonthDay($removeAllNokEpoch), "> unlink <$path><$filename>\n";
unlink ($path.'/'.$filename);
}
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub catAllCsvFilesYesterdayWeek {
applications/archive.pl view on Meta::CPAN
if ($rvOpen) {
$rvOpen = open(CSV, "$path/$filename");
if ($rvOpen) {
while (<CSV>) {
chomp;
unless ( /^#/ ) {
my $dummy = $_;
$dummy =~ s/\ {1,}//g;
if ($dummy ne '') { print CAT $_, "\n"; }
}
}
close(CSV);
my ( $tWeek, $tYear ) = get_week ('yesterday');
print "WF <week$tWeek><$filename>\nW <$path/$weekFilename>\n" if ($debug);
} else {
print "Cannot open $filename!\n";
}
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 );
}
}
} elsif ( $extentie eq 'htm.gz' ) {
if ($datum le get_yearMonthDay($removeDebugEpoch)) {
if ($debug) {
print "HT-<$datum><".get_yearMonthDay($removeDebugEpoch)."><$debugPath><$debugFilename>\n";
} else {
print EMAILREPORT "HT-<$datum><".get_yearMonthDay($removeDebugEpoch)."> unlink <$debugPath><$debugFilename>\n";
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);
print "Filename : <$cgisessFilename><$sessionID>\n" if ($debug >= 2);
my ($sessionExists, %session) = get_session_param ($sessionID, $CGISESSPATH, $cgisessFilename, $debug);
if ( $sessionExists ) {
if (defined $session{ASNMTAP}) {
if ($session{ASNMTAP} eq 'LEXY') {
print " : <$removeCgisessEpoch><" .$session{_SESSION_CTIME}. ">\n" if ($debug >= 2);
if ($removeCgisessEpoch > $session{_SESSION_CTIME}) {
if ($debug) {
print "CS <$cgisessPathFilename><" .$session{_SESSION_CTIME}. ">\n";
} else {
print EMAILREPORT "CS unlink <$cgisessPathFilename><" .$session{_SESSION_CTIME}. ">\n";
my ($status, $stdout, $stderr) = call_system ('rm -f '.$cgisessPathFilename, $debug); # unlink ($cgisessPathFilename);
}
} else {
print "CS-<$cgisessPathFilename><$removeCgisessEpoch><" .$session{_SESSION_CTIME}. ">\n" if ($debug >= 2);
}
} else {
print "CS-<$cgisessPathFilename> ASNMTAP not LEXY>\n" if ($debug >= 2);
}
} else {
if ($removeCgisessEpoch > $session{_SESSION_CTIME}) {
if ($debug) {
print "CS <$cgisessPathFilename><" .$session{_SESSION_CTIME}. ">\n";
} else {
print EMAILREPORT "CS unlink <$cgisessPathFilename><" .$session{_SESSION_CTIME}. ">\n";
unlink ($cgisessPathFilename);
}
} 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+$/) {
if ($datum le get_yearMonthDay($removeGzipEpoch)) {
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);
}
}
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
T(true) : remove backup Csv, Sql, Error, Week, Debug reports (default)
-d, --database=F|T
applications/bin/generateCollectorDaemonSchedulingReports.pl view on Meta::CPAN
);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($opt_V $opt_h $opt_D $PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "generateCollectorDaemonSchedulingReports.pl";
my $prgtext = "Generate Collector Daemon Scheduling Reports 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 $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
);
if ($opt_V) { print_revision($PROGNAME, $version); exit $ERRORS{OK}; }
if ($opt_h) { print_help(); exit $ERRORS{OK}; }
if ($opt_D) {
if ($opt_D eq 'F' || $opt_D eq 'T' || $opt_D eq 'L') {
$debug = 0 if ($opt_D eq 'F');
$debug = 1 if ($opt_D eq 'T');
$debug = 2 if ($opt_D eq 'L');
} else {
usage("Invalid debug: $opt_D\n");
}
}
applications/bin/generateCollectorDaemonSchedulingReports.pl view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $sqlPeriode = 3600;
my $width = 1000;
my $xOffset = 300;
my $yOffset = 42;
my $labelOffset = 32;
my $AreaBOffset = 78;
my $hightMin = 195;
my $currentTimeslot = 0;
my $printerFriendlyOutput = 0;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($emailReport, $rvOpen) = init_email_report (*EMAILREPORT, "generateCollectorDaemonSchedulingReports.txt", $debug);
create_dir ($RESULTSPATH);
my $emailMessage = "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/bin/generateCollectorDaemonSchedulingReports.pl view on Meta::CPAN
$urlAccessParameters = "htmlToPdf=1";
$urlAccessParameters .= "&catalogID=$CATALOGID";
$urlAccessParameters .= "&sqlPeriode=$sqlPeriode";
$urlAccessParameters .= "&width=$width";
$urlAccessParameters .= "&xOffset=$xOffset";
$urlAccessParameters .= "&yOffset=$yOffset";
$urlAccessParameters .= "&labelOffset=$labelOffset";
$urlAccessParameters .= "&AreaBOffset=$AreaBOffset";
$urlAccessParameters .= "&hightMin=$hightMin";
$urlAccessParameters .= "¤tTimeslot=on" if ($currentTimeslot);
$urlAccessParameters .= "&pf=on" if ($printerFriendlyOutput);
my $logging = $RESULTSPATH .'/_ASNMTAP';
create_dir ($logging);
my $reports = $logging .'/'. $REPORTDIR;
create_dir ($reports);
$logging .= "/";
create_header ($logging."HEADER.html");
create_footer ($logging."FOOTER.html");
applications/bin/generateCollectorDaemonSchedulingReports.pl view on Meta::CPAN
unless ( $status == 0 and $stdout eq '' and $stderr eq '' ) {
$emailMessage .= $pdfFilename. " generation failed\n";
$emailMessage .= "call_system: command: $command, status: $status, stdout: $stdout, stderr: $stderr\n" if ( $debug );
} else {
$emailMessage .= $pdfFilename. " generated\n";
}
}
$emailMessage .= "\n";
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
applications/bin/generateReports.pl view on Meta::CPAN
$SERVERTABLENVIRONMENT $SERVERTABLPLUGINS $SERVERTABLREPORTS);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($opt_y $opt_m $opt_d $opt_a $opt_u $opt_V $opt_h $opt_D $PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "generateReports.pl";
my $prgtext = "Generate Reports 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 $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,
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"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}; }
if ($opt_h) { print_help(); exit $ERRORS{OK}; }
if ($opt_D) {
if ($opt_D eq 'F' || $opt_D eq 'T' || $opt_D eq 'L') {
$debug = 0 if ($opt_D eq 'F');
$debug = 1 if ($opt_D eq 'T');
$debug = 2 if ($opt_D eq 'L');
} else {
usage("Invalid debug: $opt_D\n");
}
}
applications/bin/generateReports.pl view on Meta::CPAN
# Last day of the year - - - - - - - - - - - - - - - - - - - - - - - - -
my $yearReportYear = 0;
if ($dayReportMonth == 12 and $dayReportDay == 31) {
$yearReportYear = $currentYear - 1;
$emailMessage .= "Report Yearly : for the year $yearReportYear\n";
$urlAccessParametersYear = "inputType=year&year=$yearReportYear";
}
if ( $debug ) { print $emailMessage; } else { print EMAILREPORT $emailMessage; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Init parameters
my ($rv, $dbh, $sth, $sql);
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADONLY:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY" ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot connect to the database", \$logger, $debug);
if ($dbh and $rv) {
my ($id, $catalogID, $uKey, $reportTitle, $periode, $status, $errorDetails, $bar, $hourlyAverage, $dailyAverage, $showDetails, $showComments, $showPerfdata, $showTop20SlowTests, $printerFriendlyOutput, $formatOutput, $userPassword, $timeperiodID,...
$sql = "select id, $SERVERTABLREPORTS.catalogID, $SERVERTABLREPORTS.uKey, concat( LTRIM(SUBSTRING_INDEX($SERVERTABLPLUGINS.title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ), periode, status, errorDetails, bar, hourlyAverage, dailyAverag...
$sth = $dbh->prepare( $sql ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot dbh->prepare: $sql", \$logger, $debug);
$sth->execute() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->execute: $sql", \$logger, $debug) if $rv;
$sth->bind_columns( \$id, \$catalogID, \$uKey, \$reportTitle, \$periode, \$status, \$errorDetails, \$bar, \$hourlyAverage, \$dailyAverage, \$showDetails, \$showComments, \$showPerfdata, \$showTop20SlowTests, \$printerFriendlyOutput, \$formatOutpu...
my @commands = (); my @pdfFilenames = ();
if ( $rv ) {
if ( $sth->rows ) {
while( $sth->fetch() ) {
$emailMessage = ($debug >= 2) ? "--> $id, $catalogID, $uKey, $reportTitle, $periode, $status, $errorDetails, $bar, $hourlyAverage, $dailyAverage, $showDetails, $showComments, $showPerfdata, $showTop20SlowTests, $printerFriendlyOutput, $form...
my ($urlAccessParameters, $periodeMessage);
if ($periode eq 'D') {
$periodeMessage = "Day_$arrayDays[$dayReportDayOfWeek]";
$emailMessage .= " -> Daily\n" if ($debug >= 2);
$urlAccessParameters = $urlAccessParametersDay if (defined $urlAccessParametersDay);
} elsif ($periode eq 'W') {
$periodeMessage = "Week_$weekReportWeek";
$emailMessage .= " -> Weekly\n" if ($debug >= 2);
$urlAccessParameters = $urlAccessParametersWeek if (defined $urlAccessParametersWeek);
applications/bin/generateReports.pl view on Meta::CPAN
$urlAccessParameters .= "&statuspie=on" if($status);
$urlAccessParameters .= "&errorpie=on" if($errorDetails);
$urlAccessParameters .= "&bar=on" if($bar);
$urlAccessParameters .= "&hourlyAvg=on" if($hourlyAverage);
$urlAccessParameters .= "&dailyAvg=on" if($dailyAverage);
$urlAccessParameters .= "&timeperiodID=$timeperiodID";
$urlAccessParameters .= "&details=on" if($showDetails);
$urlAccessParameters .= "&comments=on" if($showComments);
$urlAccessParameters .= "&perfdata=on" if($showPerfdata);
$urlAccessParameters .= "&topx=on" if($showTop20SlowTests);
$urlAccessParameters .= "&pf=on" if($printerFriendlyOutput);
$sql = "select test, resultsdir from $SERVERTABLPLUGINS where catalogID = '$catalogID' and ukey = '$uKey' order by uKey";
my $sth = $dbh->prepare( $sql ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot dbh->prepare: $sql", \$logger, $debug);
$sth->execute() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->execute: $sql", \$logger, $debug) if $rv;
if ( $rv ) {
($test, $resultsdir) = $sth->fetchrow_array() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->execute: $sql", \$logger, $debug) if $rv;
$sth->finish() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->execute: $sql", \$logger, $debug);
}
applications/bin/generateReports.pl view on Meta::CPAN
if ( -e "$pdfFilename" ) {
$emailMessage .= " > $pdfFilename already generated\n";
} else {
$emailMessage .= " > $pdfFilename will be generated\n";
push (@commands, $command);
push (@pdfFilenames, $pdfFilename);
}
}
if ( $debug ) { print $emailMessage; } else { print EMAILREPORT $emailMessage; }
}
}
$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 $teller = 0;
$emailMessage .= "\n";
applications/bin/generateReports.pl view on Meta::CPAN
unless ( $status == 0 and $stdout eq '' and $stderr eq '' ) {
$emailMessage .= $pdfFilenames[$teller]. " generation failed\n";
$emailMessage .= "call_system: command: $command, status: $status, stdout: $stdout, stderr: $stderr\n" if ( $debug );
} else {
$emailMessage .= $pdfFilenames[$teller]. " generated\n";
}
$teller++;
}
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 [-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
applications/bin/holidayBundleSetDowntimes.pl view on Meta::CPAN
$SERVERTABLCOMMENTS $SERVERTABLENVIRONMENT $SERVERTABLHOLIDYSBNDL $SERVERTABLHOLIDYS $SERVERTABLPLUGINS $SERVERTABLUSERS);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($opt_V $opt_h $opt_D $PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "holidayBundleSetDowntimes.pl";
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}; }
if ($opt_h) { print_help(); exit $ERRORS{OK}; }
if ($opt_D) {
if ($opt_D eq 'F' || $opt_D eq 'T' || $opt_D eq 'L') {
$debug = 0 if ($opt_D eq 'F');
$debug = 1 if ($opt_D eq 'T');
$debug = 2 if ($opt_D eq 'L');
} else {
usage("Invalid debug: $opt_D\n");
}
}
applications/bin/holidayBundleSetDowntimes.pl view on Meta::CPAN
$sth = $dbh->prepare( $sql ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot dbh->prepare: $sql", \$logger, $debug);
$sth->execute() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->execute: $sql", \$logger, $debug) if $rv;
$sth->bind_columns( \$catalogID, \$holidayBundleID, \$holidayBundleName, \$holidayID ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->bind_columns: $sql", \$logger, $debug) if $rv;
if ( $rv ) {
if ( $sth->rows ) {
my %holidayBundleApplications;
my ($localYear, $localMonth, $currentYear, $currentMonth, $currentDay, $currentHour, $currentMin, $currentSec) = ((localtime)[5], (localtime)[4], ((localtime)[5] + 1900), ((localtime)[4] + 1), (localtime)[3,2,1,0]);
my ($daysBeforeYear, $daysBeforeMonth, $daysBeforeDay) = Add_Delta_Days ($currentYear, $currentMonth, $currentDay, $daysBefore);
print "Current date: $currentYear/$currentMonth/$currentDay, Days before: $daysBefore, $daysBeforeYear/$daysBeforeMonth/$daysBeforeDay\n" if ($debug);
my $entryDate = "$currentYear-$currentMonth-$currentDay";
my $entryTime = "$currentHour:$currentMin:$currentSec";
my $entryTimeslot = timelocal($currentSec, $currentMin, $currentHour, $currentDay, $localMonth, $localYear);
while( $sth->fetch() ) {
print "--> $catalogID, $holidayBundleID, $holidayBundleName, $holidayID\n" if ($debug);
if ($holidayID ne '') {
chop $holidayID;
my (undef, @holidayID) = split (/\//, $holidayID);
foreach my $holidayID (@holidayID) {
my $holidayYear;
my ($holidayFormule, $holidayMonth, $holidayDay, $holidayOffset, undef) = split (/-/, $holidayID);
print " $holidayID, $holidayFormule, $holidayMonth, $holidayDay, $holidayOffset" if ($debug >= 2);
if ($holidayFormule == 0) {
$holidayYear = ($currentMonth == 12 and $currentDay > (31 - $daysBefore) and $holidayMonth == 1 and $holidayDay <= $daysBeforeDay) ? $daysBeforeYear : $currentYear;
print ", Fixed day: $holidayMonth/$holidayDay, " if ($debug >= 2);
} elsif ($holidayFormule == 1) {
print ", Easter offset: $holidayOffset, " if ($debug >= 2);
($holidayYear, $holidayMonth, $holidayDay) = Add_Delta_Days(Easter_Sunday($daysBeforeYear), $holidayOffset);
} else {
if ($debug) {
print ", ERROR: wrong formule\n";
} else {
print EMAILREPORT "$holidayBundleID, $holidayBundleName, $holidayID, ERROR: wrong formule\n";
}
}
if (defined $holidayYear) {
my $alert;
my $holidayDayOfWeek = Day_of_Week ($holidayYear, $holidayMonth, $holidayDay);
if ($holidayDayOfWeek >= 6) { # zaterdag of zondag
print "6-7: $holidayDayOfWeek, " if ($debug >= 2);
} else {
print "1-5: $holidayDayOfWeek, " if ($debug >= 2);
my $deltaDays = Delta_Days ($holidayYear, $holidayMonth, $holidayDay, $daysBeforeYear, $daysBeforeMonth, $daysBeforeDay);
print "Delta Days: $deltaDays, " if ($debug >= 2);
if ($deltaDays >= 0 and $deltaDays <= $daysBefore) {
my ($holiday, $uKey, $title, $environment, $pagedirs, $commentData, $activationTimeslot, $suspentionTimeslot);
my $sql = "select holiday from $SERVERTABLHOLIDYS where catalogID = '$CATALOGID' and holidayID = '$holidayID'";
my $sth = $dbh->prepare( $sql ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot dbh->prepare: $sql", \$logger, $debug);
$sth->execute() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->execute: $sql", \$logger, $debug) if $rv;
if ( $rv ) {
($holiday) = $sth->fetchrow_array() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->execute: $sql", \$logger, $debug) if $rv;
applications/bin/holidayBundleSetDowntimes.pl view on Meta::CPAN
$alert .= "\n" if ($debug);
}
}
$sth->finish() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->finish: $sql", \$logger, $debug);
}
}
}
print "holiday: $holidayYear/$holidayMonth/$holidayDay\n" if ($debug >= 2);
print " -> $holidayBundleID, $holidayBundleName, $holidayYear/$holidayMonth/$holidayDay\n$alert" if (defined $alert and $debug);
}
}
}
}
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
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
$SERVERTABLCATALOG $SERVERTABLCLLCTRDMNS $SERVERTABLCOMMENTS $SERVERTABLCRONTABS $SERVERTABLDISPLAYDMNS $SERVERTABLDISPLAYGRPS $SERVERTABLEVENTS $SERVERTABLEVENTSCHNGSLGDT $SERVERTABLEVENTSDISPLAYDT $SERVERTABLHO...
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($opt_T $opt_M $opt_V $opt_h $opt_D $PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "importDataThroughCatalog.pl";
my $prgtext = "Import Data Through Catalog 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 0
my $limit = 1000; # default 1000
my $type = 3; # default 3
my $logging = $RESULTSPATH .'/'; # default $RESULTSPATH .'/', disabled by '<NIHIL>'
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
);
if ($opt_V) { print_revision($PROGNAME, $version); exit $ERRORS{OK}; }
if ($opt_h) { print_help(); exit $ERRORS{OK}; }
($opt_M) || usage("Mode not specified\n");
my $mode = $opt_M if ($opt_M eq 'O' || $opt_M eq 'D');
($mode) || usage("Invalid mode: $opt_M\n");
if ($mode eq 'O') { $booleanQuit = 1; }
if ($opt_D) {
if ($opt_D eq 'F' || $opt_D eq 'T' || $opt_D eq 'L') {
$debug = 0 if ($opt_D eq 'F');
$debug = 1 if ($opt_D eq 'T');
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
my $boolean_daemonQuit = 0;
my $boolean_signal_hup = 0;
my $boolean_daemonControl = !$booleanQuit;
my $pidfile = $PIDPATH .'/importDataThroughCatalog.pid';
# Init parameters
my ($rv, $dbh, $sth, $sql, $alarmMessage);
if ($mode eq 'D') {
printDebugAll ("Uitvoeren import data through catalog - : <$PROGNAME v$version pid: <$pidfile>");
unless (fork) { # unless ($pid = fork) {
unless (fork) {
# if ($boolean_daemonControl) { sleep until getppid == 1; }
printDebugAll ("Main daemon control loop for: <$PROGNAME v$version pid: <$pidfile>\n");
write_pid();
if ($boolean_daemonControl) {
printDebugAll (print "Set daemon catch signals for: <$PROGNAME v$version pid: <$pidfile>\n");
$SIG{HUP} = \&signalHUP;
$SIG{QUIT} = \&signalQUIT;
$SIG{__DIE__} = \&signal_DIE;
$SIG{__WARN__} = \&signal_WARN;
} else {
$boolean_daemonQuit = 1;
}
do {
# Catch signals implementation
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
$currSecs = int((localtime)[0]);
} until ($currSecs < $prevSecs);
} until ($boolean_daemonQuit);
exit 0;
}
exit 0;
}
printDebugAll ("Einde ... import data through catalog - : <$PROGNAME v$version pid: <$pidfile>");
# if ($boolean_daemonControl) { waitpid($pid,0); }
} else {
my ($emailReport, $rvOpen) = init_email_report (*EMAILREPORT, 'importDataThroughCatalog.txt', $debug);
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>') {
my $rvOpen = open(ALLDEBUG,">>$tlogging-all.txt");
if ($rvOpen) {
print ALLDEBUG "$l_text $date\n";
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;
if ( $rv ) {
my %catalog;
if ( $sth->rows ) {
while( $sth->fetch() ) {
print "- $catalogID, $catalogType, $databaseFQDN, $databasePort\n" if ($debug);
$catalog{$catalogID}{catalogType} = $catalogType;
$catalog{$catalogID}{databaseFQDN} = $databaseFQDN;
$catalog{$catalogID}{databasePort} = $databasePort;
}
}
$sth->finish() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sth->finish: $sql", \$logger, $debug);
foreach my $catalogID ( keys %catalog ) {
if ($debug) {
print "+ Catalog ID: $catalogID\n";
print " - catalogType => ". $catalog{$catalogID}{catalogType} ."\n";
print " - databaseFQDN => ". $catalog{$catalogID}{databaseFQDN} ."\n";
print " - databasePort => ". $catalog{$catalogID}{databasePort} ."\n";
}
# Open connection to database and query data
my $dbhSOURCE;
($dbhSOURCE, $rv, $alarmMessage) = DBI_connect ( $DATABASE, $catalog{$catalogID}{databaseFQDN}, $catalog{$catalogID}{databasePort}, $SERVERUSERREADWRITE, $SERVERPASSREADWRITE, $alarm, \&DBI_error_trap, [*EMAILREPORT, "Cannot connect to the da...
if ($dbhSOURCE and $rv) {
print EMAILREPORT "\nCatalog ID: $catalogID\n" unless ($debug);
# config contrains: events, eventsChangesLogData & comments = = =
if ( $type == 1 or $type == 3 ) {
if ($debug) {
print "- config contrains: events, eventsChangesLogData & comments\n";
} else {
print EMAILREPORT "\n- config contrains: events, eventsChangesLogData & comments\n";
}
# 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 0, $SERVERTABLHOLIDYS, "catalogID = '$catalogID'", 'holidayID');
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 0, $SERVERTABLUSERS, "catalogID = '$catalogID'", 'remoteUser');
# 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 0, $SERVERTABLHOLIDYSBNDL, "catalogID = '$catalogID'", 'holidayBundleID');
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 0, $SERVERTABLRESULTSDIR, "catalogID = '$catalogID'", 'resultsdir');
# 3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 0, $SERVERTABLPLUGINS, "catalogID = '$catalogID'", 'uKey');
}
# events, eventsChangesLogData & comments = = = = = = = = = = =
if ( $type >= 2 ) {
if ($debug) {
print "- events, eventsChangesLogData & comments\n";
} else {
print EMAILREPORT "\n- events, eventsChangesLogData & comments\n";
}
# 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 1, $SERVERTABLEVENTS, "catalogID = '$catalogID' and replicationStatus <> 'R'", 'uKey', 'timeslot');
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 1, $SERVERTABLEVENTSCHNGSLGDT, "catalogID = '$catalogID' and replicationStatus <> 'R'", 'uKey');
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 1, $SERVERTABLEVENTSDISPLAYDT, "catalogID = '$catalogID' and replicationStatus <> 'R'", 'uKey', 'posTimeslot');
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 1, $SERVERTABLCOMMENTS, "catalogID = '$catalogID' and replicationStatus <> 'R'", 'uKey', 'entryTimeslot');
}
# config contrains: ALL = = = = = = = = = = = = = = = = = = = =
if ( $type == 1 or $type == 3 ) {
if ($debug) {
print "- config contrains: ALL\n";
} else {
print EMAILREPORT "\n- config contrains: ALL\n";
}
# 1'- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 0, $SERVERTABLTIMEPERIODS, "catalogID = '$catalogID'", 'timeperiodID');
# 2'- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 0, $SERVERTABLDISPLAYGRPS, "catalogID = '$catalogID'", 'displayGroupID');
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 0, $SERVERTABLPAGEDIRS, "catalogID = '$catalogID'", 'pagedir');
# 3'- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
importData (*EMAILREPORT, $dbhSOURCE, $dbh, 0, $SERVERTABLSERVERS, "catalogID = '$catalogID'", 'serverID');
# 4'- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$dbhSOURCE->disconnect or $rv = DBI_error_trap(*EMAILREPORT, "Sorry, the database was unable to add your entry.", \$logger, $debug);
}
}
}
$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);
if ( $rv ) {
while (my $ref = $sthSOURCE->fetchrow_hashref()) {
my ($whereReplicationStatus, $where, $action) = ("where $whereCLAUSE", '');
foreach my $primaryKey (@primaryKeys) { $whereReplicationStatus .= " and $primaryKey = '$ref->{$primaryKey}'" };
my $sqlVERIFY = "select count(catalogID) from `$table` $whereReplicationStatus";
print "... $sqlVERIFY\n" if ( $debug );
my $sthVERIFY = $dbh->prepare( $sqlVERIFY ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot dbh->prepare: $sqlVERIFY", \$logger, $debug);
($rv, undef) = DBI_execute ($rv, \$sthVERIFY, $alarm, \&DBI_error_trap, [*EMAILREPORT, "Cannot $sthVERIFY->execute: $sqlVERIFY"], \$logger, $debug);
if ( $rv ) {
my $updateRecord = $sthVERIFY->fetchrow_array();
$sthVERIFY->finish() or $rv = DBI_error_trap(*EMAILREPORT, "Cannot sthVERIFY->finish: $sqlVERIFY", \$logger, $debug);
if ( $updateRecord ) {
$action = "UPDATE `$table` SET";
$where = $whereReplicationStatus;
applications/bin/importDataThroughCatalog.pl view on Meta::CPAN
}
foreach my $databaseField ( @{$sthSOURCE->{NAME}} ) {
my $value = ( ( defined $ref->{$databaseField} ) ? $ref->{$databaseField} : '' );
$action .= " $table.$databaseField = \"$value\",";
}
chop $action if (defined $action);
my $sql = "$action $where";
print " - $sql\n" if ($debug);
($rv, undef, undef) = DBI_do ($rv, \$dbh, $sql, $alarm, \&DBI_error_trap, [*EMAILREPORT, "Cannot dbh->do: $sql"], \$logger, $debug);
if ( $rv and $replicationStatus ) {
$sql = "UPDATE `$table` SET replicationStatus = 'R' $whereReplicationStatus";
print " + $sql\n" if ($debug);
$dbhSOURCE->do ( $sql ) or $rv = DBI_error_trap(*EMAILREPORT, "Cannot $dbhSOURCE->do: $sql", \$logger, $debug);
}
}
}
$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
applications/collector-test.pl view on Meta::CPAN
use perlchartdir;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($opt_H $opt_M $opt_C $opt_W $opt_A $opt_N $opt_s $opt_S $opt_D $opt_V $opt_h $PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "collector.pl";
my $prgtext = "Collector 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 $status = 'N'; # default
my $dumphttp = 'N'; # default
my $debug = 'F'; # default
my $logging = '<NIHIL>'; # default
my $httpdump = '<NIHIL>'; # default
my $lockMySQL = 0; # default
my $alarm = 5; # default 5
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,
"s:s" => \$opt_s, "dumphttp:s" => \$opt_s,
"S:s" => \$opt_S, "status:s" => \$opt_S,
"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}; }
if ($opt_h) { print_help(); exit $ERRORS{OK}; }
($opt_H) || usage("MySQL hostname/address not specified\n");
my $serverName = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
($serverName) || usage("Invalid MySQL hostname/address: $opt_H\n");
($opt_M) || usage("Mode not specified\n");
my $mode = $opt_M if ($opt_M eq 'O' || $opt_M eq 'L' || $opt_M eq 'C');
($mode) || usage("Invalid mode: $opt_M\n");
if ($mode eq 'O') { $boolean_loopQuit = 1; }
applications/collector-test.pl view on Meta::CPAN
create_dir ($directory);
create_dir ($RESULTSPATH);
my $boolean_perfParseInstalled = ( $PERFPARSEENABLED and -e "${HTTPSPATH}${PERFPARSECGI}" ) ? 1 : 0;
if ($mode eq 'C') {
create_header ($RESULTSPATH .'/HEADER.html');
create_footer ($RESULTSPATH .'/FOOTER.html');
printDebugAll ("read table: <$collectorlist>");
@crontabtable = read_table($prgtext, $collectorlist, 1, $debug);
resultsdirCreate();
printDebugAll ("Uitvoeren crontab - : <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
unless (fork) { # unless ($pid = fork) {
unless (fork) {
# if ($boolean_daemonControl) { sleep until getppid == 1; }
printDebugAll ("Main Daemon control loop for: <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>\n");
write_pid();
if ($boolean_daemonControl) {
printDebugAll (print "Set daemon catch signals for: <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>\n");
$SIG{HUP} = \&signalHUP;
$SIG{QUIT} = \&signalQUIT;
$SIG{__DIE__} = \&signal_DIE;
$SIG{__WARN__} = \&signal_WARN;
} else {
$boolean_daemonQuit = 1;
}
do {
# Catch signals implementation
if ($boolean_signal_hup) {
printDebugAll ("read table: <$collectorlist>");
@crontabtable = read_table($prgtext, $collectorlist, 2, $debug);
resultsdirCreate();
$boolean_signal_hup = 0;
}
# Update access and modify epoch time from the PID time
utime (time(), time(), $pidfile) if (-e $pidfile);
# Crontab implementation
do_crontab ();
} until ($boolean_daemonQuit);
exit 0;
}
exit 0;
}
printDebugAll ("Einde ... Crontab - : <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
# if ($boolean_daemonControl) { waitpid($pid,0); }
} else {
printDebugAll ("read table: <$collectorlist>");
my @processtable = read_table($prgtext, $collectorlist, 0, $debug);
do {
printDebugAll ("Start collector - : <$mode> <$PROGNAME v$version -C $collectorlist>");
foreach $dproc (@processtable) {
my ($catalogID_uniqueKey, $resultsdir, $title, $command) = split(/\#/, $dproc, 4);
my ($catalogID, $uniqueKey) = split(/_/, $catalogID_uniqueKey);
unless ( defined $uniqueKey ) {
$uniqueKey = $catalogID;
$catalogID = $CATALOGID;
$catalogID_uniqueKey = $catalogID .'_'. $uniqueKey unless ( $catalogID eq 'CID' );
applications/collector-test.pl view on Meta::CPAN
$httpdump .= "/";
create_header ($httpdump ."HEADER.html");
create_footer ($httpdump ."FOOTER.html");
my $tlogging = $logging . get_logfiledate();
$title =~ s/^[\[[\S+|\s+]*\]\s+]{0,1}([\S+|\s+]*)/$1/g;
$action = call_system ($asnmtapEnv, 0, $catalogID_uniqueKey, $catalogID, $uniqueKey, $resultsdir, $title, $command, $status, 0, 9, 9, 9, $debug, $logging, $tlogging, $httpdump, $dumphttp, 0);
}
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);
applications/collector-test.pl view on Meta::CPAN
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);
foreach my $dcommand (@scommand) {
my ($catalogID_uniqueKey, $resultsdir, $title, $command, $noOFFLINE) = split(/\#/, $dcommand);
my ($catalogID, $uniqueKey) = split(/_/, $catalogID_uniqueKey);
unless ( defined $uniqueKey ) {
$uniqueKey = $catalogID;
$catalogID = $CATALOGID;
applications/collector-test.pl view on Meta::CPAN
$sth->finish() or $rv = errorTrapDBIdowntime($collectorlist, "Cannot sth->finish: $sql", \$logger, $debug) if $rv;
}
$dbh->disconnect or $rv = errorTrapDBIdowntime($collectorlist, "Sorry, the database was unable to add your entry.", \$logger, $debug);
} else {
$logger->info(" DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage") if ( defined $logger and $logger->is_info() );
}
unless ( $firstRecordPersistentTrue and $firstRecordPersistentFalse ) {
my $currentDowntimeTimeslot = timelocal (0, (localtime)[1,2,3,4,5]);
print "$catalogID_uniqueKey\ncurrentTimeslot : $currentDowntimeTimeslot\n" if ($debug eq 'T');
unless ( $firstRecordPersistentTrue ) {
if ($debug eq 'T') {
print "activationTimeslotPersistentTrue : $activationTimeslotPersistentTrue\n";
print "suspentionTimeslotPersistentTrue : $suspentionTimeslotPersistentTrue\n";
}
if ( $activationTimeslotPersistentTrue <= $currentDowntimeTimeslot and $currentDowntimeTimeslot <= $suspentionTimeslotPersistentTrue ) {
$persistent = $downtime = 1;
}
}
if ( (! $downtime) and (! $firstRecordPersistentFalse) ) {
if ($debug eq 'T') {
print "activationTimeslotPersistentFalse: $activationTimeslotPersistentFalse\n";
print "suspentionTimeslotPersistentFalse: $suspentionTimeslotPersistentFalse\n";
}
if ( $activationTimeslotPersistentFalse <= $currentDowntimeTimeslot and $currentDowntimeTimeslot <= $suspentionTimeslotPersistentFalse ) {
$downtime = 1;
}
}
print "instability: $instability, persistent: $persistent, downtime: $downtime\n" if ($debug eq 'T');
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unless ( $downtime ) {
if ($noOFFLINE) {
if ($noOFFLINE eq 'multiOFFLINE') {
$queryMySQL = 1;
printDebugAll ("multi OFFLINE: call_system <$catalogID_uniqueKey><$command>") if ($debug eq 'T');
} elsif ($noOFFLINE eq 'noTEST') {
$queryMySQL = 1;
printDebugAll ("no TEST: call_system <$catalogID_uniqueKey><$command>") if ($debug eq 'T');
}
}
$action = call_system ($asnmtapEnv, $currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $resultsdir, $title, $command, $status, int($tinterval), $instability, $persistent, $downtime, $debug, $logging, $tlogging, $httpdump, $dumpht...
}
}
if ($doOffline or $downtime) {
print "Write 'Offline/No Test' status to mysql databases on: ", get_csvfiletime(), "\n" if ($debug eq 'T');
my ($startDate, $startTime, $endDate, $endTime, $msgCommand);
$startDate = get_csvfiledate();
$startTime = get_csvfiletime();
$endDate = $startDate;
$endTime = $startTime;
($msgCommand, undef) = split(/\.pl/, $command);
my $insertData = 1;
my $status = 'OFFLINE';
if ($noOFFLINE) {
if ($noOFFLINE eq 'noOFFLINE') {
if ($downtime) {
$queryMySQL = 1;
} else {
$insertData = 0;
}
printDebugAll ("no OFFLINE: $msgCommand") if ($debug eq 'T');
} elsif ($noOFFLINE eq 'multiOFFLINE') {
$queryMySQL = 1;
printDebugAll ("multi OFFLINE: $msgCommand") if ($debug eq 'T');
} elsif ($noOFFLINE eq 'noTEST') {
$queryMySQL = 1;
$status = 'NO TEST' unless ( $downtime );
printDebugAll ("no TEST: $msgCommand") if ($debug eq 'T');
}
}
if ($insertData) {
my $rvOpen = open(CSV,">>$tlogging-$msgCommand-$catalogID_uniqueKey-csv.txt");
if ($rvOpen) {
print CSV '"', $catalogID, '","","', $uniqueKey, '","I","', $command, '","', $title, '","', $status, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","0","', $status, ' - Deze applicatie is niet toegankelijk","...
close(CSV);
} else {
print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey-csv.txt to print debug information\n";
}
insertEntryDBI ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $logging.$msgCommand.'-'.$catalogID_uniqueKey.'-sql', $command, int($tinterval), $status, $tlogging, $debug, $startDate, $startTime, $endDate, $endTime, 0...
}
}
# Update access and modify epoch time from the PID time
utime (time(), time(), $pidfile) if (-e $pidfile);
}
printDebugAll ("Einde CollectorCT - : <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>") if ($debug eq 'T');
} else {
print "Nothing to do at: ", get_csvfiletime(), "\n" if ($debug eq 'T');
}
}
my ($prevSecs, $currSecs);
$currSecs = int((localtime)[0]);
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";
# }
# Make sure this application logs a message when it dies unexpectedly
# -> log4perl.category = FATAL, Logfile
#
# if ( $^S ) {
# # We're in an eval {} and don't want log this message but catch it later
# return;
# }
#
# $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} ) {
if ( $process->ppid == $$ and ( timelocal( (localtime)[0,1,2,3,4,5] ) - $process->start ) >= $alarm ) {
$process->kill(9);
$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
applications/collector-test.pl view on Meta::CPAN
($stdout, $stderr) = capture_exec("$systemAction");
} else {
system ("$systemAction"); $stdout = $stderr = '';
}
$exit_value = $? >> 8;
$signal_num = $? & 127;
$dumped_core = $? & 128;
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;
applications/collector-test.pl view on Meta::CPAN
($stdout, $stderr) = capture_exec("$systemAction");
my (@returnStatus) = split (/\n/, $stdout);
$returnStatus = $returnStatus[-1];
} else {
system ("$systemAction"); $stdout = $stderr = '';
}
$exit_value = $? >> 8;
$signal_num = $? & 127;
$dumped_core = $? & 128;
# print "$CAPTUREOUTPUT -> <$returnStatus> < $stdout >< $stderr >< $exit_value >< $signal_num >< $dumped_core >\n";
alarm (0);
$CHILD_OFF = 0;
$SIG{ALRM} = $_handler ? $_handler : 'DEFAULT';
} else {
$exit_value = -1;
$signal_num = 1;
$dumped_core = 0;
$stdout = $stderr = '';
}
if ($exit_value >= 0 && $exit_value <= 4 && $signal_num == 0 && $dumped_core == 0) {
$action = "Success";
if ($exit_value == 0) {
$dumphttpRename = "OK";
printDebugAll (" OK ------------ : <$PROGNAME v$version -C $collectorlist>");
} elsif ($exit_value == 1) {
$dumphttpRename = "WARNING";
printDebugAll (" WARNING ------- : <$PROGNAME v$version -C $collectorlist>");
printDebugNOK (" WARNING ------- : $system_action");
} elsif ($exit_value == 2) {
$dumphttpRename = "CRITICAL";
printDebugAll (" CRITICAL ------ : <$PROGNAME v$version -C $collectorlist>");
printDebugNOK (" CRITICAL ------ : $system_action");
} elsif ($exit_value == 3) {
$dumphttpRename = "UNKNOWN";
printDebugAll (" UNKNOWN ------- : <$PROGNAME v$version -C $collectorlist>");
printDebugNOK (" UNKNOWN ------- : $system_action");
} elsif ($exit_value == 4) {
$dumphttpRename = "DEPENDENT";
printDebugAll (" DEPENDENT ----- : <$PROGNAME v$version -C $collectorlist>");
printDebugNOK (" DEPENDENT ----- : $system_action");
}
if ($dumphttp ne 'N') {
my $httpdumpFilenameTmpKnownError = $httpdumpFilenameTmp .'-KnownError';
unlink ($httpdumpFilenameTmpKnownError) if (-e "$httpdumpFilenameTmpKnownError");
if ($dumphttp eq 'A' || (($dumphttp eq 'W' or $dumphttp eq 'C' or $dumphttp eq 'U') && $exit_value > 0)) {
if (-e "$httpdumpFilenameTmp") {
$debugFilename = $httpdumpFilename .'-'. $dumphttpRename .'.htm';
rename("$httpdumpFilenameTmp", "$debugFilename");
}
} else {
unlink ($httpdumpFilenameTmp) if (-e "$httpdumpFilenameTmp");
}
}
} else {
$action = 'Failed';
$dumphttpRename = 'UNKNOWN';
printDebugAll (" call_system --- : $system_action: <$exit_value><$signal_num><$dumped_core><$stderr>");
printDebugNOK (" call_system --- : $system_action: <$exit_value><$signal_num><$dumped_core><$stderr>");
if ( $exit_value == -1 ) {
$returnStatus = "$dumphttpRename - $title: PLUGIN '$msgCommand.pl' doesn't exist - contact administrators";
} elsif ( $boolean_signal_kill ) {
$returnStatus = "$dumphttpRename - $title: TIMING OUT SLOW PLUGIN";
my $httpdumpFilenameTmpKnownError = $httpdumpFilenameTmp .'-KnownError';
unlink ($httpdumpFilenameTmpKnownError) if (-e "$httpdumpFilenameTmpKnownError");
unlink ($httpdumpFilenameTmp) if (-e "$httpdumpFilenameTmp");
} else {
applications/collector-test.pl view on Meta::CPAN
}
}
my ($duration) = $returnStatus =~ m/Trendline=([0-9.]+)s;[0-9.]+;;;$/i;
if (defined $duration) {
my ($thour, $tmin, $tsec);
$thour = int ($duration / 3600);
$tmin = int (int ($duration % 3600) / 60);
$tsec = int ($duration % 60);
$duration = sprintf("%02d:%02d:%02d", $thour, $tmin, $tsec);
} else {
my ($tyear, $tmonth, $tday, $thour, $tmin, $tsec, @startDateTime, @endDateTime, @diffDateTime);
($tyear, $tmonth, $tday) = split(/\//, $startDate);
($thour, $tmin, $tsec) = split(/\:/, $startTime);
@startDateTime = ($tyear, $tmonth, $tday, $thour, $tmin, $tsec);
($tyear, $tmonth, $tday) = split(/\//, $endDate);
($thour, $tmin, $tsec) = split(/\:/, $endTime);
@endDateTime = ($tyear, $tmonth, $tday, $thour, $tmin, $tsec);
@diffDateTime = Delta_DHMS(@startDateTime, @endDateTime);
$duration = sprintf("%02d:%02d:%02d", $diffDateTime[1], $diffDateTime[2], $diffDateTime[3]);
}
# my ($outputData, $performanceData) = split(/\|/, $returnStatus, 2);
my $_returnStatus = reverse $returnStatus;
my ($_outputData, $_performanceData) = reverse split(/\|/, $_returnStatus, 2);
my $outputData = reverse $_outputData;
my $performanceData = reverse $_performanceData;
$rvOpen = open(CSV,">>$logging-$msgCommand-$catalogID_uniqueKey-csv.txt");
if ($rvOpen) {
print CSV '"', $catalogID, '","","', $uniqueKey, '","I","', $system_action, '","', $title, '","', $dumphttpRename, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","', $duration, '","', $outputData, '","', $performanceDa...
close(CSV);
} else {
print "Cannot open $logging-$msgCommand-$catalogID_uniqueKey-csv.txt to print debug information\n";
}
if ( $boolean_perfParseInstalled ) {
if (defined $performanceData) {
my $perfParseTimeslot = get_timeslot ($currentDate);
my $perfParseCommand;
my $environment = (($system_action =~ /\-\-environment=([PASTDL])/) ? $1 : 'P');
my $eTitle = $title .' ('. $ENVIRONMENT{$environment} .')' if (defined $environment);
$eTitle .= ' from '. $catalogID;
if ( $perfParseMethode eq 'PULP' ) {
$perfParseCommand = "$APPLICATIONPATH/sbin/perfparse_asnmtap_pulp_command.pl $PREFIXPATH/log/perfdata-asnmtap.log \"$perfParseTimeslot\t$eTitle\t$catalogID_uniqueKey\t$outputData\t$dumphttpRename\t$performanceData\"";
} else {
$perfParseCommand = "printf \"%b\" \"$perfParseTimeslot\t$eTitle\t$catalogID_uniqueKey\t$outputData\t$dumphttpRename\t$performanceData\n\" | $PERFPARSEBIN/perfparse-log2mysql -c $PERFPARSEETC/$PERFPARSECONFIG";
}
if ($CAPTUREOUTPUT) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec("$perfParseCommand");
} else {
system ("$perfParseCommand"); $stdout = $stderr = '';
}
$exit_value = $? >> 8;
$signal_num = $? & 127;
$dumped_core = $? & 128;
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>') {
my $rvOpen = open(ALLDEBUG,">>$tlogging-all.txt");
if ($rvOpen) {
print ALLDEBUG "$l_text $date\n";
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) {
if ($queryMySQL) {
my $numbersEntryDBI = 0;
$findString = 'select SQL_NO_CACHE status from '.$SERVERTABLEVENTS.' where catalogID = "' .$catalogID. '" and uKey = "' .$uniqueKey. '" and step <> "0" and timeslot = "' . get_timeslot ($currentDate) . '" order by id desc';
printDebugAll ("query Entry DBI: <$findString>") if ($debug eq 'T');
$sth = $dbh->prepare($findString) or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instabilit...
($rv, undef) = DBI_execute ($rv, \$sth, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $i...
if ($rv) {
while (my $ref = $sth->fetchrow_hashref()) {
$numbersEntryDBI++;
if ( $ref->{status} eq '<NIHIL>' or $ref->{status} eq 'OFFLINE' or $ref->{status} eq 'NO TEST' ) { $updateEntryDBI = 1; }
}
$insertEntryDBI = 1 unless ( $numbersEntryDBI );
printDebugAll ("query Entry DBI: # <$numbersEntryDBI> insert <$insertEntryDBI> change <$updateEntryDBI>") if ($debug eq 'T');
}
$sth->finish() or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $do...
} else {
$insertEntryDBI = 1;
}
} else {
$logger->info(" DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage") if ( defined $logger and $logger->is_info() );
}
applications/collector-test.pl view on Meta::CPAN
}
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");
# if ($rvOpen) {
# print DEBUG '"', $catalogID, '","","', $uniqueKey, '","I","', $test, '","', $title, '","', $status, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","', $duration, '","', $statusMessage, '","', $perfdata, '","', $inter...
# close(DEBUG);
# } else {
# print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey.sql to print debug information\n";
# }
my %VALUES = (
'catalogID' => $catalogID,
'id' => 0,
'uKey' => $uniqueKey,
'replicationStatus' => 'I',
'test' => $test,
'title' => $title,
'status' => $status,
applications/collector-test.pl view on Meta::CPAN
);
my $_debug = ( ( $debug eq 'T' ) ? 1 : 0);
my $dbh = CSV_prepare_table ($logging, get_logfiledate() . "-$msgCommand-$catalogID_uniqueKey", '.sql', $SERVERTABLEVENTS, \@EVENTS, \%EVENTS, \$logger, $_debug);
my $rv = CSV_insert_into_table (1, $dbh, $SERVERTABLEVENTS, \@EVENTS, \%VALUES, 'id', \$logger, $_debug);
CSV_cleanup_table ($dbh, \$logger, $_debug);
my $rvOpen = open(DEBUG,">>$tlogging-$msgCommand-$catalogID_uniqueKey-sql-error.txt");
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);
applications/collector-test.pl view on Meta::CPAN
# 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;
my $hight = 558;
my $xOffset = 74;
my $yOffset = 28;
my $yMarkColor = 0xFFFFDC;
my $background = 0xF7F7F7;
print "Generating RRD alike graph\n" if ($debug eq 'T');
my (@dataOK, @dataCritical, @dataWarning, @dataUnknown, @dataNoTest, @dataOffline, @RRDlabels);
my ($step, $lastTimeslot, $firstTimeslot, $duration, $startTime, $status, $timeslot, $findString);
$step = $interval * 60;
$lastTimeslot = timelocal (0, (localtime)[1,2,3,4,5]);
$firstTimeslot = $lastTimeslot - ($step * ($limitTest));
$findString = "select SQL_NO_CACHE duration, startTime, status, timeslot from $SERVERTABLEVENTS force index (uKey) where catalogID = '$catalogID' and uKey = '$uniqueKey' and step <> '0' and (timeslot between '$firstTimeslot' and '$lastTimeslot')...
print "$findString\n" if ($debug eq 'T');
# data en labels in array zetten
my ($counter, $seconden, $ttimeslot);
for ( $counter = 0; $counter < $limitTest; $counter++) {
push (@dataOK, "0");
push (@dataWarning, "0");
push (@dataCritical, "0");
push (@dataUnknown, "0");
push (@dataNoTest, "0");
applications/collector-test.pl view on Meta::CPAN
$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>
FILENAME : filename from the collectorlist for the loop of crontab
-W, --screenDebug=F|T
applications/collector.pl view on Meta::CPAN
use perlchartdir;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($opt_H $opt_M $opt_C $opt_W $opt_A $opt_N $opt_s $opt_S $opt_D $opt_V $opt_h $PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "collector.pl";
my $prgtext = "Collector 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 $status = 'N'; # default
my $dumphttp = 'N'; # default
my $debug = 'F'; # default
my $logging = '<NIHIL>'; # default
my $httpdump = '<NIHIL>'; # default
my $lockMySQL = 0; # default
my $alarm = 5; # default 5
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,
"s:s" => \$opt_s, "dumphttp:s" => \$opt_s,
"S:s" => \$opt_S, "status:s" => \$opt_S,
"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}; }
if ($opt_h) { print_help(); exit $ERRORS{OK}; }
($opt_H) || usage("MySQL hostname/address not specified\n");
my $serverName = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
($serverName) || usage("Invalid MySQL hostname/address: $opt_H\n");
($opt_M) || usage("Mode not specified\n");
my $mode = $opt_M if ($opt_M eq 'O' || $opt_M eq 'L' || $opt_M eq 'C');
($mode) || usage("Invalid mode: $opt_M\n");
if ($mode eq 'O') { $boolean_loopQuit = 1; }
applications/collector.pl view on Meta::CPAN
create_dir ($directory);
create_dir ($RESULTSPATH);
my $boolean_perfParseInstalled = ( $PERFPARSEENABLED and -e "${HTTPSPATH}${PERFPARSECGI}" ) ? 1 : 0;
if ($mode eq 'C') {
create_header ($RESULTSPATH .'/HEADER.html');
create_footer ($RESULTSPATH .'/FOOTER.html');
printDebugAll ("read table: <$collectorlist>");
@crontabtable = read_table($prgtext, $collectorlist, 1, $debug);
resultsdirCreate();
printDebugAll ("Uitvoeren crontab - : <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
unless (fork) { # unless ($pid = fork) {
unless (fork) {
# if ($boolean_daemonControl) { sleep until getppid == 1; }
printDebugAll ("Main Daemon control loop for: <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>\n");
write_pid();
if ($boolean_daemonControl) {
printDebugAll (print "Set daemon catch signals for: <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>\n");
$SIG{HUP} = \&signalHUP;
$SIG{QUIT} = \&signalQUIT;
$SIG{__DIE__} = \&signal_DIE;
$SIG{__WARN__} = \&signal_WARN;
} else {
$boolean_daemonQuit = 1;
}
do {
# Catch signals implementation
if ($boolean_signal_hup) {
printDebugAll ("read table: <$collectorlist>");
@crontabtable = read_table($prgtext, $collectorlist, 2, $debug);
resultsdirCreate();
$boolean_signal_hup = 0;
}
# Update access and modify epoch time from the PID time
utime (time(), time(), $pidfile) if (-e $pidfile);
# Crontab implementation
do_crontab ();
} until ($boolean_daemonQuit);
exit 0;
}
exit 0;
}
printDebugAll ("Einde ... Crontab - : <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");
# if ($boolean_daemonControl) { waitpid($pid,0); }
} else {
printDebugAll ("read table: <$collectorlist>");
my @processtable = read_table($prgtext, $collectorlist, 0, $debug);
do {
printDebugAll ("Start collector - : <$mode> <$PROGNAME v$version -C $collectorlist>");
foreach $dproc (@processtable) {
my ($catalogID_uniqueKey, $resultsdir, $title, $command) = split(/\#/, $dproc, 4);
my ($catalogID, $uniqueKey) = split(/_/, $catalogID_uniqueKey);
unless ( defined $uniqueKey ) {
$uniqueKey = $catalogID;
$catalogID = $CATALOGID;
$catalogID_uniqueKey = $catalogID .'_'. $uniqueKey unless ( $catalogID eq 'CID' );
applications/collector.pl view on Meta::CPAN
$httpdump .= "/";
create_header ($httpdump ."HEADER.html");
create_footer ($httpdump ."FOOTER.html");
my $tlogging = $logging . get_logfiledate();
$title =~ s/^[\[[\S+|\s+]*\]\s+]{0,1}([\S+|\s+]*)/$1/g;
$action = call_system ($asnmtapEnv, 0, $catalogID_uniqueKey, $catalogID, $uniqueKey, $resultsdir, $title, $command, $status, 0, 9, 9, 9, $debug, $logging, $tlogging, $httpdump, $dumphttp, 0);
}
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);
applications/collector.pl view on Meta::CPAN
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);
foreach my $dcommand (@scommand) {
my ($catalogID_uniqueKey, $resultsdir, $title, $command, $noOFFLINE) = split(/\#/, $dcommand);
my ($catalogID, $uniqueKey) = split(/_/, $catalogID_uniqueKey);
unless ( defined $uniqueKey ) {
$uniqueKey = $catalogID;
$catalogID = $CATALOGID;
applications/collector.pl view on Meta::CPAN
$sth->finish() or $rv = errorTrapDBIdowntime($collectorlist, "Cannot sth->finish: $sql", \$logger, $debug) if $rv;
}
$dbh->disconnect or $rv = errorTrapDBIdowntime($collectorlist, "Sorry, the database was unable to add your entry.", \$logger, $debug);
} else {
$logger->info(" DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage") if ( defined $logger and $logger->is_info() );
}
unless ( $firstRecordPersistentTrue and $firstRecordPersistentFalse ) {
my $currentDowntimeTimeslot = timelocal (0, (localtime)[1,2,3,4,5]);
print "$catalogID_uniqueKey\ncurrentTimeslot : $currentDowntimeTimeslot\n" if ($debug eq 'T');
unless ( $firstRecordPersistentTrue ) {
if ($debug eq 'T') {
print "activationTimeslotPersistentTrue : $activationTimeslotPersistentTrue\n";
print "suspentionTimeslotPersistentTrue : $suspentionTimeslotPersistentTrue\n";
}
if ( $activationTimeslotPersistentTrue <= $currentDowntimeTimeslot and $currentDowntimeTimeslot <= $suspentionTimeslotPersistentTrue ) {
$persistent = $downtime = 1;
}
}
if ( (! $downtime) and (! $firstRecordPersistentFalse) ) {
if ($debug eq 'T') {
print "activationTimeslotPersistentFalse: $activationTimeslotPersistentFalse\n";
print "suspentionTimeslotPersistentFalse: $suspentionTimeslotPersistentFalse\n";
}
if ( $activationTimeslotPersistentFalse <= $currentDowntimeTimeslot and $currentDowntimeTimeslot <= $suspentionTimeslotPersistentFalse ) {
$downtime = 1;
}
}
print "instability: $instability, persistent: $persistent, downtime: $downtime\n" if ($debug eq 'T');
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unless ( $downtime ) {
if ($noOFFLINE) {
if ($noOFFLINE eq 'multiOFFLINE') {
$queryMySQL = 1;
printDebugAll ("multi OFFLINE: call_system <$catalogID_uniqueKey><$command>") if ($debug eq 'T');
} elsif ($noOFFLINE eq 'noTEST') {
$queryMySQL = 1;
printDebugAll ("no TEST: call_system <$catalogID_uniqueKey><$command>") if ($debug eq 'T');
}
}
$action = call_system ($asnmtapEnv, $currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $resultsdir, $title, $command, $status, int($tinterval), $instability, $persistent, $downtime, $debug, $logging, $tlogging, $httpdump, $dumpht...
}
}
if ($doOffline or $downtime) {
print "Write 'Offline/No Test' status to mysql databases on: ", get_csvfiletime(), "\n" if ($debug eq 'T');
my ($startDate, $startTime, $endDate, $endTime, $msgCommand);
$startDate = get_csvfiledate();
$startTime = get_csvfiletime();
$endDate = $startDate;
$endTime = $startTime;
($msgCommand, undef) = split(/\.pl/, $command);
my $insertData = 1;
my $status = 'OFFLINE';
if ($noOFFLINE) {
if ($noOFFLINE eq 'noOFFLINE') {
if ($downtime) {
$queryMySQL = 1;
} else {
$insertData = 0;
}
printDebugAll ("no OFFLINE: $msgCommand") if ($debug eq 'T');
} elsif ($noOFFLINE eq 'multiOFFLINE') {
$queryMySQL = 1;
printDebugAll ("multi OFFLINE: $msgCommand") if ($debug eq 'T');
} elsif ($noOFFLINE eq 'noTEST') {
$queryMySQL = 1;
$status = 'NO TEST' unless ( $downtime );
printDebugAll ("no TEST: $msgCommand") if ($debug eq 'T');
}
}
if ($insertData) {
my $rvOpen = open(CSV,">>$tlogging-$msgCommand-$catalogID_uniqueKey-csv.txt");
if ($rvOpen) {
print CSV '"', $catalogID, '","","', $uniqueKey, '","I","', $command, '","', $title, '","', $status, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","0","', $status, ' - Deze applicatie is niet toegankelijk","...
close(CSV);
} else {
print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey-csv.txt to print debug information\n";
}
insertEntryDBI ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $logging.$msgCommand.'-'.$catalogID_uniqueKey.'-sql', $command, int($tinterval), $status, $tlogging, $debug, $startDate, $startTime, $endDate, $endTime, 0...
}
}
# Update access and modify epoch time from the PID time
utime (time(), time(), $pidfile) if (-e $pidfile);
}
printDebugAll ("Einde CollectorCT - : <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>") if ($debug eq 'T');
} else {
print "Nothing to do at: ", get_csvfiletime(), "\n" if ($debug eq 'T');
}
}
my ($prevSecs, $currSecs);
$currSecs = int((localtime)[0]);
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";
# }
# Make sure this application logs a message when it dies unexpectedly
# -> log4perl.category = FATAL, Logfile
#
# if ( $^S ) {
# # We're in an eval {} and don't want log this message but catch it later
# return;
# }
#
# $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} ) {
if ( $process->ppid == $$ and ( timelocal( (localtime)[0,1,2,3,4,5] ) - $process->start ) >= $alarm ) {
$process->kill(9);
$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
applications/collector.pl view on Meta::CPAN
($stdout, $stderr) = capture_exec("$systemAction");
} else {
system ("$systemAction"); $stdout = $stderr = '';
}
$exit_value = $? >> 8;
$signal_num = $? & 127;
$dumped_core = $? & 128;
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;
applications/collector.pl view on Meta::CPAN
($stdout, $stderr) = capture_exec("$systemAction");
my (@returnStatus) = split (/\n/, $stdout);
$returnStatus = $returnStatus[-1];
} else {
system ("$systemAction"); $stdout = $stderr = '';
}
$exit_value = $? >> 8;
$signal_num = $? & 127;
$dumped_core = $? & 128;
# print "$CAPTUREOUTPUT -> <$returnStatus> < $stdout >< $stderr >< $exit_value >< $signal_num >< $dumped_core >\n";
alarm (0);
$CHILD_OFF = 0;
$SIG{ALRM} = $_handler ? $_handler : 'DEFAULT';
} else {
$exit_value = -1;
$signal_num = 1;
$dumped_core = 0;
$stdout = $stderr = '';
}
if ($exit_value >= 0 && $exit_value <= 4 && $signal_num == 0 && $dumped_core == 0) {
$action = "Success";
if ($exit_value == 0) {
$dumphttpRename = "OK";
printDebugAll (" OK ------------ : <$PROGNAME v$version -C $collectorlist>");
} elsif ($exit_value == 1) {
$dumphttpRename = "WARNING";
printDebugAll (" WARNING ------- : <$PROGNAME v$version -C $collectorlist>");
printDebugNOK (" WARNING ------- : $system_action");
} elsif ($exit_value == 2) {
$dumphttpRename = "CRITICAL";
printDebugAll (" CRITICAL ------ : <$PROGNAME v$version -C $collectorlist>");
printDebugNOK (" CRITICAL ------ : $system_action");
} elsif ($exit_value == 3) {
$dumphttpRename = "UNKNOWN";
printDebugAll (" UNKNOWN ------- : <$PROGNAME v$version -C $collectorlist>");
printDebugNOK (" UNKNOWN ------- : $system_action");
} elsif ($exit_value == 4) {
$dumphttpRename = "DEPENDENT";
printDebugAll (" DEPENDENT ----- : <$PROGNAME v$version -C $collectorlist>");
printDebugNOK (" DEPENDENT ----- : $system_action");
}
if ($dumphttp ne 'N') {
my $httpdumpFilenameTmpKnownError = $httpdumpFilenameTmp .'-KnownError';
unlink ($httpdumpFilenameTmpKnownError) if (-e "$httpdumpFilenameTmpKnownError");
if ($dumphttp eq 'A' || (($dumphttp eq 'W' or $dumphttp eq 'C' or $dumphttp eq 'U') && $exit_value > 0)) {
if (-e "$httpdumpFilenameTmp") {
$debugFilename = $httpdumpFilename .'-'. $dumphttpRename .'.htm';
rename("$httpdumpFilenameTmp", "$debugFilename");
}
} else {
unlink ($httpdumpFilenameTmp) if (-e "$httpdumpFilenameTmp");
}
}
} else {
$action = 'Failed';
$dumphttpRename = 'UNKNOWN';
printDebugAll (" call_system --- : $system_action: <$exit_value><$signal_num><$dumped_core><$stderr>");
printDebugNOK (" call_system --- : $system_action: <$exit_value><$signal_num><$dumped_core><$stderr>");
if ( $exit_value == -1 ) {
$returnStatus = "$dumphttpRename - $title: PLUGIN '$msgCommand.pl' doesn't exist - contact administrators";
} elsif ( $boolean_signal_kill ) {
$returnStatus = "$dumphttpRename - $title: TIMING OUT SLOW PLUGIN";
my $httpdumpFilenameTmpKnownError = $httpdumpFilenameTmp .'-KnownError';
unlink ($httpdumpFilenameTmpKnownError) if (-e "$httpdumpFilenameTmpKnownError");
unlink ($httpdumpFilenameTmp) if (-e "$httpdumpFilenameTmp");
} else {
applications/collector.pl view on Meta::CPAN
}
}
my ($duration) = $returnStatus =~ m/Trendline=([0-9.]+)s;[0-9.]+;;;$/i;
if (defined $duration) {
my ($thour, $tmin, $tsec);
$thour = int ($duration / 3600);
$tmin = int (int ($duration % 3600) / 60);
$tsec = int ($duration % 60);
$duration = sprintf("%02d:%02d:%02d", $thour, $tmin, $tsec);
} else {
my ($tyear, $tmonth, $tday, $thour, $tmin, $tsec, @startDateTime, @endDateTime, @diffDateTime);
($tyear, $tmonth, $tday) = split(/\//, $startDate);
($thour, $tmin, $tsec) = split(/\:/, $startTime);
@startDateTime = ($tyear, $tmonth, $tday, $thour, $tmin, $tsec);
($tyear, $tmonth, $tday) = split(/\//, $endDate);
($thour, $tmin, $tsec) = split(/\:/, $endTime);
@endDateTime = ($tyear, $tmonth, $tday, $thour, $tmin, $tsec);
@diffDateTime = Delta_DHMS(@startDateTime, @endDateTime);
$duration = sprintf("%02d:%02d:%02d", $diffDateTime[1], $diffDateTime[2], $diffDateTime[3]);
}
# my ($outputData, $performanceData) = split(/\|/, $returnStatus, 2);
my $_returnStatus = reverse $returnStatus;
my ($_outputData, $_performanceData) = reverse split(/\|/, $_returnStatus, 2);
my $outputData = reverse $_outputData;
my $performanceData = reverse $_performanceData;
$rvOpen = open(CSV,">>$logging-$msgCommand-$catalogID_uniqueKey-csv.txt");
if ($rvOpen) {
print CSV '"', $catalogID, '","","', $uniqueKey, '","I","', $system_action, '","', $title, '","', $dumphttpRename, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","', $duration, '","', $outputData, '","', $performanceDa...
close(CSV);
} else {
print "Cannot open $logging-$msgCommand-$catalogID_uniqueKey-csv.txt to print debug information\n";
}
if ( $boolean_perfParseInstalled ) {
if (defined $performanceData) {
my $perfParseTimeslot = get_timeslot ($currentDate);
my $perfParseCommand;
my $environment = (($system_action =~ /\-\-environment=([PASTDL])/) ? $1 : 'P');
my $eTitle = $title .' ('. $ENVIRONMENT{$environment} .')' if (defined $environment);
$eTitle .= ' from '. $catalogID;
if ( $perfParseMethode eq 'PULP' ) {
$perfParseCommand = "$APPLICATIONPATH/sbin/perfparse_asnmtap_pulp_command.pl $PREFIXPATH/log/perfdata-asnmtap.log \"$perfParseTimeslot\t$eTitle\t$catalogID_uniqueKey\t$outputData\t$dumphttpRename\t$performanceData\"";
} else {
$perfParseCommand = "printf \"%b\" \"$perfParseTimeslot\t$eTitle\t$catalogID_uniqueKey\t$outputData\t$dumphttpRename\t$performanceData\n\" | $PERFPARSEBIN/perfparse-log2mysql -c $PERFPARSEETC/$PERFPARSECONFIG";
}
if ($CAPTUREOUTPUT) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec("$perfParseCommand");
} else {
system ("$perfParseCommand"); $stdout = $stderr = '';
}
$exit_value = $? >> 8;
$signal_num = $? & 127;
$dumped_core = $? & 128;
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>') {
my $rvOpen = open(ALLDEBUG,">>$tlogging-all.txt");
if ($rvOpen) {
print ALLDEBUG "$l_text $date\n";
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) {
if ($queryMySQL) {
my $numbersEntryDBI = 0;
$findString = 'select SQL_NO_CACHE status from '.$SERVERTABLEVENTS.' where catalogID = "' .$catalogID. '" and uKey = "' .$uniqueKey. '" and step <> "0" and timeslot = "' . get_timeslot ($currentDate) . '" order by id desc';
printDebugAll ("query Entry DBI: <$findString>") if ($debug eq 'T');
$sth = $dbh->prepare($findString) or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instabilit...
($rv, undef) = DBI_execute ($rv, \$sth, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $i...
if ($rv) {
while (my $ref = $sth->fetchrow_hashref()) {
$numbersEntryDBI++;
if ( $ref->{status} eq '<NIHIL>' or $ref->{status} eq 'OFFLINE' or $ref->{status} eq 'NO TEST' ) { $updateEntryDBI = 1; }
}
$insertEntryDBI = 1 unless ( $numbersEntryDBI );
printDebugAll ("query Entry DBI: # <$numbersEntryDBI> insert <$insertEntryDBI> change <$updateEntryDBI>") if ($debug eq 'T');
}
$sth->finish() or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $do...
} else {
$insertEntryDBI = 1;
}
} else {
$logger->info(" DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage") if ( defined $logger and $logger->is_info() );
}
applications/collector.pl view on Meta::CPAN
}
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");
# if ($rvOpen) {
# print DEBUG '"', $catalogID, '","","', $uniqueKey, '","I","', $test, '","', $title, '","', $status, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","', $duration, '","', $statusMessage, '","', $perfdata, '","', $inter...
# close(DEBUG);
# } else {
# print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey.sql to print debug information\n";
# }
my %VALUES = (
'catalogID' => $catalogID,
'id' => 0,
'uKey' => $uniqueKey,
'replicationStatus' => 'I',
'test' => $test,
'title' => $title,
'status' => $status,
applications/collector.pl view on Meta::CPAN
);
my $_debug = ( ( $debug eq 'T' ) ? 1 : 0);
my $dbh = CSV_prepare_table ($logging, get_logfiledate() . "-$msgCommand-$catalogID_uniqueKey", '.sql', $SERVERTABLEVENTS, \@EVENTS, \%EVENTS, \$logger, $_debug);
my $rv = CSV_insert_into_table (1, $dbh, $SERVERTABLEVENTS, \@EVENTS, \%VALUES, 'id', \$logger, $_debug);
CSV_cleanup_table ($dbh, \$logger, $_debug);
my $rvOpen = open(DEBUG,">>$tlogging-$msgCommand-$catalogID_uniqueKey-sql-error.txt");
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);
applications/collector.pl view on Meta::CPAN
# 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;
my $hight = 558;
my $xOffset = 74;
my $yOffset = 28;
my $yMarkColor = 0xFFFFDC;
my $background = 0xF7F7F7;
print "Generating RRD alike graph\n" if ($debug eq 'T');
my (@dataOK, @dataCritical, @dataWarning, @dataUnknown, @dataNoTest, @dataOffline, @RRDlabels);
my ($step, $lastTimeslot, $firstTimeslot, $duration, $startTime, $status, $timeslot, $findString);
$step = $interval * 60;
$lastTimeslot = timelocal (0, (localtime)[1,2,3,4,5]);
$firstTimeslot = $lastTimeslot - ($step * ($limitTest));
$findString = "select SQL_NO_CACHE duration, startTime, status, timeslot from $SERVERTABLEVENTS force index (uKey) where catalogID = '$catalogID' and uKey = '$uniqueKey' and step <> '0' and (timeslot between '$firstTimeslot' and '$lastTimeslot')...
print "$findString\n" if ($debug eq 'T');
# data en labels in array zetten
my ($counter, $seconden, $ttimeslot);
for ( $counter = 0; $counter < $limitTest; $counter++) {
push (@dataOK, "0");
push (@dataWarning, "0");
push (@dataCritical, "0");
push (@dataUnknown, "0");
push (@dataNoTest, "0");
applications/collector.pl view on Meta::CPAN
$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>
FILENAME : filename from the collectorlist for the loop of crontab
-W, --screenDebug=F|T
applications/custom/cartography.pm-orig view on Meta::CPAN
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/sde-supportRequest.pm-orig view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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} ) {
applications/custom/sde-supportRequest.pm-orig view on Meta::CPAN
}
unless ($counter) {
chop $header;
$header .= "\n";
}
chop $data;
$data .= "\n";
print $header, $data;
$counter++;
}
return ($counter);
}
if ( ref $WebServiceResults->{$response}->{SupportRequest} eq 'ARRAY' ) {
my $counter = 0;
foreach my $supportRequest ( @{$WebServiceResults->{$response}->{SupportRequest}} ) {
applications/custom/sde-supportRequest.pm-orig view on Meta::CPAN
); # 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";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my %fieldlist;
if ( defined $fieldlist ) {
my $counter = 10;
%fieldlist = map { $counter++ => $_ } split (/,/, $fieldlist);
} else {
applications/custom/sde-supportRequest.pm-orig view on Meta::CPAN
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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') );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/custom/sde-supportRequest.pm-orig view on Meta::CPAN
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
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";
print "<", $sql, ">\n" if ($debug);
my $sth = $dbh->prepare( $sql ) or $rv = errorTrapDBI($checklist, "Cannot dbh->prepare: $sql");
$sth->execute or $rv = errorTrapDBI($checklist, "Cannot sth->execute: $sql") if $rv;
if ( $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');
while (my $ref = $sth->fetchrow_hashref()) {
if ( exists $$hash_catalogID_uKey_timeperiodID{$ref->{catalogID}}->{$ref->{uKey}} ) {
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
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
use ASNMTAP::Asnmtap::Applications::Display qw(:APPLICATIONS :DISPLAY :DBDISPLAY &encode_html_entities);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($opt_H $opt_V $opt_h $opt_C $opt_P $opt_D $opt_L $opt_t $opt_c $opt_T $opt_l $PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "display.pl";
my $prgtext = "Display 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 $checklist = "DisplayCT"; # default
my $htmlOutput = $HTTPSPATH .'/nav/index/index'; # default
my $pagedir = 'index'; # default
my $pageset = 'index'; # default
my $debug = 0; # default
my $loop = 0; # default
my $trigger = 0; # default
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,
"L:s" => \$opt_L, "loop:s" => \$opt_L,
"t:s" => \$opt_t, "trigger:s" => \$opt_t,
"c:s" => \$opt_c, "creationTime:s" => \$opt_c,
"T:s" => \$opt_T, "displayTime:s" => \$opt_T,
"l:s" => \$opt_l, "lockMySQL:s" => \$opt_l
);
if ($opt_V) { print_revision($PROGNAME, $version); exit; }
if ($opt_h) { print_help(); exit; }
($opt_H) || usage("MySQL hostname/address not specified\n");
my $serverName = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
($serverName) || usage("Invalid MySQL hostname/address: $opt_H\n");
if ($opt_C) { $checklist = $1 if ($opt_C =~ /([-.A-Za-z0-9]+)/); }
if ($opt_P) { $pagedir = $opt_P; }
if ($opt_D) {
if ($opt_D eq 'F' || $opt_D eq 'T') {
applications/display-test.pl view on Meta::CPAN
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($dchecklist, $dtest, $dfetch, $tinterval, $tgroep, $resultsdir, $ttest, $firstTimeslot, $lastTimeslot, $rvOpen);
my (@fetch, $dstart, $tstart, $start, $step, $names, $data, $rows, $columns, $line, $val, @vals);
my ($command, $tstatus, $tduration, $timeValue, $prevGroep, @multiarrayFullCondensedView, @multiarrayMinimalCondensedView);
my ($rv, $dbh, $sth, $lockString, $findString, $unlockString, $doChecklist, $timeCorrectie, $timeslot);
my ($groupFullView, $groupCondensedView, $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $itemFullCondensedView);
my ($checkOk, $checkSkip, $configNumber, $printCondensedView, $problemSolved, $verifyNumber, $inProgressNumber);
my ($playSoundInProgress, $playSoundPreviousStatus, $playSoundStatus, %tableSoundStatusCache);
my ($prevHour, $currHour, %timeperiodID_days, %catalogID_uKey_timeperiodID) = (-1, -1);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $boolean_daemonQuit = 0;
my $boolean_signal_hup = 0;
my $boolean_daemonControl = $loop;
my $colspanDisplayTime = $NUMBEROFFTESTS+2;
applications/display-test.pl view on Meta::CPAN
my $directory = $HTTPSPATH .'/nav/'. $pagedir;
create_dir ($directory) unless ( -e "$directory" );
my $pagedirOrig = $pagedir;
unless (fork) { # unless ($pid = fork) {
unless (fork) {
# if ($boolean_daemonControl) { sleep until getppid == 1; }
print "Main Daemon control loop for: <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
write_pid() if ($boolean_daemonControl);
if ($boolean_daemonControl) {
print "Set daemon catch signals for: <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
write_tableSoundStatusCache ($checklist, $debug);
$SIG{HUP} = \&signalHUP;
$SIG{QUIT} = \&signalQUIT;
$SIG{__DIE__} = \&signal_DIE;
$SIG{__WARN__} = \&signal_WARN;
} else {
$boolean_daemonQuit = 1;
}
do {
applications/display-test.pl view on Meta::CPAN
if ($_ ne '') {
my ($key, $value) = split (/=>/, $_);
$tableSoundStatusCache { $key } = $value;
}
}
close(READ);
if ($debug) {
print "$APPLICATIONPATH/tmp/$checklist-sound-status.cache: READ\n";
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");
unless ( $rvOpen ) {
print "Cannot open $htmlOutput.tmp to create the html information\n";
exit 0;
}
$rvOpen = open(HTMLCV, ">$htmlOutput-cv.tmp");
unless ( $rvOpen ) {
print "Cannot open $htmlOutput-cv.tmp to create the html information\n";
exit 0;
}
$rvOpen = open(HTMLMCV, ">$htmlOutput-mcv.tmp");
unless ( $rvOpen ) {
print "Cannot open $htmlOutput-mcv.tmp to create the html information\n";
exit 0;
}
$prevGroep = '';
my $dstatusMessage;
my $creationDate;
if ( defined $creationTime ) {
my ($date, $time) = split (/ /, $creationTime);
my ($year, $month, $day) = split (/-/, $date);
my ($hour, $minute, $seconds) = split (/:/, $time);
$creationDate = timelocal ( $seconds, $minute, $hour, $day, $month-1, $year-1900 );
printHtmlHeader( $APPLICATION .' - '. $ENVIRONMENT{$Cenvironment} .' from '. $CATALOGID .' ('. scalar(localtime($creationDate)) .')' );
} else {
$creationDate = time();
printHtmlHeader( $APPLICATION .' - '. $ENVIRONMENT{$Cenvironment} .' from '. $CATALOGID );
}
$rv = 1;
$dbh = DBI->connect("DBI:mysql:$DATABASE:$serverName:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE") or $rv = errorTrapDBI($checklist, "Cannot connect to the database");
if ($lockMySQL) {
if ($dbh and $rv) {
$lockString = 'LOCK TABLES ' .$SERVERTABLEVENTS. ' READ';
$dbh->do ( $lockString ) or $rv = errorTrapDBI($checklist, "Cannot dbh->do: $lockString");
}
applications/display-test.pl view on Meta::CPAN
$inMCV{DEPENDENT}{UNKNOWN} = 1;
$groupFullView = $groupCondensedView = 0;
foreach $dchecklist (@checklisttable) {
($tinterval, $tgroep, $resultsdir, $ttest) = split(/\#/, $dchecklist, 4);
my @stest = split(/\|/, $ttest);
my $showGroepHeader = ($prevGroep ne $tgroep) ? 1 : 0;
my $showGroepFooter = (($prevGroep ne '') && $showGroepHeader) ? 1 : 0;
printGroepCV($prevGroep, $showGroepHeader, 1);
$prevGroep = $tgroep;
printGroepFooter('', $showGroepFooter);
printGroepHeader($tgroep, $showGroepHeader);
foreach $dtest (@stest) {
my ($catalogID_uniqueKey, $title, $test, $help) = split(/\#/, $dtest);
my ($catalogID, $uniqueKey) = split(/_/, $catalogID_uniqueKey);
unless ( defined $uniqueKey ) {
$uniqueKey = $catalogID;
$catalogID = $CATALOGID;
$catalogID_uniqueKey = $catalogID .'_'. $uniqueKey unless ( $catalogID eq 'CID' );
applications/display-test.pl view on Meta::CPAN
my ($command, undef) = split(/\.pl/, $test);
my $environment = (($test =~ /\-\-environment=([PASTDL])/) ? $1 : 'P');
next if (defined $environment and $environment ne $Cenvironment);
$configNumber++;
my $trendline = get_trendline_from_test($test);
my $commandPopup = maskPassword ($test);
$commandPopup =~ s/(?:\s+(--environment=[PASTDL]|--trendline=\d+))//g;
my $popup = "<TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT>Command</TD><TD BGCOLOR=#0000FF>$commandPopup</TD></TR><TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT>Environment</TD><TD BGCOLOR=#0000FF>".$ENVIRONMENT{$environment}."</TD></TR><TR><T...
print "<", $CATALOGID, "><", $environment, "><", $trendline, "><", $tgroep, "><", $resultsdir, "><", $catalogID_uniqueKey, "><", $catalogID, "><", $uniqueKey, "><", $title, "><", $test, ">\n" if ($debug);
my $number = 1;
my ($statusIcon, $itemTitle, $itemStatus, $itemTimeslot, $itemStatusIcon, $itemInsertInMCV, $inIMW);
$itemTimeslot = $itemStatusIcon = $itemInsertInMCV = 0;
$inIMW = 1;
my @arrayStatusMessage = ();
if ($dbh and $rv) {
my ($acked, $sql, $tLastStatus, $tLastTimeslot, $tPrevStatus, $tPrevTimeslot, $activationTimeslot, $suspentionTimeslot, $instability, $persistent, $downtime, $suspentionTimeslotPersistentTrue, $suspentionTimeslotPersistentFalse, $comment);
applications/display-test.pl view on Meta::CPAN
$lastTimeslot = get_timeslot ($creationDate);
$firstTimeslot = $lastTimeslot - ($step * $NUMBEROFFTESTS);
$timeCorrectie = 0;
if ( $trigger ) {
$findString = 'select SQL_NO_CACHE title, duration, timeslot, startTime, endTime, endDate, status, statusMessage, perfdata, filename from '.$SERVERTABLEVENTSDISPLAYDT.' where catalogID="' .$catalogID. '" and uKey = "'.$uniqueKey.'" and s...
} else {
$findString = 'select SQL_NO_CACHE title, duration, timeslot, startTime, endTime, endDate, status, statusMessage, perfdata, filename from '.$SERVERTABLEVENTS.' force index (uKey) where catalogID="' .$catalogID. '" and uKey = "'.$uniqueKe...
}
print "<", $findString, ">\n" if ($debug);
$sth = $dbh->prepare($findString) or $rv = errorTrapDBI($checklist, "Cannot dbh->prepare: $findString");
$sth->execute or $rv = errorTrapDBI($checklist, "Cannot sth->execute: $findString") if $rv;
my (@itemTimelocal, @itemStatus, @itemStarttime, @itemTimeslot, @tempStatusMessage);
@itemTimelocal = @itemStatus = @itemStarttime = @itemTimeslot = @tempStatusMessage = ();
$timeValue = $lastTimeslot;
for (; $number <= $NUMBEROFFTESTS; $number++) {
push (@itemTimelocal, $timeValue);
push (@itemStatus, ($number == 1) ? 'IN PROGRESS' : 'NO DATA');
push (@itemStarttime, sprintf ("%02d:%02d:%02d", (localtime($timeValue+$timeCorrectie))[2,1,0]));
push (@itemTimeslot, $timeValue);
push (@tempStatusMessage, undef);
$timeValue -= $step;
}
$timeValue = $lastTimeslot;
$inIMW = 1;
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);
}
applications/display-test.pl view on Meta::CPAN
$ref->{statusMessage} =~ s/[\n\r]/<br>/g;
$popup .= '<TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT VALIGN=TOP>Status</TD><TD BGCOLOR=#0000FF><IMG SRC='.$IMAGESURL.'/'.$statusIcon.' WIDTH=15 HEIGHT=15 title= alt= BORDER=0> '.$ref->{startTime}.' '.encode_html_entities('M', ...
}
}
}
}
$sth->finish() or $rv = errorTrapDBI($checklist, "Cannot sth->finish: $findString");
}
printItemHeader($environment, $resultsdir, $catalogID_uniqueKey, $catalogID, $uniqueKey, $command, $title, $help, $popup, $statusOverlib, $comment);
$playSoundPreviousStatus = $playSoundInProgress = 0;
for ($number = 0; $number < $NUMBEROFFTESTS; $number++) {
my $endTime = $itemStarttime[$number];
$endTime .= '-'. $itemTimeslot[$number] if ($displayTimeslot);
printItemStatus($tinterval, $number+1, $itemStatus[$number], $endTime, $acked, $itemTimeslot[$number], $activationTimeslot, $suspentionTimeslot, $instability, $persistent, $downtime, $suspentionTimeslotPersistentTrue, $suspentionTimeslotP...
}
for ($number = 0; $number < $NUMBEROFFTESTS; $number++) {
push (@arrayStatusMessage, $tempStatusMessage[$number] ) if (defined $tempStatusMessage[$number]);
}
$itemTitle = $title;
$itemStatus = ( $itemStatus[0] eq 'IN PROGRESS' ) ? $itemStatus[1] : $itemStatus[0];
$itemTimeslot = ( $itemStatus[0] eq 'IN PROGRESS' ) ? $itemTimelocal[1] : $itemTimelocal[0];
$itemStatusIcon = ( $acked and ( $activationTimeslot - $step < $itemTimeslot ) and ( $suspentionTimeslot > $itemTimeslot ) ) ? 1 : 0;
$itemInsertInMCV = ( $instability ) ? ( $persistent ? 0 : 1 ) : ( defined $inMCV{$tLastStatus}{$tPrevStatus} ? 1 : 0 );
}
printItemFooter($catalogID_uniqueKey, $catalogID, $uniqueKey, $itemTitle, $itemStatus, $itemTimeslot, $itemStatusIcon, $itemInsertInMCV, $inIMW, $itemFullCondensedView, $printCondensedView, \@arrayStatusMessage, \%catalogID_uKey_timeperiodID)...
}
print "\n" if ($debug);
}
printGroepCV($prevGroep, 1, 0);
if ($lockMySQL) {
if ($dbh and $rv) {
$unlockString = 'UNLOCK TABLES';
$dbh->do ( $unlockString ) or $rv = errorTrapDBI($checklist, "Cannot dbh->do: $unlockString");
}
}
$dbh->disconnect or $rv = errorTrapDBI($checklist, "Sorry, the database was unable to add your entry.") if ($dbh and $rv);
}
printGroepFooter('', 0);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$emptyMinimalCondencedView = ( scalar ( @multiarrayMinimalCondensedView ) ? 0 : 1 );
unless ( $emptyMinimalCondencedView ) {
@multiarrayMinimalCondensedView = ( sort { $b->[2] <=> $a->[2] } @multiarrayMinimalCondensedView );
@multiarrayMinimalCondensedView = ( sort { $b->[0] <=> $a->[0] } @multiarrayMinimalCondensedView );
@multiarrayMinimalCondensedView = ( sort { $a->[3] <=> $b->[3] } @multiarrayMinimalCondensedView );
@multiarrayMinimalCondensedView = ( sort { $a->[1] cmp $b->[1] } @multiarrayMinimalCondensedView );
my $currPriorityGroup = '-MVM-P01-';
foreach my $arrayFullCondensedView ( @multiarrayMinimalCondensedView ) {
# print @$arrayFullCondensedView[2], "-", @$arrayFullCondensedView[0], "-", @$arrayFullCondensedView[3], "-", @$arrayFullCondensedView[1], "\n" if ($debug);
if ( $currPriorityGroup ne @$arrayFullCondensedView[1] ) {
$currPriorityGroup = @$arrayFullCondensedView[1];
my (undef, undef, $priorityGroup) = split( /-/, $currPriorityGroup );
print HTMLMCV '<TR><TD class="GroupHeader" COLSPAN=', $colspanDisplayTime, '>', 'Priority: '. $priorityGroup, '</TD></TR>', "\n";
}
print HTMLMCV @$arrayFullCondensedView[4];
}
print HTMLMCV '<tr style="{height: 4;}"><TD></TD></TR>', "\n";
delete @multiarrayMinimalCondensedView[0..@multiarrayMinimalCondensedView];
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
printStatusHeader('', $configNumber, $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $playSoundStatus);
printStatusFooter('', $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $playSoundStatus);
printHtmlFooter('');
close(HTML);
rename("$htmlOutput.tmp", "$htmlOutput.html") if (-e "$htmlOutput.tmp");
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');
my $sql = "SELECT SQL_NO_CACHE DISTINCT $SERVERTABLVIEWS.catalogID, $SERVERTABLVIEWS.timeperiodID, $SERVERTABLTIMEPERIODS.sunday, $SERVERTABLTIMEPERIODS.monday, $SERVERTABLTIMEPERIODS.tuesday, $SERVERTABLTIMEPERIODS.wednesday, $SERVERTABLTIMEPERIOD...
print "<", $sql, ">\n" if ($debug);
my $sth = $dbh->prepare( $sql ) or $rv = errorTrapDBI($checklist, "Cannot dbh->prepare: $sql");
$sth->execute or $rv = errorTrapDBI($checklist, "Cannot sth->execute: $sql") if $rv;
if ($rv) {
if ( $sth->rows ) {
while (my $ref = $sth->fetchrow_hashref()) {
$$hash_timeperiodID_days{$ref->{catalogID}}->{$ref->{timeperiodID}}->{$WDAYS{sunday}} = ( $ref->{sunday} ) ? $ref->{sunday} : '';
$$hash_timeperiodID_days{$ref->{catalogID}}->{$ref->{timeperiodID}}->{$WDAYS{monday}} = ( $ref->{monday} ) ? $ref->{monday} : '';
$$hash_timeperiodID_days{$ref->{catalogID}}->{$ref->{timeperiodID}}->{$WDAYS{tuesday}} = ( $ref->{tuesday} ) ? $ref->{tuesday} : '';
applications/display-test.pl 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);
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);
my $sth = $dbh->prepare( $sql ) or $rv = errorTrapDBI($checklist, "Cannot dbh->prepare: $sql");
$sth->execute or $rv = errorTrapDBI($checklist, "Cannot sth->execute: $sql") if $rv;
if ($rv) {
while (my $ref = $sth->fetchrow_hashref()) {
$$hash_catalogID_uKey_timeperiodID{$ref->{catalogID}}->{$ref->{uKey}}->{ASNMTAP} = $ref->{timeperiodID};
}
$sth->finish() or $rv = errorTrapDBI($checklist, "Cannot sth->finish: $sql");
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 (-s "$APPLICATIONPATH/custom/sde.pm") {
require "$APPLICATIONPATH/custom/sde.pm";
getTimeperiodRelationshipsSDE( $serverName, $checklist, $hash_catalogID_uKey_timeperiodID, $debug );
}
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;
applications/display-test.pl view on Meta::CPAN
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];
my $timeperiodes = ( exists $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{$wDay} ) ? $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{$wDay} : $$timeperiodID_days{$catalogID}->{$$catalogID_uKey_timeperio...
if ($debug) {
# (localtime)[6]: weekday Number of days since Sunday (0 - 6)
my %WDAYS = ('0'=>'sunday','1'=>'monday','2'=>'tuesday','3'=>'wednesday','4'=>'thursday','5'=>'friday','6'=>'saturday');
print "catalogID: $catalogID, uniqueKey: $uniqueKey, year: $year, month: $month, day: $day, wDay: $wDay, ". $WDAYS{$wDay} .", timeperiodes: $timeperiodes\n";
print "catalogID_uKey_timeperiodID: ". $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{ASNMTAP} ."\n";
}
for my $timeperiode (split (/,/, $timeperiodes)) {
my ($from, $to) = split (/-/, $timeperiode);
if ( defined $from and defined $to ) {
$to =~ s/24:00/23:59/g;
print "$from, $to\n" if ($debug);
my ($from_hour, $from_min) = split (/:/, $from);
my ($to_hour, $to_min) = split (/:/, $to);
if ( defined $from_hour and defined $from_min and defined $to_hour and defined $to_min ) {
print "$from_hour, $from_min, $to_hour, $to_min\n" if ($debug);
my $from_time = timelocal(0, $from_min, $from_hour, $day, $Month, $Year );
my $to_time = timelocal(59, $to_min, $to_hour, $day, $Month, $Year );
if ( defined $from_time and defined $to_time ) {
$InIMW = ( ( $from_time <= $timeslot and $timeslot <= $to_time ) ? 1 : ( ( defined $InIMW ) ? $InIMW : 0 ) );
if ($debug) {
print "$from_time, $timeslot, $to_time\n";
print scalar (localtime($from_time)), "\n";
print scalar (localtime($timeslot)), "\n";
print scalar (localtime($to_time)), "\n";
print "$InIMW !\n";
}
}
}
}
}
$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
if ( $doChecklist ) {
$emptyMinimalCondencedViewMessage = $emptyCondencedViewMessage = $emptyFullViewMessage = 'No Monitored Applications';
} else {
$emptyMinimalCondencedViewMessage = $emptyCondencedViewMessage = $emptyFullViewMessage = 'Contact ASAP the server administrators, probably database problems!';
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (defined $emptyFullViewMessage) {
print HTML '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '"><BR><H1>', $emptyFullViewMessage, '</H1></TD></TR>', "\n", '</TABLE>', "\n";
} else {
print HTML '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '">', $STATUSHEADER01, '</TD></TR>', "\n", '</TABLE>', "\n";
}
print_legend (*HTML);
print HTML '<TABLE WIDTH="100%">', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (defined $emptyCondencedViewMessage) {
print HTMLCV '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '"><BR><H1>', $emptyCondencedViewMessage, '</H1></TD></TR>', "\n", '</TABLE>', "\n";
} else {
print HTMLCV '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '">', $STATUSHEADER01, '</TD></TR>', "\n", '</TABLE>', "\n";
}
print_legend (*HTMLCV);
print HTMLCV '<TABLE WIDTH="100%">', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (defined $emptyMinimalCondencedViewMessage) {
print HTMLMCV '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '"><BR><H1>', $emptyMinimalCondencedViewMessage, '</H1></TD></TR>', "\n", '</TABLE>', "\n";
} 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) {
print PNG <<EOM;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>$APPLICATION @ $BUSINESS</title>
<META HTTP-EQUIV="Expires" CONTENT="Wed, 10 Dec 2003 00:00:01 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Refresh" CONTENT="60">
<link rel="stylesheet" type="text/css" href="$HTTPSURL/asnmtap.css">
</HEAD>
<BODY>
EOM
print PNG '<IMG SRC="', $RESULTSURL, '/', $resultsdir, '/', $command, '-', $catalogID_uniqueKey, '-sql.png"></BODY></HTML>', "\n";
close(PNG);
} else {
print "Cannot create $htmlFilename!\n";
}
}
}
my ($posTokenFrom, $posTokenTo, $groep, $test, $serverID);
$posTokenFrom = index $title, '[';
if ($posTokenFrom eq -1) {
$groep = '';
$test = $title;
applications/display-test.pl view on Meta::CPAN
$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 );
}
if (-s "$APPLICATIONPATH/custom/cartography.pm") {
require "$APPLICATIONPATH/custom/cartography.pm";
$_exclaim .= printLinkToCartography( $serverName, $checklist, $catalogID, $uniqueKey );
}
# debug: toggleDiv(), pop-up: overlib() & pop-down: nd()
# onClick: overlib(), onDblClick: nd() & toggleDiv()
$_exclaim = "<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=2 BGCOLOR=#000000><TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT>Plugin</TD><TD BGCOLOR=#0000FF>$test</TD></TR>$popup<TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT>Unique Key</TD><TD B...
my $exclaim = '<TD WIDTH="56"><a href="javascript:void(0);" onDblClick="nd(); return toggleDiv(\''.$catalogID_uniqueKey.'\');" onClick="return overlib(\''.$_exclaim.'\', CAPTION, \'Exclaim\', STICKY, CLOSECLICK, CAPCOLOR, \'#000000\', FGCOLOR, \'#...
my $_comment = ( defined $comment ? 'onmouseover="return overlib(\''.$comment.'\', CAPTION, \'Comments\', STICKY, CLOSECLICK, CAPCOLOR, \'#000000\', FGCOLOR, \'#000000\', BGCOLOR, \''.$COLORS{$statusOverlib}.'\', HAUTO, VAUTO, WIDTH, 692, OFFSETX, ...
my $comments = '<a href="'. $HTTPSURL .'/cgi-bin/comments.pl?pagedir='.$pagedir.'&pageset='.$pageset.'&debug=F&CGICOOKIE=1&action=listView&catalogID='.$catalogID.'&uKey='.$uniqueKey.'" target="_self" '.$_comment.'><IMG SRC="...
my $helpfile = (defined $help and $help eq '1') ? '<A HREF="'. $HTTPSURL .'/cgi-bin/getHelpPlugin.pl?pagedir='.$pagedir.'&pageset='.$pageset.'&debug=F&CGICOOKIE=1&catalogID='.$catalogID.'&uKey='.$uniqueKey.'" target="_self"><IMG...
$checkOk = $checkSkip = $printCondensedView = $problemSolved = $verifyNumber = 0;
$inProgressNumber = -1;
$itemFullCondensedView = ' <TR>'."\n".' '.$exclaim.$comments.$helpfile."\n";
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 ) {
print HTML @$arrayFullCondensedView[4];
}
}
print HTML '<tr style="{height: 4;}"><TD></TD></TR>', "\n", if $showFooter;
}
if ($groupCondensedView) {
$emptyCondencedView = ( scalar ( @multiarrayFullCondensedView ) ? 0 : 1 );
unless ( $emptyCondencedView ) {
@multiarrayFullCondensedView = ( sort { $a->[2] <=> $b->[2] } @multiarrayFullCondensedView );
@multiarrayFullCondensedView = ( sort { $b->[0] <=> $a->[0] } @multiarrayFullCondensedView );
@multiarrayFullCondensedView = ( sort { $a->[3] <=> $b->[3] } @multiarrayFullCondensedView );
@multiarrayFullCondensedView = ( sort { $a->[1] <=> $b->[1] } @multiarrayFullCondensedView );
print HTMLCV '<TR><TD class="GroupHeader" COLSPAN=', $colspanDisplayTime, '>', encode_html_entities('T', $title), '</TD></TR>', "\n";
foreach my $arrayFullCondensedView ( @multiarrayFullCondensedView ) {
print HTMLCV @$arrayFullCondensedView[4] if ( @$arrayFullCondensedView[5] );
}
}
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}; }
} else {
my $playSoundSet = 0;
unless ( $printCondensedView or $problemSolved or $checkSkip == $inProgressNumber) {
if ( $number == 1 ) {
$verifyNumber = $VERIFYNUMBEROK;
if ( $interval and $interval < $VERIFYMINUTEOK ) {
$verifyNumber = int($VERIFYMINUTEOK / $interval);
if ( $verifyNumber > $NUMBEROFFTESTS ) {
$verifyNumber = $NUMBEROFFTESTS;
} elsif ($verifyNumber < $VERIFYNUMBEROK) {
$verifyNumber = $VERIFYNUMBEROK;
applications/display-test.pl view on Meta::CPAN
$notDowntimeOrPersistent = ( $solvedTimeslot >= $activationTimeslot ? 0 : 1 );
}
if ( $number <= $inProgressNumber ) {
$debugInfo .= "b-" if ($debug);
$checkOk++ if ( $status eq 'OK' );
if ( $notDowntimeOrPersistent and ($status eq 'IN PROGRESS' or $status eq 'OK' or $status eq 'NO TEST' or $status eq 'OFFLINE' ) ) {
$checkSkip++ unless ( $acked and $status eq 'NO TEST' );
} else {
$printCondensedView = 1
}
} elsif ( $checkOk < $verifyNumber ) {
$debugInfo .= "c-" if ($debug);
$printCondensedView = ( $checkSkip == $inProgressNumber ) ? 0 : 1;
}
if ( $checkOk >= $verifyNumber ) {
$debugInfo .= "s-" if ($debug);
$problemSolved = 1;
}
$printCondensedView = 0 if ($downtime and ! $persistent);
$debugInfo .= "$inIMW-$instability-$persistent-$downtime-$inProgressNumber-$verifyNumber-$checkOk-$checkSkip-$printCondensedView-$problemSolved-" if ($debug);
my $update = 0;
my $sqlWhere = '';
if ( $persistent == 0 ) {
if ( $problemSolved ) {
if ($solvedTimeslot > $activationTimeslot and ! $downtime) {
$sqlWhere = ' and persistent="0" and "' .$solvedTimeslot. '">activationTimeslot';
$update = 1;
}
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
} elsif ($statusMessage =~ /Cannot connect to WebLogic/ ) {
$errorMessage .= ' - Cannot connect to WebLogic';
}
# ***************************************************************************
# Error codes indicate an error with Cactus XML::Parser *
# ***************************************************************************
} elsif ($statusMessage =~ /Cactus XML::Parser:/ ) {
$statusMessage =~ s/\+{2}/\+\+<br>/g;
} elsif (-s "$APPLICATIONPATH/custom/display.pm") {
require "$APPLICATIONPATH/custom/display.pm";
$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";
}
$groupFullView += 1;
$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';
} else {
document.getElementById(div_id).style.display = 'none';
}
}
}
</script>
EOH
if ($playSoundStatus) {
print HTML <<EOH;
<script language="JavaScript" type="text/javascript">
var soundState = getSoundCookie( 'soundState' );
if ( soundState != null && soundState == 'on' ) {
playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
}
</script>
EOH
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print HTMLCV '</TABLE>', "\n";
print HTMLCV <<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';
} else {
document.getElementById(div_id).style.display = 'none';
}
}
}
</script>
EOH
if ($playSoundStatus) {
print HTMLCV <<EOH;
<script language="JavaScript" type="text/javascript">
var soundState = getSoundCookie( 'soundState' );
if ( soundState != null && soundState == 'on' ) {
playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
}
</script>
EOH
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print HTMLMCV '</TABLE>', "\n";
print HTMLMCV <<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';
} else {
document.getElementById(div_id).style.display = 'none';
}
}
}
</script>
EOH
if ($playSoundStatus) {
print HTMLMCV <<EOH;
<script language="JavaScript" type="text/javascript">
var soundState = getSoundCookie( 'soundState' );
if ( soundState != null && soundState == 'on' ) {
playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
}
</script>
EOH
}
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
applications/display.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::Display qw(:APPLICATIONS :DISPLAY :DBDISPLAY &encode_html_entities);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($opt_H $opt_V $opt_h $opt_C $opt_P $opt_D $opt_L $opt_t $opt_c $opt_T $opt_l $PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "display.pl";
my $prgtext = "Display 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 $checklist = "DisplayCT"; # default
my $htmlOutput = $HTTPSPATH .'/nav/index/index'; # default
my $pagedir = 'index'; # default
my $pageset = 'index'; # default
my $debug = 0; # default
my $loop = 0; # default
my $trigger = 0; # default
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,
"L:s" => \$opt_L, "loop:s" => \$opt_L,
"t:s" => \$opt_t, "trigger:s" => \$opt_t,
"c:s" => \$opt_c, "creationTime:s" => \$opt_c,
"T:s" => \$opt_T, "displayTime:s" => \$opt_T,
"l:s" => \$opt_l, "lockMySQL:s" => \$opt_l
);
if ($opt_V) { print_revision($PROGNAME, $version); exit; }
if ($opt_h) { print_help(); exit; }
($opt_H) || usage("MySQL hostname/address not specified\n");
my $serverName = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
($serverName) || usage("Invalid MySQL hostname/address: $opt_H\n");
if ($opt_C) { $checklist = $1 if ($opt_C =~ /([-.A-Za-z0-9]+)/); }
if ($opt_P) { $pagedir = $opt_P; }
if ($opt_D) {
if ($opt_D eq 'F' || $opt_D eq 'T') {
applications/display.pl view on Meta::CPAN
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my ($dchecklist, $dtest, $dfetch, $tinterval, $tgroep, $resultsdir, $ttest, $firstTimeslot, $lastTimeslot, $rvOpen);
my (@fetch, $dstart, $tstart, $start, $step, $names, $data, $rows, $columns, $line, $val, @vals);
my ($command, $tstatus, $tduration, $timeValue, $prevGroep, @multiarrayFullCondensedView, @multiarrayMinimalCondensedView);
my ($rv, $dbh, $sth, $lockString, $findString, $unlockString, $doChecklist, $timeCorrectie, $timeslot);
my ($groupFullView, $groupCondensedView, $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $itemFullCondensedView);
my ($checkOk, $checkSkip, $configNumber, $printCondensedView, $problemSolved, $verifyNumber, $inProgressNumber);
my ($playSoundInProgress, $playSoundPreviousStatus, $playSoundStatus, %tableSoundStatusCache);
my ($prevHour, $currHour, %timeperiodID_days, %catalogID_uKey_timeperiodID) = (-1, -1);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $boolean_daemonQuit = 0;
my $boolean_signal_hup = 0;
my $boolean_daemonControl = $loop;
my $colspanDisplayTime = $NUMBEROFFTESTS+2;
applications/display.pl view on Meta::CPAN
my $directory = $HTTPSPATH .'/nav/'. $pagedir;
create_dir ($directory) unless ( -e "$directory" );
my $pagedirOrig = $pagedir;
unless (fork) { # unless ($pid = fork) {
unless (fork) {
# if ($boolean_daemonControl) { sleep until getppid == 1; }
print "Main Daemon control loop for: <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
write_pid() if ($boolean_daemonControl);
if ($boolean_daemonControl) {
print "Set daemon catch signals for: <$PROGNAME v$version -C $checklist> pid: <$pidfile><", get_datetimeSignal(), ">\n";
write_tableSoundStatusCache ($checklist, $debug);
$SIG{HUP} = \&signalHUP;
$SIG{QUIT} = \&signalQUIT;
$SIG{__DIE__} = \&signal_DIE;
$SIG{__WARN__} = \&signal_WARN;
} else {
$boolean_daemonQuit = 1;
}
do {
applications/display.pl view on Meta::CPAN
if ($_ ne '') {
my ($key, $value) = split (/=>/, $_);
$tableSoundStatusCache { $key } = $value;
}
}
close(READ);
if ($debug) {
print "$APPLICATIONPATH/tmp/$checklist-sound-status.cache: READ\n";
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");
unless ( $rvOpen ) {
print "Cannot open $htmlOutput.tmp to create the html information\n";
exit 0;
}
$rvOpen = open(HTMLCV, ">$htmlOutput-cv.tmp");
unless ( $rvOpen ) {
print "Cannot open $htmlOutput-cv.tmp to create the html information\n";
exit 0;
}
$rvOpen = open(HTMLMCV, ">$htmlOutput-mcv.tmp");
unless ( $rvOpen ) {
print "Cannot open $htmlOutput-mcv.tmp to create the html information\n";
exit 0;
}
$prevGroep = '';
my $dstatusMessage;
my $creationDate;
if ( defined $creationTime ) {
my ($date, $time) = split (/ /, $creationTime);
my ($year, $month, $day) = split (/-/, $date);
my ($hour, $minute, $seconds) = split (/:/, $time);
$creationDate = timelocal ( $seconds, $minute, $hour, $day, $month-1, $year-1900 );
printHtmlHeader( $APPLICATION .' - '. $ENVIRONMENT{$Cenvironment} .' from '. $CATALOGID .' ('. scalar(localtime($creationDate)) .')' );
} else {
$creationDate = time();
printHtmlHeader( $APPLICATION .' - '. $ENVIRONMENT{$Cenvironment} .' from '. $CATALOGID );
}
$rv = 1;
$dbh = DBI->connect("DBI:mysql:$DATABASE:$serverName:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE") or $rv = errorTrapDBI($checklist, "Cannot connect to the database");
if ($lockMySQL) {
if ($dbh and $rv) {
$lockString = 'LOCK TABLES ' .$SERVERTABLEVENTS. ' READ';
$dbh->do ( $lockString ) or $rv = errorTrapDBI($checklist, "Cannot dbh->do: $lockString");
}
applications/display.pl view on Meta::CPAN
$inMCV{DEPENDENT}{UNKNOWN} = 1;
$groupFullView = $groupCondensedView = 0;
foreach $dchecklist (@checklisttable) {
($tinterval, $tgroep, $resultsdir, $ttest) = split(/\#/, $dchecklist, 4);
my @stest = split(/\|/, $ttest);
my $showGroepHeader = ($prevGroep ne $tgroep) ? 1 : 0;
my $showGroepFooter = (($prevGroep ne '') && $showGroepHeader) ? 1 : 0;
printGroepCV($prevGroep, $showGroepHeader, 1);
$prevGroep = $tgroep;
printGroepFooter('', $showGroepFooter);
printGroepHeader($tgroep, $showGroepHeader);
foreach $dtest (@stest) {
my ($catalogID_uniqueKey, $title, $test, $help) = split(/\#/, $dtest);
my ($catalogID, $uniqueKey) = split(/_/, $catalogID_uniqueKey);
unless ( defined $uniqueKey ) {
$uniqueKey = $catalogID;
$catalogID = $CATALOGID;
$catalogID_uniqueKey = $catalogID .'_'. $uniqueKey unless ( $catalogID eq 'CID' );
applications/display.pl view on Meta::CPAN
my ($command, undef) = split(/\.pl/, $test);
my $environment = (($test =~ /\-\-environment=([PASTDL])/) ? $1 : 'P');
next if (defined $environment and $environment ne $Cenvironment);
$configNumber++;
my $trendline = get_trendline_from_test($test);
my $commandPopup = maskPassword ($test);
$commandPopup =~ s/(?:\s+(--environment=[PASTDL]|--trendline=\d+))//g;
my $popup = "<TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT>Command</TD><TD BGCOLOR=#0000FF>$commandPopup</TD></TR><TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT>Environment</TD><TD BGCOLOR=#0000FF>".$ENVIRONMENT{$environment}."</TD></TR><TR><T...
print "<", $CATALOGID, "><", $environment, "><", $trendline, "><", $tgroep, "><", $resultsdir, "><", $catalogID_uniqueKey, "><", $catalogID, "><", $uniqueKey, "><", $title, "><", $test, ">\n" if ($debug);
my $number = 1;
my ($statusIcon, $itemTitle, $itemStatus, $itemTimeslot, $itemStatusIcon, $itemInsertInMCV, $inIMW);
$itemTimeslot = $itemStatusIcon = $itemInsertInMCV = 0;
$inIMW = 1;
my @arrayStatusMessage = ();
if ($dbh and $rv) {
my ($acked, $sql, $tLastStatus, $tLastTimeslot, $tPrevStatus, $tPrevTimeslot, $activationTimeslot, $suspentionTimeslot, $instability, $persistent, $downtime, $suspentionTimeslotPersistentTrue, $suspentionTimeslotPersistentFalse, $comment);
applications/display.pl view on Meta::CPAN
$lastTimeslot = get_timeslot ($creationDate);
$firstTimeslot = $lastTimeslot - ($step * $NUMBEROFFTESTS);
$timeCorrectie = 0;
if ( $trigger ) {
$findString = 'select SQL_NO_CACHE title, duration, timeslot, startTime, endTime, endDate, status, statusMessage, perfdata, filename from '.$SERVERTABLEVENTSDISPLAYDT.' where catalogID="' .$catalogID. '" and uKey = "'.$uniqueKey.'" and s...
} else {
$findString = 'select SQL_NO_CACHE title, duration, timeslot, startTime, endTime, endDate, status, statusMessage, perfdata, filename from '.$SERVERTABLEVENTS.' force index (uKey) where catalogID="' .$catalogID. '" and uKey = "'.$uniqueKe...
}
print "<", $findString, ">\n" if ($debug);
$sth = $dbh->prepare($findString) or $rv = errorTrapDBI($checklist, "Cannot dbh->prepare: $findString");
$sth->execute or $rv = errorTrapDBI($checklist, "Cannot sth->execute: $findString") if $rv;
my (@itemTimelocal, @itemStatus, @itemStarttime, @itemTimeslot, @tempStatusMessage);
@itemTimelocal = @itemStatus = @itemStarttime = @itemTimeslot = @tempStatusMessage = ();
$timeValue = $lastTimeslot;
for (; $number <= $NUMBEROFFTESTS; $number++) {
push (@itemTimelocal, $timeValue);
push (@itemStatus, ($number == 1) ? 'IN PROGRESS' : 'NO DATA');
push (@itemStarttime, sprintf ("%02d:%02d:%02d", (localtime($timeValue+$timeCorrectie))[2,1,0]));
push (@itemTimeslot, $timeValue);
push (@tempStatusMessage, undef);
$timeValue -= $step;
}
$timeValue = $lastTimeslot;
$inIMW = 1;
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);
}
applications/display.pl view on Meta::CPAN
$ref->{statusMessage} =~ s/[\n\r]/<br>/g;
$popup .= '<TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT VALIGN=TOP>Status</TD><TD BGCOLOR=#0000FF><IMG SRC='.$IMAGESURL.'/'.$statusIcon.' WIDTH=15 HEIGHT=15 title= alt= BORDER=0> '.$ref->{startTime}.' '.encode_html_entities('M', ...
}
}
}
}
$sth->finish() or $rv = errorTrapDBI($checklist, "Cannot sth->finish: $findString");
}
printItemHeader($environment, $resultsdir, $catalogID_uniqueKey, $catalogID, $uniqueKey, $command, $title, $help, $popup, $statusOverlib, $comment);
$playSoundPreviousStatus = $playSoundInProgress = 0;
for ($number = 0; $number < $NUMBEROFFTESTS; $number++) {
my $endTime = $itemStarttime[$number];
$endTime .= '-'. $itemTimeslot[$number] if ($displayTimeslot);
printItemStatus($tinterval, $number+1, $itemStatus[$number], $endTime, $acked, $itemTimeslot[$number], $activationTimeslot, $suspentionTimeslot, $instability, $persistent, $downtime, $suspentionTimeslotPersistentTrue, $suspentionTimeslotP...
}
for ($number = 0; $number < $NUMBEROFFTESTS; $number++) {
push (@arrayStatusMessage, $tempStatusMessage[$number] ) if (defined $tempStatusMessage[$number]);
}
$itemTitle = $title;
$itemStatus = ( $itemStatus[0] eq 'IN PROGRESS' ) ? $itemStatus[1] : $itemStatus[0];
$itemTimeslot = ( $itemStatus[0] eq 'IN PROGRESS' ) ? $itemTimelocal[1] : $itemTimelocal[0];
$itemStatusIcon = ( $acked and ( $activationTimeslot - $step < $itemTimeslot ) and ( $suspentionTimeslot > $itemTimeslot ) ) ? 1 : 0;
$itemInsertInMCV = ( $instability ) ? ( $persistent ? 0 : 1 ) : ( defined $inMCV{$tLastStatus}{$tPrevStatus} ? 1 : 0 );
}
printItemFooter($catalogID_uniqueKey, $catalogID, $uniqueKey, $itemTitle, $itemStatus, $itemTimeslot, $itemStatusIcon, $itemInsertInMCV, $inIMW, $itemFullCondensedView, $printCondensedView, \@arrayStatusMessage, \%catalogID_uKey_timeperiodID)...
}
print "\n" if ($debug);
}
printGroepCV($prevGroep, 1, 0);
if ($lockMySQL) {
if ($dbh and $rv) {
$unlockString = 'UNLOCK TABLES';
$dbh->do ( $unlockString ) or $rv = errorTrapDBI($checklist, "Cannot dbh->do: $unlockString");
}
}
$dbh->disconnect or $rv = errorTrapDBI($checklist, "Sorry, the database was unable to add your entry.") if ($dbh and $rv);
}
printGroepFooter('', 0);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$emptyMinimalCondencedView = ( scalar ( @multiarrayMinimalCondensedView ) ? 0 : 1 );
unless ( $emptyMinimalCondencedView ) {
@multiarrayMinimalCondensedView = ( sort { $b->[2] <=> $a->[2] } @multiarrayMinimalCondensedView );
@multiarrayMinimalCondensedView = ( sort { $b->[0] <=> $a->[0] } @multiarrayMinimalCondensedView );
@multiarrayMinimalCondensedView = ( sort { $a->[3] <=> $b->[3] } @multiarrayMinimalCondensedView );
@multiarrayMinimalCondensedView = ( sort { $a->[1] cmp $b->[1] } @multiarrayMinimalCondensedView );
my $currPriorityGroup = '-MVM-P01-';
foreach my $arrayFullCondensedView ( @multiarrayMinimalCondensedView ) {
# print @$arrayFullCondensedView[2], "-", @$arrayFullCondensedView[0], "-", @$arrayFullCondensedView[3], "-", @$arrayFullCondensedView[1], "\n" if ($debug);
if ( $currPriorityGroup ne @$arrayFullCondensedView[1] ) {
$currPriorityGroup = @$arrayFullCondensedView[1];
my (undef, undef, $priorityGroup) = split( /-/, $currPriorityGroup );
print HTMLMCV '<TR><TD class="GroupHeader" COLSPAN=', $colspanDisplayTime, '>', 'Priority: '. $priorityGroup, '</TD></TR>', "\n";
}
print HTMLMCV @$arrayFullCondensedView[4];
}
print HTMLMCV '<tr style="{height: 4;}"><TD></TD></TR>', "\n";
delete @multiarrayMinimalCondensedView[0..@multiarrayMinimalCondensedView];
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
printStatusHeader('', $configNumber, $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $playSoundStatus);
printStatusFooter('', $emptyFullView, $emptyCondencedView, $emptyMinimalCondencedView, $playSoundStatus);
printHtmlFooter('');
close(HTML);
rename("$htmlOutput.tmp", "$htmlOutput.html") if (-e "$htmlOutput.tmp");
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');
my $sql = "SELECT SQL_NO_CACHE DISTINCT $SERVERTABLVIEWS.catalogID, $SERVERTABLVIEWS.timeperiodID, $SERVERTABLTIMEPERIODS.sunday, $SERVERTABLTIMEPERIODS.monday, $SERVERTABLTIMEPERIODS.tuesday, $SERVERTABLTIMEPERIODS.wednesday, $SERVERTABLTIMEPERIOD...
print "<", $sql, ">\n" if ($debug);
my $sth = $dbh->prepare( $sql ) or $rv = errorTrapDBI($checklist, "Cannot dbh->prepare: $sql");
$sth->execute or $rv = errorTrapDBI($checklist, "Cannot sth->execute: $sql") if $rv;
if ($rv) {
if ( $sth->rows ) {
while (my $ref = $sth->fetchrow_hashref()) {
$$hash_timeperiodID_days{$ref->{catalogID}}->{$ref->{timeperiodID}}->{$WDAYS{sunday}} = ( $ref->{sunday} ) ? $ref->{sunday} : '';
$$hash_timeperiodID_days{$ref->{catalogID}}->{$ref->{timeperiodID}}->{$WDAYS{monday}} = ( $ref->{monday} ) ? $ref->{monday} : '';
$$hash_timeperiodID_days{$ref->{catalogID}}->{$ref->{timeperiodID}}->{$WDAYS{tuesday}} = ( $ref->{tuesday} ) ? $ref->{tuesday} : '';
applications/display.pl 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);
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);
my $sth = $dbh->prepare( $sql ) or $rv = errorTrapDBI($checklist, "Cannot dbh->prepare: $sql");
$sth->execute or $rv = errorTrapDBI($checklist, "Cannot sth->execute: $sql") if $rv;
if ($rv) {
while (my $ref = $sth->fetchrow_hashref()) {
$$hash_catalogID_uKey_timeperiodID{$ref->{catalogID}}->{$ref->{uKey}}->{ASNMTAP} = $ref->{timeperiodID};
}
$sth->finish() or $rv = errorTrapDBI($checklist, "Cannot sth->finish: $sql");
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 (-s "$APPLICATIONPATH/custom/sde.pm") {
require "$APPLICATIONPATH/custom/sde.pm";
getTimeperiodRelationshipsSDE( $serverName, $checklist, $hash_catalogID_uKey_timeperiodID, $debug );
}
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;
applications/display.pl view on Meta::CPAN
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];
my $timeperiodes = ( exists $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{$wDay} ) ? $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{$wDay} : $$timeperiodID_days{$catalogID}->{$$catalogID_uKey_timeperio...
if ($debug) {
# (localtime)[6]: weekday Number of days since Sunday (0 - 6)
my %WDAYS = ('0'=>'sunday','1'=>'monday','2'=>'tuesday','3'=>'wednesday','4'=>'thursday','5'=>'friday','6'=>'saturday');
print "catalogID: $catalogID, uniqueKey: $uniqueKey, year: $year, month: $month, day: $day, wDay: $wDay, ". $WDAYS{$wDay} .", timeperiodes: $timeperiodes\n";
print "catalogID_uKey_timeperiodID: ". $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{ASNMTAP} ."\n";
}
for my $timeperiode (split (/,/, $timeperiodes)) {
my ($from, $to) = split (/-/, $timeperiode);
if ( defined $from and defined $to ) {
$to =~ s/24:00/23:59/g;
print "$from, $to\n" if ($debug);
my ($from_hour, $from_min) = split (/:/, $from);
my ($to_hour, $to_min) = split (/:/, $to);
if ( defined $from_hour and defined $from_min and defined $to_hour and defined $to_min ) {
print "$from_hour, $from_min, $to_hour, $to_min\n" if ($debug);
my $from_time = timelocal(0, $from_min, $from_hour, $day, $Month, $Year );
my $to_time = timelocal(59, $to_min, $to_hour, $day, $Month, $Year );
if ( defined $from_time and defined $to_time ) {
$InIMW = ( ( $from_time <= $timeslot and $timeslot <= $to_time ) ? 1 : ( ( defined $InIMW ) ? $InIMW : 0 ) );
if ($debug) {
print "$from_time, $timeslot, $to_time\n";
print scalar (localtime($from_time)), "\n";
print scalar (localtime($timeslot)), "\n";
print scalar (localtime($to_time)), "\n";
print "$InIMW !\n";
}
}
}
}
}
$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
if ( $doChecklist ) {
$emptyMinimalCondencedViewMessage = $emptyCondencedViewMessage = $emptyFullViewMessage = 'No Monitored Applications';
} else {
$emptyMinimalCondencedViewMessage = $emptyCondencedViewMessage = $emptyFullViewMessage = 'Contact ASAP the server administrators, probably database problems!';
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (defined $emptyFullViewMessage) {
print HTML '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '"><BR><H1>', $emptyFullViewMessage, '</H1></TD></TR>', "\n", '</TABLE>', "\n";
} else {
print HTML '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '">', $STATUSHEADER01, '</TD></TR>', "\n", '</TABLE>', "\n";
}
print_legend (*HTML);
print HTML '<TABLE WIDTH="100%">', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (defined $emptyCondencedViewMessage) {
print HTMLCV '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '"><BR><H1>', $emptyCondencedViewMessage, '</H1></TD></TR>', "\n", '</TABLE>', "\n";
} else {
print HTMLCV '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '">', $STATUSHEADER01, '</TD></TR>', "\n", '</TABLE>', "\n";
}
print_legend (*HTMLCV);
print HTMLCV '<TABLE WIDTH="100%">', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (defined $emptyMinimalCondencedViewMessage) {
print HTMLMCV '<TR><TD class="StatusHeader" COLSPAN="', $colspanDisplayTime, '"><BR><H1>', $emptyMinimalCondencedViewMessage, '</H1></TD></TR>', "\n", '</TABLE>', "\n";
} 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) {
print PNG <<EOM;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>$APPLICATION @ $BUSINESS</title>
<META HTTP-EQUIV="Expires" CONTENT="Wed, 10 Dec 2003 00:00:01 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Refresh" CONTENT="60">
<link rel="stylesheet" type="text/css" href="$HTTPSURL/asnmtap.css">
</HEAD>
<BODY>
EOM
print PNG '<IMG SRC="', $RESULTSURL, '/', $resultsdir, '/', $command, '-', $catalogID_uniqueKey, '-sql.png"></BODY></HTML>', "\n";
close(PNG);
} else {
print "Cannot create $htmlFilename!\n";
}
}
}
my ($posTokenFrom, $posTokenTo, $groep, $test, $serverID);
$posTokenFrom = index $title, '[';
if ($posTokenFrom eq -1) {
$groep = '';
$test = $title;
applications/display.pl view on Meta::CPAN
$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 );
}
if (-s "$APPLICATIONPATH/custom/cartography.pm") {
require "$APPLICATIONPATH/custom/cartography.pm";
$_exclaim .= printLinkToCartography( $serverName, $checklist, $catalogID, $uniqueKey );
}
# debug: toggleDiv(), pop-up: overlib() & pop-down: nd()
# onClick: overlib(), onDblClick: nd() & toggleDiv()
$_exclaim = "<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=2 BGCOLOR=#000000><TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT>Plugin</TD><TD BGCOLOR=#0000FF>$test</TD></TR>$popup<TR><TD BGCOLOR=#000080 WIDTH=100 ALIGN=RIGHT>Unique Key</TD><TD B...
my $exclaim = '<TD WIDTH="56"><a href="javascript:void(0);" onDblClick="nd(); return toggleDiv(\''.$catalogID_uniqueKey.'\');" onClick="return overlib(\''.$_exclaim.'\', CAPTION, \'Exclaim\', STICKY, CLOSECLICK, CAPCOLOR, \'#000000\', FGCOLOR, \'#...
my $_comment = ( defined $comment ? 'onmouseover="return overlib(\''.$comment.'\', CAPTION, \'Comments\', STICKY, CLOSECLICK, CAPCOLOR, \'#000000\', FGCOLOR, \'#000000\', BGCOLOR, \''.$COLORS{$statusOverlib}.'\', HAUTO, VAUTO, WIDTH, 692, OFFSETX, ...
my $comments = '<a href="'. $HTTPSURL .'/cgi-bin/comments.pl?pagedir='.$pagedir.'&pageset='.$pageset.'&debug=F&CGICOOKIE=1&action=listView&catalogID='.$catalogID.'&uKey='.$uniqueKey.'" target="_self" '.$_comment.'><IMG SRC="...
my $helpfile = (defined $help and $help eq '1') ? '<A HREF="'. $HTTPSURL .'/cgi-bin/getHelpPlugin.pl?pagedir='.$pagedir.'&pageset='.$pageset.'&debug=F&CGICOOKIE=1&catalogID='.$catalogID.'&uKey='.$uniqueKey.'" target="_self"><IMG...
$checkOk = $checkSkip = $printCondensedView = $problemSolved = $verifyNumber = 0;
$inProgressNumber = -1;
$itemFullCondensedView = ' <TR>'."\n".' '.$exclaim.$comments.$helpfile."\n";
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 ) {
print HTML @$arrayFullCondensedView[4];
}
}
print HTML '<tr style="{height: 4;}"><TD></TD></TR>', "\n", if $showFooter;
}
if ($groupCondensedView) {
$emptyCondencedView = ( scalar ( @multiarrayFullCondensedView ) ? 0 : 1 );
unless ( $emptyCondencedView ) {
@multiarrayFullCondensedView = ( sort { $a->[2] <=> $b->[2] } @multiarrayFullCondensedView );
@multiarrayFullCondensedView = ( sort { $b->[0] <=> $a->[0] } @multiarrayFullCondensedView );
@multiarrayFullCondensedView = ( sort { $a->[3] <=> $b->[3] } @multiarrayFullCondensedView );
@multiarrayFullCondensedView = ( sort { $a->[1] <=> $b->[1] } @multiarrayFullCondensedView );
print HTMLCV '<TR><TD class="GroupHeader" COLSPAN=', $colspanDisplayTime, '>', encode_html_entities('T', $title), '</TD></TR>', "\n";
foreach my $arrayFullCondensedView ( @multiarrayFullCondensedView ) {
print HTMLCV @$arrayFullCondensedView[4] if ( @$arrayFullCondensedView[5] );
}
}
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}; }
} else {
my $playSoundSet = 0;
unless ( $printCondensedView or $problemSolved or $checkSkip == $inProgressNumber) {
if ( $number == 1 ) {
$verifyNumber = $VERIFYNUMBEROK;
if ( $interval and $interval < $VERIFYMINUTEOK ) {
$verifyNumber = int($VERIFYMINUTEOK / $interval);
if ( $verifyNumber > $NUMBEROFFTESTS ) {
$verifyNumber = $NUMBEROFFTESTS;
} elsif ($verifyNumber < $VERIFYNUMBEROK) {
$verifyNumber = $VERIFYNUMBEROK;
applications/display.pl view on Meta::CPAN
$notDowntimeOrPersistent = ( $solvedTimeslot >= $activationTimeslot ? 0 : 1 );
}
if ( $number <= $inProgressNumber ) {
$debugInfo .= "b-" if ($debug);
$checkOk++ if ( $status eq 'OK' );
if ( $notDowntimeOrPersistent and ($status eq 'IN PROGRESS' or $status eq 'OK' or $status eq 'NO TEST' or $status eq 'OFFLINE' ) ) {
$checkSkip++ unless ( $acked and $status eq 'NO TEST' );
} else {
$printCondensedView = 1
}
} elsif ( $checkOk < $verifyNumber ) {
$debugInfo .= "c-" if ($debug);
$printCondensedView = ( $checkSkip == $inProgressNumber ) ? 0 : 1;
}
if ( $checkOk >= $verifyNumber ) {
$debugInfo .= "s-" if ($debug);
$problemSolved = 1;
}
$printCondensedView = 0 if ($downtime and ! $persistent);
$debugInfo .= "$inIMW-$instability-$persistent-$downtime-$inProgressNumber-$verifyNumber-$checkOk-$checkSkip-$printCondensedView-$problemSolved-" if ($debug);
my $update = 0;
my $sqlWhere = '';
if ( $persistent == 0 ) {
if ( $problemSolved ) {
if ($solvedTimeslot > $activationTimeslot and ! $downtime) {
$sqlWhere = ' and persistent="0" and "' .$solvedTimeslot. '">activationTimeslot';
$update = 1;
}
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
} elsif ($statusMessage =~ /Cannot connect to WebLogic/ ) {
$errorMessage .= ' - Cannot connect to WebLogic';
}
# ***************************************************************************
# Error codes indicate an error with Cactus XML::Parser *
# ***************************************************************************
} elsif ($statusMessage =~ /Cactus XML::Parser:/ ) {
$statusMessage =~ s/\+{2}/\+\+<br>/g;
} elsif (-s "$APPLICATIONPATH/custom/display.pm") {
require "$APPLICATIONPATH/custom/display.pm";
$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";
}
$groupFullView += 1;
$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';
} else {
document.getElementById(div_id).style.display = 'none';
}
}
}
</script>
EOH
if ($playSoundStatus) {
print HTML <<EOH;
<script language="JavaScript" type="text/javascript">
var soundState = getSoundCookie( 'soundState' );
if ( soundState != null && soundState == 'on' ) {
playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
}
</script>
EOH
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print HTMLCV '</TABLE>', "\n";
print HTMLCV <<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';
} else {
document.getElementById(div_id).style.display = 'none';
}
}
}
</script>
EOH
if ($playSoundStatus) {
print HTMLCV <<EOH;
<script language="JavaScript" type="text/javascript">
var soundState = getSoundCookie( 'soundState' );
if ( soundState != null && soundState == 'on' ) {
playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
}
</script>
EOH
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print HTMLMCV '</TABLE>', "\n";
print HTMLMCV <<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';
} else {
document.getElementById(div_id).style.display = 'none';
}
}
}
</script>
EOH
if ($playSoundStatus) {
print HTMLMCV <<EOH;
<script language="JavaScript" type="text/javascript">
var soundState = getSoundCookie( 'soundState' );
if ( soundState != null && soundState == 'on' ) {
playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
}
</script>
EOH
}
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
applications/htmlroot/cgi-bin/admin/countries.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :ADMIN :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "countries.pl";
my $prgtext = "Countries";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
applications/htmlroot/cgi-bin/admin/countries.pl view on Meta::CPAN
# 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...
applications/htmlroot/cgi-bin/admin/countries.pl view on Meta::CPAN
}
}
$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;
}
if ( document.countries.countryName.value == null || document.countries.countryName.value == '' ) {
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">
<input type="hidden" name="action" value="$nextAction">
<input type="hidden" name="orderBy" value="$orderBy">
HTML
} else {
print "<br>\n";
}
print " <input type=\"hidden\" name=\"countryID\" value=\"$CcountryID\">\n" if ($formDisabledPrimaryKey ne '' and $action ne 'displayView');
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=insertView&orderBy=$orderBy">[Insert country]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=listView&orderBy=$orderBy">[List all countries]</a></td>
</tr></table>
</td></tr>
HTML
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
my $activatedChecked = ($Cactivated eq 'on') ? ' checked' : '';
print <<HTML;
<tr><td> </td></tr>
<tr><td>
<table border="0" cellspacing="0" cellpadding="0">
<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";
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print "</form>\n";
} else {
print "<br>\n";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :SADMIN :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "crontabs.pl";
my $prgtext = "Crontabs";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
# 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...
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
($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">
function validateForm() {
var objectRegularExpressionLineNumberFormat = /\^\\d\\d\$/;
// example: 1,2,5-9,12-16/n,19|*|*/n
var objectRegularExpressionCrontabFormat = /\^(?:(?:\\*\\/$crontabFormatDigits){1,1}|$crontabFormatDigits(?:[,-]$crontabFormatDigits(?:\\/$crontabFormatDigits)?)\*){1,1}\$/;
// min (0-59)
var objectRegularExpressionMinuteValue = /\^(?:(?:\\*\\/$crontabValueDigitsMin){1,1}|$crontabValueDigitsMin(?:[,-]$crontabValueDigitsMin(?:\\/$crontabValueDigitsMin)?)\*){1,1}\$/;
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
var objectRegularExpressionDayOfTheMontValue = /\^(?:(?:\\*\\/$crontabFormatDigits){1,1}|$crontabFormatDigits(?:[,-]$crontabFormatDigits(?:\\/$crontabFormatDigits)?)\*){1,1}\$/;
// month of year (1-12)
var objectRegularExpressionMontOfTheYearValue = /\^(?:(?:\\*\\/$crontabValueDigitsMonthOfYear){1,1}|$crontabValueDigitsMonthOfYear(?:[,-]$crontabValueDigitsMonthOfYear(?:\\/$crontabValueDigitsMonthOfYear)?)\*){1,1}\$/;
// day of week (0-6)
var objectRegularExpressionDayOfTheWeekValue = /\^(?:(?:\\*\\/$crontabValueDigitsDayOfWeek){1,1}|$crontabValueDigitsDayOfWeek(?:[,-]$crontabValueDigitsDayOfWeek(?:\\/$crontabValueDigitsDayOfWeek)?)\*){1,1}\$/;
HTML
if ( $action ne 'crontabView' ) {
print <<HTML;
if ( document.crontabs.collectorDaemon.options[document.crontabs.collectorDaemon.selectedIndex].value == 'none' ) {
document.crontabs.collectorDaemon.focus();
alert('Please create/select a crontab collectorDaemon!');
return false;
}
HTML
}
if ($action eq 'duplicateView' or $action eq 'insertView') {
print <<HTML;
if ( document.crontabs.lineNumber.value == null || document.crontabs.lineNumber.value == '' ) {
document.crontabs.lineNumber.focus();
alert('Please enter a line number!');
return false;
} else {
if ( ! objectRegularExpressionLineNumberFormat.test(document.crontabs.lineNumber.value) ) {
document.crontabs.lineNumber.focus();
alert('Please re-enter line number: Bad line number format!');
return false;
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
if( document.crontabs.uKey.options[document.crontabs.uKey.selectedIndex].value == 'none' ) {
document.crontabs.uKey.focus();
alert('Please create/select one of the applications!');
return false;
}
HTML
}
if ( $action ne 'crontabView' ) {
print <<HTML;
if ( document.crontabs.minute.value == null || document.crontabs.minute.value == '' ) {
document.crontabs.minute.focus();
alert('Please enter minute!');
return false;
} else {
if ( document.crontabs.minute.value != '*' ) {
if ( ! objectRegularExpressionCrontabFormat.test(document.crontabs.minute.value) ) {
document.crontabs.minute.focus();
alert('Please re-enter minute: Bad minute format!');
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
if ( ! objectRegularExpressionDayOfTheWeekValue.test(document.crontabs.dayOfTheWeek.value) ) {
document.crontabs.dayOfTheWeek.focus();
alert('Please re-enter day of the week: Bad day of the week value!');
return false;
}
}
}
HTML
}
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">
<input type="hidden" name="action" value="$nextAction">
<input type="hidden" name="orderBy" value="$orderBy">
<input type="hidden" name="catalogIDreload" value="0">
HTML
} else {
print "<br>\n";
}
if ($formDisabledPrimaryKey ne '' and $action ne 'displayView') {
print " <input type=\"hidden\" name=\"catalogID\" value=\"$CcatalogID\">\n";
print " <input type=\"hidden\" name=\"uKey\" value=\"$CuKey\">\n";
print " <input type=\"hidden\" name=\"lineNumber\" value=\"$ClineNumber\">\n";
} elsif ($action eq 'crontabView') {
print " <input type=\"hidden\" name=\"catalogID\" value=\"$CcatalogID\">\n";
}
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&pageNo=1&pageOffset=0&action=insertView&orderBy=$orderBy">[Insert crontab]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&pageNo=1&pageOffset=0&action=listView&orderBy=$orderBy">[List all crontabs]</a></td>
<td class="StatusItem"> </td>
<td class="StatusItem"><a href="$urlWithAccessParameters&pageNo=1&pageOffset=0&action=crontabView&orderBy=$orderBy">[List selected crontabs]</a></td>
</tr></table>
</td></tr>
HTML
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView' or $action eq 'crontabView') {
my $activatedChecked = ($Cactivated eq 'on') ? ' checked' : '';
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>
<tr><td><b>Collector Daemon: </b></td><td>
$collectorDaemonSelect
</td></tr>
<tr><td><b>Application: </b></td><td>
$uKeySelect
</td></tr>
HTML
if ( $action ne 'crontabView' ) {
print <<HTML;
<tr><td><b>Line Number: </b></td><td>
<input type="text" name="lineNumber" value="$ClineNumber" size="2" maxlength="2" $formDisabledPrimaryKey> format/value: 00-99
</td></tr>
HTML
}
if ( $action ne 'crontabView' ) {
my $noOfflineSelect = create_combobox_from_keys_and_values_pairs ('=>|noOFFLINE=>noOFFLINE|multiOFFLINE=>multiOFFLINE|noTEST=>noTEST', 'K', 0, $CnoOffline, 'noOffline', '', '', $formDisabledAll, '', $debug);
print <<HTML;
<tr><td><b>Arguments: </b></td><td>
<input type="text" name="arguments" value="$Carguments" size="100" maxlength="1024" $formDisabledAll>
</td></tr>
<tr><td><b>Minute: </b></td><td>
<input type="text" name="minute" value="$Cminute" size="100" maxlength="167" $formDisabledAll> format: 0,1,2-29,30-58/2,59|*|*/n value: 0-59
</td></tr>
<tr><td><b>Hour: </b></td><td>
<input type="text" name="hour" value="$Chour" size="61" maxlength="61" $formDisabledAll> format: 0,1,2-11,12-22/2,23|*|*/n value: 0-23
</td></tr>
<tr><td><b>Day of the Month: </b></td><td>
applications/htmlroot/cgi-bin/admin/crontabs.pl view on Meta::CPAN
</td></tr>
<tr><td><b>Day of the Week: </b></td><td>
<input type="text" name="dayOfTheWeek" value="$CdayOfTheWeek" size="13" maxlength="13" $formDisabledAll> format: 0,1,2-3,4-5/2,6|*|*/n value: 0-6, 0: Sunday
</td></tr>
<tr><td><b>no Offline: </b></td><td>
$noOfflineSelect
</td></tr>
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";
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 "</form>\n";
} else {
print "<br>\n";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :SADMIN :DBREADWRITE :DBTABLES $DIFFCOMMAND $RSYNCCOMMAND $SCPCOMMAND $SSHCOMMAND );
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "generateConfig.pl";
my $prgtext = "Generate Config";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $action = (defined $cgi->param('action')) ? $cgi->param('action') : 'menuView';
my $Cauto = (defined $cgi->param('auto')) ? $cgi->param('auto') : 0;
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
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";
my ($compareView, $installView, $initializeGenerateView, $matchingWarnings, $countWarnings, $matchingErrors, $countErrors, $matchingArchiveCT, $matchingCollectorCT, $matchingAsnmtapCollectorCTscript, $matchingDisplayCT, $matchingAsnmtapDisplayCTscr...
$compareView = $installView = $initializeGenerateView = $matchingWarnings = $matchingErrors = $matchingArchiveCT = $matchingCollectorCT = $matchingAsnmtapCollectorCTscript = $matchingDisplayCT = $matchingAsnmtapDisplayCTscript = $matchingRsyncMirro...
$countWarnings = $countErrors = 0;
if ($action eq 'checkView') {
$htmlTitle = "Check Configuration";
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...
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$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) {
if ($prevServerID ne '') {
if ($rvOpen) {
print ArchiveCT "#\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Einde ArchiveCT - $prevServerID\n";
close(ArchiveCT);
$rvOpen = 0;
if ($prevTypeServers) {
$typeMonitoringCharDorC = ($prevTypeMonitoring) ? 'D' : 'C';
$matchingArchiveCT .= system_call ("cp", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$prevTypeActiveServer-$prevMasterFQDN/etc/ArchiveCT $APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringC...
}
$matchingArchiveCT .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>ArchiveCT - $prevServerID, generated on $configDateTime, ASNMTAP v$version or higher</td></tr>";
}
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if ($typeServers) {
$matchingArchiveCT .= system_call ("mkdir", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN", $debug);
$matchingArchiveCT .= system_call ("mkdir", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/etc", $debug);
}
$rvOpen = open(ArchiveCT, ">$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/ArchiveCT");
if ($rvOpen) {
$matchingArchiveCT .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/ArchiveCT\" target=\"_blank\">ArchiveCT</a></td></tr>";
print ArchiveCT "# ArchiveCT - $serverID, generated on $configDateTime, ASNMTAP v$version or higher\n#\n# <resultsdir>#[<catalogID>_]<uniqueKey>#check_nnn[|[<catalogID>_]<uniqueKey>#check_mmm]\n#\n# # # # # # # # # # # # # # # # # #...
}
}
if ($rvOpen) {
print ArchiveCT "#\n" if ( $prevResultsdir ne $resultsdir );
my $catalogID_uKey = ( ( $catalogID eq 'CID' ) ? '' : $catalogID .'_' ) . $uKey;
print ArchiveCT "$resultsdir#$catalogID_uKey#$test\n";
}
$prevServerID = $serverID;
$prevTypeMonitoring = $typeMonitoring;
$prevTypeServers = $typeServers;
$prevTypeActiveServer = $typeActiveServer;
$prevMasterFQDN = $masterFQDN;
$prevMasterASNMTAP_PATH = $masterASNMTAP_PATH;
$prevMasterRSYNC_PATH = $masterRSYNC_PATH;
$prevMasterSSH_PATH = $masterSSH_PATH;
$prevSlaveFQDN = $slaveFQDN;
$prevSlaveASNMTAP_PATH = $slaveASNMTAP_PATH;
$prevSlaveRSYNC_PATH = $slaveRSYNC_PATH;
$prevSlaveSSH_PATH = $slaveSSH_PATH;
$prevResultsdir = $resultsdir;
}
if ($rvOpen) {
print ArchiveCT "#\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Einde ArchiveCT - $serverID\n";
close(ArchiveCT);
$rvOpen = 0;
if ($typeServers) {
$typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
$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>";
}
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
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 '' ) {
if ($rvOpen) {
print DisplayCT "#\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Einde DisplayCT-$prevDisplayDaemon - $serverID\n";
close(DisplayCT);
$rvOpen = 0;
$typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
$matchingDisplayCT .= system_call ("cp", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/DisplayCT-$prevDisplayDaemon $APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$type...
$matchingDisplayCT .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>DisplayCT-$prevDisplayDaemon, generated on $configDateTime, ASNMTAP v$version or higher</td></tr>";
}
}
$matchingDisplayCT .= "\n <tr><th>DisplayCT - $serverID</th></tr>" if ( $prevDisplayDaemon ne $displayDaemon );
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if ( $typeServers ) {
$matchingDisplayCT .= system_call ("mkdir", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN", $debug);
$matchingDisplayCT .= system_call ("mkdir", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave", $debug);
$matchingDisplayCT .= createDisplayCTscript ($typeMonitoringCharDorC, 'S', $typeActiveServer, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH, $centralSlaveDatabaseFQDN, "slave", $displayDaemon, $pagedirs, $loop, ...
}
$rvOpen = open(DisplayCT, ">$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/DisplayCT-$displayDaemon");
if ($rvOpen) {
$matchingDisplayCT .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/DisplayCT-$displayDaemon\" target=\"_blank\">DisplayCT-$d...
print DisplayCT "# DisplayCT-$displayDaemon - $serverID, generated on $configDateTime, ASNMTAP v$version or higher\n#\n# <interval>#<groep title>#<resultsdir>#[<catalogID>_]<uniqueKey>#<titel nnn>#check_nnn#<help 0|1>[|[<catalogID...
}
} else {
print DisplayCT "#\n" if ( $prevGroupTitle ne $groupTitle and $prevGroupTitle ne '' );
}
if ($rvOpen) {
my $catalogID_uKey = ( ( $catalogID eq 'CID' ) ? '' : $catalogID .'_' ) . $uKey;
print DisplayCT "$interval#$groupTitle#$resultsdir#$catalogID_uKey#$title#$test --environment=$environment --trendline=$trendline#";
(! defined $helpPluginFilename or $helpPluginFilename eq '<NIHIL>') ? print DisplayCT "0" : print DisplayCT "1";
print DisplayCT "\n";
}
$prevDisplayDaemon = $displayDaemon;
$prevGroupTitle = $groupTitle;
}
if ($rvOpen) {
print DisplayCT "#\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Einde DisplayCT-$displayDaemon - $serverID\n";
close(DisplayCT);
$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";
}
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$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 ) {
if ( $prevCollectorDaemon ne '' ) {
if ($rvOpen) {
print CollectorCT "#\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Einde CollectorCT-$prevCollectorDaemon - $prevServerID";
close(CollectorCT);
$rvOpen = 0;
$typeMonitoringCharDorC = ($prevTypeMonitoring) ? 'D' : 'C';
if ($prevTypeServers) {
$matchingCollectorCT .= system_call ("cp", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$prevTypeActiveServer-$prevMasterFQDN/etc/CollectorCT-$prevCollectorDaemon $APPLICATIONPATH/tmp/$CONFIGDIR/gene...
my ($hostnameAdminCollector, undef) = split (/\./, $prevMasterFQDN, 2);
if ( $prevCollectorDaemon eq $hostnameAdminCollector ) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if ( $typeServers ) { # Failover
$matchingCollectorCT .= system_call ("mkdir", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN", $debug);
$matchingCollectorCT .= system_call ("mkdir", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave", $debug);
$matchingCollectorCT .= createCollectorCTscript ($typeMonitoringCharDorC, 'S', $typeActiveServer, $slaveFQDN, $masterFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH, $centralSlaveDatabaseFQDN, "slave", $collectorDaemon, $...
}
$rvOpen = open(CollectorCT, ">$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/CollectorCT-$collectorDaemon");
if ($rvOpen) {
$matchingCollectorCT .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/CollectorCT-$collectorDaemon\" target=\"_blank\">Collecto...
print CollectorCT "# CollectorCT-$collectorDaemon - $serverID, generated on $configDateTime, ASNMTAP v$version or higher\n#\n# <minute (0-59)> <hour (0-23)> <day of the month (1-31)> <month of the year (1-12)> <day of the week (0-6 ...
}
} else {
print CollectorCT "#\n" if ( $prevUniqueKey ne $uKey and $prevUniqueKey ne '');
}
if ($rvOpen) {
my $catalogID_uKey = ( ( $catalogID eq 'CID' ) ? '' : $catalogID .'_' ) . $uKey;
print CollectorCT "$minute $hour $dayOfTheMonth $monthOfTheYear $dayOfTheWeek $interval $catalogID_uKey#$resultsdir#$title#$test";
print CollectorCT " --environment=$environment --trendline=$trendline";
print CollectorCT " $argumentsCommon" if ( $argumentsCommon ne '' );
print CollectorCT " $argumentsCrontab" if ( $argumentsCrontab ne '' );
print CollectorCT "#$noOffline" if ( $noOffline ne '' );
print CollectorCT "\n";
}
$prevServerID = $serverID;
$prevTypeMonitoring = $typeMonitoring;
$prevTypeServers = $typeServers;
$prevTypeActiveServer = $typeActiveServer;
$prevMasterFQDN = $masterFQDN;
$prevMasterASNMTAP_PATH = $masterASNMTAP_PATH;
$prevMasterRSYNC_PATH = $masterRSYNC_PATH;
$prevMasterSSH_PATH = $masterSSH_PATH;
$prevSlaveFQDN = $slaveFQDN;
$prevSlaveASNMTAP_PATH = $slaveASNMTAP_PATH;
$prevSlaveRSYNC_PATH = $slaveRSYNC_PATH;
$prevSlaveSSH_PATH = $slaveSSH_PATH;
$prevCollectorDaemon = $collectorDaemon;
$prevUniqueKey = $uKey;
}
if ($rvOpen) {
print CollectorCT "#\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Einde CollectorCT-$collectorDaemon - $serverID\n";
close(CollectorCT);
$rvOpen = 0;
$typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
if ($prevTypeServers) {
$matchingCollectorCT .= system_call ("cp", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/etc/CollectorCT-$collectorDaemon $APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMoni...
my ($hostnameAdminCollector, undef) = split (/\./, $masterFQDN, 2);
if ( $collectorDaemon eq $hostnameAdminCollector ) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$installView .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>We <b>moved</b> $APPLICATIONPATH/tmp/$CONFIGDIR/generated to $APPLICATIONPATH/tmp/$CONFIGDIR/installed</td></tr>";
} else {
$installView .= "\n <tr><td>The generated configuration doesn't exist.</td></tr>";
}
$installView .= "\n </table>";
}
if ( $rv ) {
if ($action eq 'installView') {
print " <form action=\"" . $ENV{SCRIPT_NAME} . "\" method=\"post\" name=\"generateConfig\">\n";
my $_action = ( ( $Cauto == 1 ) ? 'install' : $action );
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="action" value="$_action">
<input type="hidden" name="auto" value="1">
HTML
}
if ($action eq 'updateView' or $action eq 'update') {
print " <table width=\"100%\"><tr align=\"center\"><td>\n";
print " <table bgcolor=\"$COLORSTABLE{TABLE}\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\"\n";
print " <tr><td bgcolor=\"$COLORSTABLE{ENDBLOCK}\" colspan=\"2\" align=\"center\"> <b>$action: Under Construction</b> </td></tr>\n";
print " <tr><td bgcolor=\"$COLORSTABLE{NOBLOCK}\"> plugin </td><td> $Cplugin </td></tr>\n";
print " <tr><td bgcolor=\"$COLORSTABLE{NOBLOCK}\"> help plugin filename </td><td> $ChelpPluginFilename </td></tr>\n";
print " <tr><td bgcolor=\"$COLORSTABLE{NOBLOCK}\"> todo </td><td> $Ctodo </td></tr>\n";
print " </table>\n";
print " </td></tr></table>\n";
} else {
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
<td class="StatusItem"><a href="$urlWithAccessParameters&action=checkView&auto=0">[Check Configuration]</a></td>
<td class="StatusItem"> </td>
<td class="StatusItem"><a href="$urlWithAccessParameters&action=generateView&auto=0">[Generate Configuration]</a></td>
<td class="StatusItem"> </td>
<td class="StatusItem"><a href="$urlWithAccessParameters&action=compareView&auto=0">[Compare Configurations]</a></td>
<td class="StatusItem"> </td>
<td class="StatusItem"><a href="$urlWithAccessParameters&action=installView&auto=0">[Dry Run Generated Configuration]</a></td>
<td class="StatusItem"> </td>
<td class="StatusItem"><a href="$urlWithAccessParameters&action=installView&auto=1">[Install Generated Configuration]</a></td>
</tr></table>
</td></tr>
HTML
}
if ($action ne "menuView") {
print " <tr align=\"center\"><td>\n <table>\n";
if ($action eq 'checkView' or $action eq 'generateView') {
print " <tr align=\"center\"><td> </td></tr>\n <tr align=\"center\"><td>$matchingWarnings</td></tr>\n" if ($countWarnings);
print " <tr align=\"center\"><td> </td></tr>\n <tr align=\"center\"><td>$matchingErrors</td></tr>\n" if ($countErrors);
print " <tr align=\"center\"><td> </td></tr>\n <tr align=\"center\"><td>Warning: $countWarnings, Errors: $countErrors</td></tr>\n";
}
if ($action eq 'generateView') {
if ($countErrors == 0) {
print <<HTML;
<tr align="center"><td> </td></tr>
<tr align="center"><td>$initializeGenerateView</td></tr>
<tr align="center"><td> </td></tr>
<tr align="center"><td>$matchingArchiveCT</td></tr>
<tr align="center"><td> </td></tr>
<tr align="center"><td>$matchingDisplayCT</td></tr>
<tr align="center"><td> </td></tr>
<tr align="center"><td>$matchingAsnmtapDisplayCTscript</td></tr>
<tr align="center"><td> </td></tr>
<tr align="center"><td>$matchingCollectorCT</td></tr>
<tr align="center"><td> </td></tr>
<tr align="center"><td>$matchingAsnmtapCollectorCTscript</td></tr>
<tr align="center"><td> </td></tr>
<tr align="center"><td>$matchingRsyncMirror</td></tr>
HTML
} else {
print " <tr align=\"center\"><td> </td></tr>\n <tr align=\"center\"><td>Errors: $countErrors, first solve them PLEASE</td></tr>\n";
}
} elsif ($action eq 'compareView') {
print <<HTML;
<tr align=\"center\"><td> </td></tr>
<tr align=\"center\"><td>$compareView</td></tr>
HTML
} elsif ($action eq 'installView' or $action eq 'install') {
print <<HTML;
<tr align=\"center\"><td> </td></tr>
<tr align=\"center\"><td>$installView</td></tr>
HTML
}
print " </table>\n </td></tr>\n";
}
print " </table>\n";
if ($action eq 'installView') {
print "</form>\n";
} else {
print "<br>\n";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping
AMNAME=\"Collector ASNMTAP $collectorDaemon\"
AMPATH=$serverASNMTAP_PATH/applications
AMCMD=collector.pl
AMPARA=\"--hostname=$databaseFQDN --mode=$mode --collectorlist=CollectorCT-$collectorDaemon --dumphttp=$dumphttp --status=$status --debug=$debugDaemon --screenDebug=$debugAllScreen --allDebug=$debugAllFile --nokDebug=$debugNokFile\"
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
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' ..."
cd \$AMPATH
STARTUPFILE
my ($hostname, undef) = split (/\./, $serverFQDN, 2);
my ($hostnameAdminCollector, undef) = split (/\./, $serverAdminCollectorFQDN, 2);
if ( $typeServersCharMorS eq $typeActiveServer or $choise eq 'stop' ) {
foreach my $matchingAsnmtapCollectorCTscript (@matchingAsnmtapCollectorCTscript) {
unless ( $matchingAsnmtapCollectorCTscript eq "CollectorCT-${hostnameAdminCollector}.sh" ) {
print AsnmtapCollectorCTscript " ./$matchingAsnmtapCollectorCTscript $choise\n";
}
}
} else {
print AsnmtapCollectorCTscript " ./CollectorCT-${hostname}.sh $choise\n";
}
print AsnmtapCollectorCTscript <<STARTUPFILE;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE
}
print AsnmtapCollectorCTscript <<STARTUPFILE;
# See how we were called.
case "\$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
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]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping
AMNAME=\"Display ASNMTAP $displayDaemon\"
AMPATH=$serverASNMTAP_PATH/applications
AMCMD=display.pl
AMPARA=\"--hostname=$databaseFQDN --checklist=DisplayCT-$displayDaemon --pagedir=$pagedirs --loop=$loop --trigger=$trigger --displayTime=$displayTime --lockMySQL=$lockMySQL --debug=$debugDaemon\"
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
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' ..."
cd \$AMPATH
STARTUPFILE
if ($typeServersCharMorS eq $typeActiveServer or $choise eq 'stop') {
foreach my $matchingAsnmtapDisplayCTscript (@matchingAsnmtapDisplayCTscript) { print AsnmtapDisplayCTscript " ./$matchingAsnmtapDisplayCTscript $choise\n"; }
}
print AsnmtapDisplayCTscript <<STARTUPFILE;
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE
}
print AsnmtapDisplayCTscript <<STARTUPFILE;
# See how we were called.
case "\$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
# --------------------------------------------------------------------------
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/master/rsync-wrapper-failover-$masterFQDN.sh";
unless ( -e $filename ) {
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>Failover between $masterFQDN and $slaveFQDN</td></tr>";
$command = "cat $APPLICATIONPATH/tools/templates/master/rsync-wrapper-failover-template.sh >> $filename";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
#!/usr/bin/env perl
# ------------------------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ------------------------------------------------------------------------------
# rsync-wrapper-failover.sh for asnmtap, v$version, wrapper script for rsync
# execution via ssh key for use with rsync-mirror-failover.sh
# ------------------------------------------------------------------------------
# Step-by-step instructions for installation:
# $masterASNMTAP_PATH/applications/tools/templates/master/rsync-wrapper-failover-example.sh
# $masterASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-failover-example.sh
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
# ------------------------------------------------------------------------
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-wrapper-failover-$slaveFQDN.sh";
unless ( -e $filename ) {
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>Failover between $slaveFQDN and $masterFQDN</td></tr>";
$command = "cat $APPLICATIONPATH/tools/templates/master/rsync-wrapper-failover-template.sh >> $filename";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
#!/usr/bin/env perl
# ------------------------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ------------------------------------------------------------------------------
# rsync-wrapper-failover.sh for asnmtap, v$version, wrapper script for rsync
# execution via ssh key for use with rsync-mirror-failover.sh
# ------------------------------------------------------------------------------
use strict;
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
my ($hostnameAdminCollector, undef) = split (/\./, $slaveFQDN, 2);
return ($statusMessage) unless ( $collectorDaemon eq $hostnameAdminCollector );
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/master/rsync-mirror-failover-$masterFQDN-$collectorDaemon.sh";
$command = "cat $APPLICATIONPATH/tools/templates/slave/rsync-mirror-failover-template.sh >> $filename";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
#!/bin/bash
# ------------------------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ------------------------------------------------------------------------------
# rsync-mirror-failover.sh for asnmtap, v$version, mirror script for rsync
# execution via ssh key for use with rsync-wrapper-failover.sh
# ------------------------------------------------------------------------------
RMVersion='$RMVERSION'
echo "rsync-mirror-failover-$masterFQDN-$collectorDaemon.sh version \$RMVersion"
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
}
$statusMessage .= do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/master/rsync-mirror-failover-$masterFQDN-$collectorDaemon.sh\" target=\"_blank\">rsync-mi...
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/master/rsync-mirror-failover-$masterFQDN-$collectorDaemon.conf";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
# ------------------------------------------------------------------------------
# Copyright $COPYRIGHT Alex Peeters [alex.peeters\\\@citap.be]
# ------------------------------------------------------------------------------
$matchingRsyncMirrorConfigFailover
RSYNCMIRRORFILE
close (RsyncMirror);
}
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/master/rsync-mirror-failover-$masterFQDN-$collectorDaemon.conf\" target=\"_blank\">rsync-...
return ($statusMessage);
}
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-mirror-failover-$slaveFQDN-$collectorDaemon.sh";
$command = "cat $APPLICATIONPATH/tools/templates/slave/rsync-mirror-failover-template.sh >> $filename";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
#!/bin/bash
# ------------------------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ------------------------------------------------------------------------------
# rsync-mirror-failover.sh for asnmtap, v$version, mirror script for rsync
# execution via ssh key for use with rsync-wrapper-failover.sh
# ------------------------------------------------------------------------------
# Step-by-step instructions for installation:
# $slaveASNMTAP_PATH/applications/tools/templates/master/rsync-wrapper-failover-example.sh
# $slaveASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-failover-example.sh
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
}
$statusMessage .= do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-mirror-failover-$slaveFQDN-$collectorDaemon.sh\" target=\"_blank\">rsync-mirror-...
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-mirror-failover-$slaveFQDN-$collectorDaemon.conf";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
# ------------------------------------------------------------------------------
# Copyright $COPYRIGHT Alex Peeters [alex.peeters\\\@citap.be]
# ------------------------------------------------------------------------------
# Step-by-step instructions for installation:
# $slaveASNMTAP_PATH/applications/tools/templates/master/rsync-wrapper-failover-example.sh
# $slaveASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-failover-example.sh
# $slaveASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-failover-example.conf
# ------------------------------------------------------------------------------
$matchingRsyncMirrorConfigFailover
RSYNCMIRRORFILE
if ( $collectorDaemon eq 'test' ) {
print RsyncMirror <<RSYNCMIRRORFILE;
# ------------------------------------------------------------------------------
$SSHLOGONNAME\@$masterFQDN:$masterASNMTAP_PATH/plugins/ $slaveASNMTAP_PATH/plugins/ -v -c -z
# ------------------------------------------------------------------------------
RSYNCMIRRORFILE
}
close (RsyncMirror);
}
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if ( $typeMonitoring ) { # Distributed
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CM-$centralTypeActiveServer-$centralMasterFQDN/master/rsync-wrapper-distributed-$centralMasterFQDN.sh";
unless ( -e $filename ) {
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>Distributed Monitoring destination $centralMasterFQDN</td></tr>";
$command = "cat $APPLICATIONPATH/tools/templates/master/rsync-wrapper-distributed-template.sh >> $filename";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
#!/usr/bin/env perl
# ------------------------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ------------------------------------------------------------------------------
# rsync-wrapper-distributed.sh for asnmtap, v$version, wrapper script for rsync
# execution via ssh key for use with rsync-mirror-distributed.sh
# ------------------------------------------------------------------------------
# Step-by-step instructions for installation:
# $centralMasterASNMTAP_PATH/applications/tools/templates/master/rsync-wrapper-distributed-example.sh
# $centralMasterASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-distributed-example.sh
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if ( defined $centralSlaveFQDN and $centralSlaveFQDN ) {
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CS-$centralTypeActiveServer-$centralSlaveFQDN/master/rsync-wrapper-distributed-$centralSlaveFQDN.sh";
unless ( -e $filename ) {
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>Distributed Monitoring destination $centralSlaveFQDN</td></tr>";
$command = "cat $APPLICATIONPATH/tools/templates/master/rsync-wrapper-distributed-template.sh >> $filename";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
#!/usr/bin/env perl
# ------------------------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ------------------------------------------------------------------------------
# rsync-wrapper-distributed.sh for asnmtap, v$version, wrapper script for rsync
# execution via ssh key for use with rsync-mirror-distributed.sh
# ------------------------------------------------------------------------------
# Step-by-step instructions for installation:
# $centralSlaveASNMTAP_PATH/applications/tools/templates/master/rsync-wrapper-distributed-example.sh
# $centralSlaveASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-distributed-example.sh
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
}
}
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>Distributed Monitoring from $masterFQDN for Collector Daemon '$collectorDaemon'</td></tr>";
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/slave/rsync-mirror-distributed-$masterFQDN-$collectorDaemon.sh";
$command = "cat $APPLICATIONPATH/tools/templates/slave/rsync-mirror-distributed-template.sh >> $filename";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
#!/bin/bash
# ------------------------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ------------------------------------------------------------------------------
# rsync-mirror-distributed.sh for asnmtap, v$version, mirror script for rsync
# execution via ssh key for use with rsync-wrapper-distributed.sh
# ------------------------------------------------------------------------------
# Step-by-step instructions for installation:
# $masterASNMTAP_PATH/applications/tools/templates/master/rsync-wrapper-distributed-example.sh
# $masterASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-distributed-example.sh
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$statusMessage .= do_system_call ($command, $debug);
}
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/slave/rsync-mirror-distributed-$masterFQDN-$collectorDaemon.sh\" target=\"_blank\">rsync-mi...
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/slave/rsync-mirror-distributed-$masterFQDN-$collectorDaemon.conf";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
# ------------------------------------------------------------------------------
# Copyright $COPYRIGHT Alex Peeters [alex.peeters\\\@citap.be]
# ------------------------------------------------------------------------------
# Step-by-step instructions for installation:
# $masterASNMTAP_PATH/applications/tools/templates/master/rsync-wrapper-distributed-example.sh
# $masterASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-distributed-example.sh
# $masterASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-distributed-example.conf
# ------------------------------------------------------------------------------
$matchingRsyncMirrorConfigDistributedMaster
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/slave/rsync-mirror-distributed-$masterFQDN-$collectorDaemon.conf\" target=\"_blank\">rsync-...
if ( $typeServers ) {
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>Distributed Monitoring from $slaveFQDN for Collector Daemon '$collectorDaemon'</td></tr>";
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-mirror-distributed-$slaveFQDN-$collectorDaemon.sh";
$command = "cat $APPLICATIONPATH/tools/templates/slave/rsync-mirror-distributed-template.sh >> $filename";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
#!/bin/bash
# ------------------------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ------------------------------------------------------------------------------
# rsync-mirror-distributed.sh for asnmtap, v$version, mirror script for rsync
# execution via ssh key for use with rsync-wrapper-distributed.sh
# ------------------------------------------------------------------------------
# Step-by-step instructions for installation:
# $slaveASNMTAP_PATH/applications/tools/templates/master/rsync-wrapper-distributed-example.sh
# $slaveASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-distributed-example.sh
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
close (RsyncMirror);
}
$statusMessage .= do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-mirror-distributed-$slaveFQDN-$collectorDaemon.sh\" target=\"_blank\">rsync-mi...
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-mirror-distributed-$slaveFQDN-$collectorDaemon.conf";
$rvOpen = open(RsyncMirror, ">$filename");
if ($rvOpen) {
print RsyncMirror <<RSYNCMIRRORFILE;
# ------------------------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ------------------------------------------------------------------------------
# Step-by-step instructions for installation:
# $slaveASNMTAP_PATH/applications/tools/templates/master/rsync-wrapper-distributed-example.sh
# $slaveASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-distributed-example.sh
# $slaveASNMTAP_PATH/applications/tools/templates/slave/rsync-mirror-distributed-example.conf
# ------------------------------------------------------------------------------
$matchingRsyncMirrorConfigDistributedSlave
applications/htmlroot/cgi-bin/admin/holidays.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :ADMIN :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "holidays.pl";
my $prgtext = "Holidays";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
applications/htmlroot/cgi-bin/admin/holidays.pl view on Meta::CPAN
# 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...
applications/htmlroot/cgi-bin/admin/holidays.pl view on Meta::CPAN
($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;
} else {
document.holidays.month.disabled=true;
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">
<input type="hidden" name="action" value="$nextAction">
<input type="hidden" name="orderBy" value="$orderBy">
<input type="hidden" name="catalogIDreload" value="0">
HTML
} else {
print "<br>\n";
}
if ($formDisabledPrimaryKey ne '' and $action ne 'displayView') {
print <<HTML;
<input type=\"hidden\" name=\"catalogID\" value=\"$CcatalogID\">
<input type=\"hidden\" name=\"holidayID\" value=\"$CholidayID\">
<input type=\"hidden\" name=\"formule\" value=\"$Cformule\">
<input type=\"hidden\" name=\"month\" value=\"$Cmonth\">
<input type=\"hidden\" name=\"day\" value=\"$Cday\">
<input type=\"hidden\" name=\"offset\" value=\"$Coffset\">
<input type=\"hidden\" name=\"countryID\" value=\"$CcountryID\">
HTML
}
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=insertView&orderBy=$orderBy">[Insert holiday]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=listView&orderBy=$orderBy">[List all holidays]</a></td>
</tr></table>
</td></tr>
HTML
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
my $formuleSelect = create_combobox_from_keys_and_values_pairs ('0=>Fixed|1=>Easter', 'V', 0, $Cformule, 'formule', '', '', $formDisabledPrimaryKey, 'onChange="javascript:enableDisableFields();"', $debug);
my $activatedChecked = ($Cactivated eq 'on') ? ' checked' : '';
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>
<tr><td><b>Formule: </b></td><td>
$formuleSelect
</td></tr>
<tr><td><b>Month: </b></td><td>
<input type="text" name="month" value="$Cmonth" size="2" maxlength="2" $formDisabledPrimaryKey> format: 1-12
applications/htmlroot/cgi-bin/admin/holidays.pl view on Meta::CPAN
$countryIDSelect
</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";
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";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/admin/holidaysBundle.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :ADMIN :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "holidaysBundle.pl";
my $prgtext = "Holidays Bundle";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
applications/htmlroot/cgi-bin/admin/holidaysBundle.pl view on Meta::CPAN
# 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...
applications/htmlroot/cgi-bin/admin/holidaysBundle.pl view on Meta::CPAN
$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();
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">
<input type="hidden" name="action" value="$nextAction">
<input type="hidden" name="orderBy" value="$orderBy">
<input type="hidden" name="countryIDreload" value="0">
<input type="hidden" name="catalogIDreload" value="0">
HTML
} else {
print "<br>\n";
}
print " <input type=\"hidden\" name=\"catalogID\" value=\"$CcatalogID\">\n <input type=\"hidden\" name=\"holidayBundleID\" value=\"$CholidayBundleID\">\n" if ($formDisabledPrimaryKey ne '' and $action ne 'displayView');
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=insertView&orderBy=$orderBy">[Insert holiday bundle]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=listView&orderBy=$orderBy">[List all holiday bundles]</a></td>
</tr></table>
</td></tr>
HTML
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
my $activatedChecked = ($Cactivated eq 'on') ? ' checked' : '';
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>
<tr><td><b>Holiday Bundle ID: </b></td><td>
<input type="text" name="holidayBundleID" value="$CholidayBundleID" size="11" maxlength="11" $formDisabledPrimaryKey>
</td></tr>
<tr><td><b>Holiday Bundle Name: </b></td><td>
<input type="text" name="holidayBundleName" value="$CholidayBundleName" size="64" maxlength="64" $formDisabledAll>
applications/htmlroot/cgi-bin/admin/holidaysBundle.pl view on Meta::CPAN
$countryIDSelect
</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";
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";
}
print "<table align=\"center\">\n<tr><td>\n$matchingPlugins</td></tr></table><br>\n" if (defined $matchingPlugins);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/admin/index.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :ADMIN);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "index.pl";
my $prgtext = "$APPLICATION Admin";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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>
<tr><td class="StatusItem"> </td></tr>
<tr><td class="StatusItem"><a href="../moderator/trendlineCorrectionReports.pl?pagedir=$pagedir&pageset=$pageset&debug=F&CGISESSID=$sessionID">Trendline Correction Reports (for the Collector)</a></td></tr>
applications/htmlroot/cgi-bin/admin/index.pl view on Meta::CPAN
<tr><td class="StatusItem"> </td></tr>
<tr><td class="StatusItem"><a href="generateConfig.pl?pagedir=$pagedir&pageset=$pageset&debug=F&CGISESSID=$sessionID">Configurations (for the Archiver, Display, Collector and Rsync Mirroring)</a></td></tr>
</table>
</td></tr></table>
<br>
HTML
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/admin/languages.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :ADMIN :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "languages.pl";
my $prgtext = "Languages";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
applications/htmlroot/cgi-bin/admin/languages.pl view on Meta::CPAN
# 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...
applications/htmlroot/cgi-bin/admin/languages.pl view on Meta::CPAN
}
}
$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;
}
if ( document.languages.languageName.value == null || document.languages.languageName.value == '' ) {
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">
<input type="hidden" name="action" value="$nextAction">
<input type="hidden" name="orderBy" value="$orderBy">
HTML
} else {
print "<br>\n";
}
print " <input type=\"hidden\" name=\"keyLanguage\" value=\"$CkeyLanguage\">\n" if ($formDisabledPrimaryKey ne '' and $action ne 'displayView');
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=insertView&orderBy=$orderBy">[Insert language]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=listView&orderBy=$orderBy">[List all languages]</a></td>
</tr></table>
</td></tr>
HTML
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
my $languageActiveChecked = ($ClanguageActive eq 'on') ? ' checked' : '';
print <<HTML;
<tr><td> </td></tr>
<tr><td>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td><b>Key Language: </b></td><td>
<input type="text" name="keyLanguage" value="$CkeyLanguage" size="2" maxlength="2" $formDisabledPrimaryKey>
</td></tr>
<tr><td><b>Language Name: </b></td><td>
<input type="text" name="languageName" value="$ClanguageName" size="16" maxlength="16" $formDisabledAll>
</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";
if ($action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
print "</form>\n";
} else {
print "<br>\n";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :SADMIN :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "plugins.pl";
my $prgtext = "Plugins";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
# 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 );
$ChelpPluginTextname = '';
} else {
if ( $cgi->param('helpPluginFilename') eq '' ) {
$ChelpPluginFilename = $ChelpPluginTextname;
$ChelpPluginTextname = '';
} else {
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
if ( $type eq 'application/pdf') {
my $fhOpen = open( FHOPEN, ">$PDPHELPPATH/$ChelpPluginFilename" );
if ($fhOpen) {
binmode FHOPEN;
my $fh = $cgi->upload('helpPluginFilename');
if ( defined $fh ) {
while (<$fh>) { print FHOPEN; }
$ChelpPluginTextname .= ', Uploaded and wrote file OK!';
} else {
$ChelpPluginTextname .= ', Cannot upload PDF file!';
}
close FHOPEN;
} else {
$ChelpPluginFilename = '<NIHIL>';
$ChelpPluginTextname .= ', Cannot create PDF file!';
}
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
$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();
alert('Please enter a unique key!');
return false;
} else {
var objectRegularExpressionUkeyFormat = /\^[a-zA-Z0-9-]\+\$/;
if ( ! objectRegularExpressionUkeyFormat.test(document.plugins.uKey.value) ) {
document.plugins.uKey.focus();
alert('Please re-enter a unique key: Bad unique key value!');
return false;
}
}
HTML
}
print <<HTML;
if ( document.plugins.title.value == null || document.plugins.title.value == '' ) {
document.plugins.title.focus();
alert('Please enter a title!');
return false;
} else {
var objectRegularExpressionTitleFormat = /[{}]/;
if ( objectRegularExpressionTitleFormat.test(document.plugins.title.value) ) {
document.plugins.title.focus();
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
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">
<input type="hidden" name="action" value="$nextAction">
<input type="hidden" name="orderBy" value="$orderBy">
<input type="hidden" name="catalogIDreload" value="0">
HTML
} else {
print "<br>\n";
}
print " <input type=\"hidden\" name=\"catalogID\" value=\"$CcatalogID\">\n <input type=\"hidden\" name=\"uKey\" value=\"$CuKey\">\n" if ($formDisabledUniqueKey ne '' and $action ne 'displayView');
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td colspan="2">
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=insertView&orderBy=$orderBy">[Insert plugin]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=listView&orderBy=$orderBy">[List all/filtered plugins]</a></td>
</tr></table>
</td></tr>
HTML
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
my $ondemandChecked = ($Condemand eq 'on') ? ' checked' : '';
my $productionChecked = ($Cproduction eq 'on') ? ' checked' : '';
my $activatedChecked = ($Cactivated eq 'on') ? ' checked' : '';
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>
<tr><td><b>Unique Key: </b></td><td>
<input type="text" name="uKey" value="$CuKey" size="11" maxlength="11" $formDisabledUniqueKey>
<tr><td><b>Title: </b></td><td>
<input type="text" name="title" value="$Ctitle" size="75" maxlength="75" $formDisabledAll>
applications/htmlroot/cgi-bin/admin/plugins.pl view on Meta::CPAN
<tr><td valign="top">Help Plugin Filename: </td><td>
<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";
}
if (defined $matchingViewsCrontabs) {
print "<table align=\"center\">\n<tr><td>\n$matchingViewsCrontabs</td></tr></table><br>\n";
print "<table align=\"center\">\n<tr><td>\n<img src=\"$HTTPSURL/cgi-bin/moderator/generatePluginCrontabSchedulingReport.pl?catalogID=$CcatalogID&uKey=$CuKey&".encode_html_entities('U', "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESS...
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :ADMIN :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "reports.pl";
my $prgtext = "Reports";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
my $CtimeperiodID = (defined $cgi->param('timeperiodID')) ? $cgi->param('timeperiodID') : 'none';
my $Cstatus = (defined $cgi->param('status')) ? $cgi->param('status') : 'off';
my $CerrorDetails = (defined $cgi->param('errorDetails')) ? $cgi->param('errorDetails') : 'off';
my $Cbar = (defined $cgi->param('bar')) ? $cgi->param('bar') : 'off';
my $ChourlyAverage = (defined $cgi->param('hourlyAverage')) ? $cgi->param('hourlyAverage') : 'off';
my $CdailyAverage = (defined $cgi->param('dailyAverage')) ? $cgi->param('dailyAverage') : 'off';
my $CshowDetails = (defined $cgi->param('showDetails')) ? $cgi->param('showDetails') : 'off';
my $CshowComments = (defined $cgi->param('showComments')) ? $cgi->param('showComments') : 'off';
my $CshowPerfdata = (defined $cgi->param('showPerfdata')) ? $cgi->param('showPerfdata') : 'off';
my $CshowTop20SlowTests = (defined $cgi->param('showTop20SlowTests')) ? $cgi->param('showTop20SlowTests') : 'off';
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...
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
$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...
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
$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;
}
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
$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...
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
($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;
} else {
if ( document.reports.periode.value == 'M' ) {
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">
<input type="hidden" name="action" value="$nextAction">
<input type="hidden" name="orderBy" value="$orderBy">
<input type="hidden" name="catalogIDreload" value="0">
HTML
} else {
print "<br>\n";
}
print " <input type=\"hidden\" name=\"catalogID\" value=\"$CcatalogID\"> <input type=\"hidden\" name=\"id\" value=\"$Cid\">\n" if ($formDisabledPrimaryKey ne '' and $action ne 'displayView' and $action ne "listView");
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=insertView&orderBy=$orderBy">[Insert report]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=listView&orderBy=$orderBy">[List all reports]</a></td>
</tr></table>
</td></tr>
HTML
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
my $statusChecked = ($Cstatus eq 'on') ? " checked" : '';
my $errorDetailsChecked = ($CerrorDetails eq 'on') ? " checked" : '';
my $barChecked = ($Cbar eq 'on') ? " checked" : '';
my $hourlyAverageChecked = ($ChourlyAverage eq 'on') ? " checked" : '';
my $dailyAverageChecked = ($CdailyAverage eq 'on') ? " checked" : '';
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>
<tr><td><b>ID: </b></td><td>
<input type="text" name="id" value="$Cid" size="11" maxlength="11" $formDisabledPrimaryKey>
</td></tr>
<tr><td><b>Application: </b></td><td>
applications/htmlroot/cgi-bin/admin/reports.pl view on Meta::CPAN
<tr><td>Show Comments: </td><td>
<input type="checkbox" name="showComments" $showCommentsChecked $formDisabledAll>
</td></tr>
<tr><td>Show Performance Data: </td><td>
<input type="checkbox" name="showPerfdata" $showPerfdataChecked $formDisabledAll>
</td></tr>
<tr><td>Show Top 20 Slow Tests: </td><td>
<input type="checkbox" name="showTop20SlowTests" $showTop20SlowTestsChecked $formDisabledAll>
</td></tr>
<tr><td>Printer Friendly Output: </td><td>
<input type="checkbox" name="printerFriendlyOutput" $printerFriendlyOutputChecked $formDisabledAll>
</td></tr>
<tr><td><b>Format Output: </b></td><td>
$formatOutputSelect
</td></tr>
<tr><td><b>User Password: </b></td><td>
<input type="password" name="userPassword" value="$CuserPassword" size="15" maxlength="15" $formDisabledAll>
</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";
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";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/admin/reports_perfdata.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :ADMIN :DBPERFPARSE :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "reports_perfdata.pl";
my $prgtext = "Reports Perfdata";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
applications/htmlroot/cgi-bin/admin/reports_perfdata.pl view on Meta::CPAN
# 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...
applications/htmlroot/cgi-bin/admin/reports_perfdata.pl view on Meta::CPAN
}
}
$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();
alert('Please create/select one of the applications!');
return false;
}
if ( document.reports_perfdata.metric_id.options[document.reports_perfdata.metric_id.selectedIndex].value == 'none' ) {
document.reports_perfdata.metric_id.focus();
alert('Please create/select one of the metrics!');
return false;
}
HTML
}
print <<HTML;
// times n[,n] and n >= 0
var objectRegularExpressionTimesValue = /\^([0-9]+)(,([0-9]+))*\$/;
if ( ! ( document.reports_perfdata.times.value == null || document.reports_perfdata.times.value == '' ) ) {
if ( ! objectRegularExpressionTimesValue.test(document.reports_perfdata.times.value) ) {
document.reports_perfdata.times.focus();
alert('Please re-enter times: Bad times format!');
return false;
}
}
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">
<input type="hidden" name="action" value="$nextAction">
<input type="hidden" name="orderBy" value="$orderBy">
<input type="hidden" name="uKeyReload" value="0">
<input type="hidden" name="catalogIDreload" value="0">
HTML
} else {
print "<br>\n";
}
if ($formDisabledPrimaryKey ne '' and $action ne 'displayView' and $action ne "listView") {
print " <input type=\"hidden\" name=\"catalogID\" value=\"$CcatalogID\">\n";
print " <input type=\"hidden\" name=\"uKey\" value=\"$CuKey\">\n";
print " <input type=\"hidden\" name=\"metric_id\" value=\"$Cmetric_id\">\n";
}
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=insertView&orderBy=$orderBy">[Insert report perfdata]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&action=listView&orderBy=$orderBy">[List all reports perfdata]</a></td>
</tr></table>
</td></tr>
HTML
unless ( $PERFPARSEENABLED ) {
print " <tr><td align=\"center\"><br>'Performance Data' not enabled</td></tr>";
} elsif ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
my $unitSelect = create_combobox_from_keys_and_values_pairs ('s=>s|ms=>ms', 'K', 0, $Cunit, 'unit', '', '', $formDisabledAll, '', $debug);
my $activatedChecked = ($Cactivated eq 'on') ? ' checked' : '';
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>
<tr><td><b>Application: </b></td><td>
$uKeySelect
</td></tr>
<tr><td><b>Metric: </b></td><td>
applications/htmlroot/cgi-bin/admin/reports_perfdata.pl view on Meta::CPAN
<input type="text" name="percentiles" value="$Cpercentiles" size="64" maxlength="64" $formDisabledAll> format: n[,n] 0 < value < 100
</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";
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";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/admin/resultsdirs.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :SADMIN :DBREADWRITE :DBTABLES);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "resultsdirs.pl";
my $prgtext = "Resultsdirs";
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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
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 $pageNo = (defined $cgi->param('pageNo')) ? $cgi->param('pageNo') : 1;
my $pageOffset = (defined $cgi->param('pageOffset')) ? $cgi->param('pageOffset') : 0;
applications/htmlroot/cgi-bin/admin/resultsdirs.pl view on Meta::CPAN
# 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...
applications/htmlroot/cgi-bin/admin/resultsdirs.pl view on Meta::CPAN
}
}
$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-]\+\$/;
if ( document.resultsdir.resultsdir.value == null || document.resultsdir.resultsdir.value == '' ) {
document.resultsdir.resultsdir.focus();
alert('Please enter a resultsdir!');
return false;
} else {
if ( ! objectRegularExpressionResultsdirFormat.test(document.resultsdir.resultsdir.value) ) {
document.resultsdir.resultsdir.focus();
alert('Please re-enter resultsdir: Bad resultsdir format!');
return false;
}
}
HTML
}
print <<HTML;
if ( document.resultsdir.groupName.value == null || document.resultsdir.groupName.value == '' ) {
document.resultsdir.groupName.focus();
alert('Please enter a group name!');
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">
<input type="hidden" name="action" value="$nextAction">
<input type="hidden" name="orderBy" value="$orderBy">
<input type="hidden" name="catalogIDreload" value="0">
HTML
} else {
print "<br>\n";
}
print " <input type=\"hidden\" name=\"catalogID\" value=\"$CcatalogID\">\n <input type=\"hidden\" name=\"resultsdir\" value=\"$Cresultsdir\">\n" if ($formDisabledPrimaryKey ne '' and $action ne 'displayView');
print <<HTML;
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center"><td>
<table border="0" cellspacing="0" cellpadding="0"><tr>
HTML
if ( $iconAdd ) {
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&pageNo=1&pageOffset=0&action=insertView&orderBy=$orderBy">[Insert resultsdir]</a></td>
<td class="StatusItem"> </td>
HTML
}
print <<HTML;
<td class="StatusItem"><a href="$urlWithAccessParameters&pageNo=1&pageOffset=0&action=listView&orderBy=$orderBy">[List all resultsdir]</a></td>
</tr></table>
</td></tr>
HTML
if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
my $activatedChecked = ($Cactivated eq 'on') ? ' checked' : '';
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>
<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";
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";
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -