view release on metacpan or search on metacpan
- ALTER TABLE `eventsDisplayData` ADD COLUMN `perfdata` text AFTER `statusMessage`;
- ALTER TABLE `views` ADD COLUMN `timeperiodID` INT(11) NOT NULL DEFAULT '1' AFTER `displayGroupID`;
- ALTER TABLE `views` ADD INDEX `timeperiodID` (`timeperiodID`);
- ALTER TABLE `views` ADD INDEX `views_ibfk_4` (`catalogID`, `timeperiodID`);
- ALTER TABLE `views` ADD CONSTRAINT `views_ibfk_4` FOREIGN KEY (`catalogID`,`timeperiodID`) REFERENCES `timeperiods` (`catalogID`,`timeperiodID`);
Help Plugin docs
- update new help plugin doc file type 'http(s)://'
SNMPTraps-Frontend for Nagios & ASNMTAP
- UPDATE class.mysqlDB.php: replace 'INSERT INTO' with 'REPLACE INTO'
XML plugin templates
- UPDATE new command line option 'uKey'
ASNMTAP::Asnmtap::Applications::CSV VARIABLES
- UPDATE our @EVENTS = ('catalogID', 'id', 'uKey', 'replicationStatus', 'test', 'title', 'status', 'startDate', 'startTime', 'endDate', 'endTime', 'duration', 'statusMessage', 'perfdata', 'step', 'timeslot', 'instabilit...
views.pl
- added 'Incident Monitoring Window'
Version 3.002.001, 2010/07/28, by Alex Peeters
ASNMTAP
- NEW 'filter-option' to search
- UPDATE cpan module SOAP::Lite to 0.710.08 (reported problems with 0.710.09 and later)
- UPDATE cpan module WSRF::Lite to 0.8.2.7
- NEW example for distributed monitoring
- add `timeperiodID` int(11) NOT NULL default '1' at table reports
- add KEY `timeperiodID` (`timeperiodID`), at table reports
- add CONSTRAINT `reports_ibfk_2` FOREIGN KEY (`timeperiodID`) REFERENCES `timeperiods` (`timeperiodID`) at table reports
- UPDATE replace 'KEY `pagedir` (`pagedir`),' with 'UNIQUE KEY `pagedir` (`pagedir`),' at table displayDaemons
comments.pl
- FIX regarding 'Please re-enter entry date/time: Date/Time are into the future!'
- FIX regarding 'Please re-enter solved date/time: Date/Time are into the future!'
crontab verify disable email when ...
- By default cron jobs sends a email to the user account executing the cronjob.
Because this is not needed we put the following command At the end of the cron job line.
'> /dev/null (default)' or '> /dev/null 2>&1'
detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl, generateChart.pl & htmlToPdf.pl
- add my $timeperiodID = (defined $cgi->param('timeperiodID')) ? $cgi->param('timeperiodID') : 'none';
display.pl
- add -c, --creationTime=<YYYY-MM-DD HH:MM:SS>, YYYY-MM-DD HH:MM:SS: year, month, day, hours, minutes and seconds to use instead of the current time when --loop = F
- add sort results by status, group, comments and then by time
- 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;'
user.pl
- Sending email for: Downtime Scheduling & Generated Reports
Version 3.000.011, 2006/09/16, ASNMTAP::Asnmtap::Applications
- add `environment` char(1) NOT NULL default 'L' to TABLE `plugins`
display.pl, plugins.pl & generateConfig.pl
- add environment
collector.pl
- add $perfParseMethode
- NEW perfparse_asnmtap_pulp_command.pl
- NEW perfparse_crontab.sh
generateConfig.pl
- FIX added activated = 1 to all sql queries
Makefile.pl
- update SOAP::Lite to version 0.69
- update MIME::Base64 to version 3.07
ASNMTAP::Asnmtap::Plugins::SOAP
- FIX replaced 'defined $som->fault' with 'defined $som and defined $som->fault'
ASNMTAP::Asnmtap::Plugins::Nagios
- NEW check_iowait.pl
Version 3.000.009, 2006/06/01, ASNMTAP::Asnmtap::Plugins::WebTransact
- RFC 1738 optimalisations
- add '500 SSL negotiation failed'
- add Perfdata_Label => 'IMAGE URL' to _download_images()
ASNMTAP::Asnmtap::Applications
- email SUBJECT changed to Display/Collector for the 'Application Monitoring'@HOSTNAME: ...
NPTest, v1.11
- Will die if signal received from a testCmd
archiver.pl
- FIX First day current week epoch date
command.pl
- FIX regarding date.utc() - The month (0=Jan - 11=Dec)
- replaced 'suspentionDate.substring(5, 7);' with 'suspentionDate.substring(5, 7) - 1;'
generateCollectorDaemonSchedulingReports.pl
- NEW, generating automatically Collector Daemon Scheduling PDF Reports
- http://asnmtap.citap.be/results/_ASNMTAP/reports/yyyymmdd-collectorDaemonSchedulingReports.pl-_ASNMTAP-FQDN-Daily.pdf
database asnmtap, table plugins and crontab
- `arguments` from varchar(100) to varchar(254)
- `argumentsOndemand` from varchar(100) to varchar(254)
Version 3.000.005, 2006/02/26
- check_MySQL-database-replication.pl (MySQL database replication)
- Bit::Vector 6.3
- Date::Calc 5.4
- Bundle::DBI
- Bundle::DBD::mysql
- ASNMTAP::Time
- Date::Calc instead of unix data command
- Making ASNMTAP CPAN module perl 5.8.0, 5.8.5 and 5.8.6 compatible
For perl versions before 5.8.5, then you must change into Asnmtap.cnf from 'CAPTUREOUTPUT 1' to 'CAPTUREOUTPUT 0' !!!
- ASNMTAP::Asnmtap::getOptionsType() added
- ASNMTAP CPAN module ASNMTAP::Asnmtap::Plugins::Modem added
All : IO::Handle 1.20
chown asnmtap:asnmtap ssh.pub
chmod 600 ssh
chown apache:asnmtap ssh
# |------- user for web server
cat /home/asnmtap/.ssh/ssh.pub >> /home/asnmtap/.ssh/authorized_keys
chmod 600 /home/asnmtap/.ssh/authorized_keys
vi /home/asnmtap/.ssh/authorized_keys
add command='/opt/asnmtap/applications/sbin/sshWrapperASNMTAP.pl' before ssh.pub
httpd.conf
----------
vi /etc/httpd/conf.d/asnmtap.conf add the following content, and modify where needed like ServerName, ServerAlias, ErrorLog and CustomLog
AddHandler cgi-script .cgi .pl
DirectoryIndex index.htm index.html index.html.var index.shtml index.cfm index.pl
applications/htmlroot/snmptraps/include/xml/language/EN/error.xml
applications/htmlroot/snmptraps/include/xml/language/EN/main.xml
applications/htmlroot/sound/attention.wav
applications/htmlroot/sound/critical.wav
applications/htmlroot/sound/nodata.wav
applications/htmlroot/sound/unknown.wav
applications/htmlroot/sound/warning.wav
applications/sbin/bash_stop_root.sh
applications/sbin/perfparse_asnmtap_pulp_command.pl
applications/sbin/perfparse_crontab.sh
applications/sbin/perfparse_crontab_failed.sh
applications/sbin/perfparse_debug.sh
applications/sbin/purge_table.pl
applications/sbin/sshWrapperASNMTAP.pl
applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x.sql
applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x-trigger-events.sql
applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x-trigger-eventsUpdate.sql
applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x-trigger-eventsDisplayData.sql
applications/archive.pl view on Meta::CPAN
$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;
applications/archive.pl view on Meta::CPAN
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);
my ($catalogID, $uKey) = split(/_/, $catalogID_uKey);
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);
applications/archive.pl view on Meta::CPAN
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)) {
applications/archive.pl view on Meta::CPAN
unlink ($path.'/'.$filename);
}
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub catAllCsvFilesYesterdayWeek {
my ($firstDayOfWeekEpoch, $yesterdayEpoch, $catalogID_uKey, $command, $path, $weekFilename, $filename) = @_;
for (my $loop = $firstDayOfWeekEpoch; $loop <= $yesterdayEpoch; $loop += 86400) {
if ($filename eq get_yearMonthDay($loop)."-$command-$catalogID_uKey-csv.txt") {
my $rvOpen = open(CAT, ">>$path/$weekFilename");
if ($rvOpen) {
$rvOpen = open(CSV, "$path/$filename");
if ($rvOpen) {
while (<CSV>) {
chomp;
unless ( /^#/ ) {
applications/bin/generateCollectorDaemonSchedulingReports.pl view on Meta::CPAN
$reports .= "/";
create_header ($reports."HEADER.html");
create_footer ($reports."FOOTER.html");
use Sys::Hostname;
my $hostname = hostname();
$hostname =~ s/\./_/g;
my $pdfFilename = "$RESULTSPATH/_ASNMTAP/$REPORTDIR/$currentYear$currentMonth$currentDay-collectorDaemonSchedulingReports.pl-_ASNMTAP-$hostname-Daily.pdf";
my $encodedUrlAccessParameters = encode_html_entities('U', $urlAccessParameters);
my $command = "$HTMLTOPDFPRG -f '$pdfFilename' $HTMLTOPDFOPTNS 'http://${REMOTE_HOST}$HTTPSURL/cgi-bin/moderator/collectorDaemonSchedulingReports.pl?$encodedUrlAccessParameters'";
if ( -e "$pdfFilename" ) {
$emailMessage .= " > $pdfFilename already generated\n";
} else {
$emailMessage .= " > $pdfFilename will be generated\n";
if ($HTMLTOPDFPRG eq 'HTMLDOC') {
$ENV{HTMLDOC_NOCGI} = 1;
select(STDOUT); $| = 1;
}
my ($status, $stdout, $stderr) = call_system ("$command", $debug);
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; }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/bin/generateReports.pl view on Meta::CPAN
$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);
applications/bin/generateReports.pl view on Meta::CPAN
$reports .= "/";
create_header ($reports."HEADER.html");
create_footer ($reports."FOOTER.html");
my $dayReportMonthPdf = ($dayReportMonth < 10) ? "0$dayReportMonth" : $dayReportMonth;
my $dayReportDayPdf = ($dayReportDay < 10) ? "0$dayReportDay" : $dayReportDay;
my $catalogID_uKey = ( ( $catalogID eq 'CID' ) ? '' : $catalogID .'_' ) . $uKey;
my $pdfFilename = "$RESULTSPATH/$resultsdir/$REPORTDIR/$dayReportYear$dayReportMonthPdf$dayReportDayPdf-$test-$catalogID_uKey-$periodeMessage-id_$id.pdf";
my $encodedUrlAccessParameters = encode_html_entities('U', $urlAccessParameters);
my $user_password = (defined $userPassword and $userPassword ne '' ? '--user-password '. $userPassword : '');
my $command = "$HTMLTOPDFPRG -f '$pdfFilename' $user_password $HTMLTOPDFOPTNS 'http://${REMOTE_HOST}$HTTPSURL/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl?$encodedUrlAccessParameters'";
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";
foreach my $command (@commands) {
if ($HTMLTOPDFPRG eq 'HTMLDOC') {
$ENV{HTMLDOC_NOCGI} = 1;
select(STDOUT); $| = 1;
}
my ($status, $stdout, $stderr) = call_system ("$command", $debug);
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; }
}
}
applications/collector-test.pl view on Meta::CPAN
my $boolean_screenDebug = 0; # default
my $boolean_debug_all = 0; # default
my $boolean_debug_NOK = 0; # default
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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,
applications/collector-test.pl view on Meta::CPAN
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' );
}
$logging = $RESULTSPATH .'/'. $resultsdir;
applications/collector-test.pl view on Meta::CPAN
create_header ($logging ."HEADER.html");
create_footer ($logging ."FOOTER.html");
$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);
my @scommand = split(/\|/, $tcommand);
foreach my $dcommand (@scommand) {
my (undef, $resultsdir, undef, undef, undef) = split(/\#/, $dcommand);
$logging = $RESULTSPATH .'/'. $resultsdir;
create_dir ($logging);
$httpdump = $logging .'/'. $DEBUGDIR;
create_dir ($httpdump);
$logging .= "/";
create_header ($logging."HEADER.html");
create_footer ($logging."FOOTER.html");
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;
$catalogID_uniqueKey = $catalogID .'_'. $uniqueKey unless ( $catalogID eq 'CID' );
}
$title =~ s/^[\[[\S+|\s+]*\]\s+]{0,1}([\S+|\s+]*)/$1/g;
applications/collector-test.pl view on Meta::CPAN
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;
applications/collector-test.pl view on Meta::CPAN
$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');
applications/collector-test.pl view on Meta::CPAN
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 = '';
}
applications/collector.pl view on Meta::CPAN
my $boolean_screenDebug = 0; # default
my $boolean_debug_all = 0; # default
my $boolean_debug_NOK = 0; # default
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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,
applications/collector.pl view on Meta::CPAN
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' );
}
$logging = $RESULTSPATH .'/'. $resultsdir;
applications/collector.pl view on Meta::CPAN
create_header ($logging ."HEADER.html");
create_footer ($logging ."FOOTER.html");
$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);
my @scommand = split(/\|/, $tcommand);
foreach my $dcommand (@scommand) {
my (undef, $resultsdir, undef, undef, undef) = split(/\#/, $dcommand);
$logging = $RESULTSPATH .'/'. $resultsdir;
create_dir ($logging);
$httpdump = $logging .'/'. $DEBUGDIR;
create_dir ($httpdump);
$logging .= "/";
create_header ($logging."HEADER.html");
create_footer ($logging."FOOTER.html");
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;
$catalogID_uniqueKey = $catalogID .'_'. $uniqueKey unless ( $catalogID eq 'CID' );
}
$title =~ s/^[\[[\S+|\s+]*\]\s+]{0,1}([\S+|\s+]*)/$1/g;
applications/collector.pl view on Meta::CPAN
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;
applications/collector.pl view on Meta::CPAN
$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');
applications/collector.pl view on Meta::CPAN
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 = '';
}
applications/custom/cartography.pm-orig view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::Display qw(:APPLICATIONS :DBDISPLAY);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createGifForCartography {
my ($catalogID_uniqueKey, $status) = @_;
my $value = $catalogID_uniqueKey;
$value =~ s/-/_/g;
my $command = "cp ${IMAGESPATH}/$ICONS{$status} ${RESULTSPATH}/_ASNMTAP/${value}.gif";
system ("$command");
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub printLinkToCartography {
my ($serverName, $checklist, $catalogID, $uniqueKey) = @_;
# modify the value of $url with the link to your cartography tool - - -
my $url = 'http://cartography.citap.be/index.htm?entry';
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/display-test.pl view on Meta::CPAN
$lockMySQL = ($opt_l eq 'F') ? 0 : 1;
} else {
usage("Invalid lockMySQL: $opt_l\n");
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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;
applications/display-test.pl view on Meta::CPAN
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' );
}
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
$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]);
applications/display-test.pl view on Meta::CPAN
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, '[';
applications/display-test.pl view on Meta::CPAN
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) {
applications/display.pl view on Meta::CPAN
$lockMySQL = ($opt_l eq 'F') ? 0 : 1;
} else {
usage("Invalid lockMySQL: $opt_l\n");
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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;
applications/display.pl view on Meta::CPAN
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' );
}
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
$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]);
applications/display.pl view on Meta::CPAN
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, '[';
applications/display.pl view on Meta::CPAN
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) {
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if ( -e "$APPLICATIONPATH/tmp/$CONFIGDIR/generated" ) {
my $compareDiff = system_call ("$DIFFCOMMAND -braq -E 'generated on 20[0-9][0-9]/[0-9][0-9]/[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]'", "$APPLICATIONPATH/tmp/$CONFIGDIR/generated $APPLICATIONPATH/tmp/$CONFIGDIR/installed", $debug);
if ($compareDiff eq '') {
$installView .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>The generated and installed configurations are identical.</td></tr>";
} else {
$installView .= "\n <tr><td align=\"center\"><b>Under construction:</b></td></tr>";
$installView .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{NOBLOCK}\">$compareDiff</table></td></tr>";
$installView .= "\n <tr><td align=\"center\"> </td></tr>";
$installView .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>We only are allowed to press the <b>MOVE</b> button when all commands are successfully executed!</td></tr>" if ( $Cauto == 1 );
$installView .= "\n <tr align=\"left\"><td align=\"right\"><input type=\"submit\" value=\"". ( ( $Cauto == 1 ) ? 'MOVE' : 'INSTALL' ) ."\"> <input type=\"reset\" value=\"Reset\"></td></tr>\n";
}
} else {
$installView .= "\n <tr><td>The generated configuration doesn't exist.</td></tr>";
}
$installView .= "\n </table>";
} elsif ($action eq 'install') {
$installView .= "\n <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">";
$installView .= "\n <tr><th>Configuration Installed</th></tr>";
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if [ -f "\$AMPATH/sbin/bash_stop_root.sh" ]; then
source "\$AMPATH/sbin/bash_stop_root.sh"
fi
STARTUPFILE
close (CollectorCT);
}
my $statusMessage = do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/CollectorCT-$collectorDaemon.sh\" target=\"_blank\">CollectorCT-$collect...
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createAsnmtapCollectorCTscript {
my ($typeMonitoring, $typeServersCharMorS, $typeActiveServer, $serverFQDN, $serverAdminCollectorFQDN, $serverASNMTAP_PATH , $serverRSYNC_PATH , $serverSSH_PATH, $subdir, $debug) = @_;
my $typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/asnmtap-collector.sh\" target=\"_blank\">asnmtap-collector.sh ($subdir)<...
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createDisplayCTscript {
my ($typeMonitoringCharDorC, $typeServersCharMorS, $typeActiveServer, $serverFQDN, $serverASNMTAP_PATH , $serverRSYNC_PATH , $serverSSH_PATH, $databaseFQDN, $subdir, $displayDaemon, $pagedirs, $loop, $trigger, $displayTime, $lockMySQL, $debugDaemon...
my $filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/DisplayCT-$displayDaemon.sh";
my $command = "cat $APPLICATIONPATH/tools/templates/DisplayCT-template.sh >> $filename";
my $rvOpen = open(DisplayCT, ">$filename");
if ($rvOpen) {
print DisplayCT <<STARTUPFILE;
#!/bin/bash
# ---------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if [ -f "\$AMPATH/sbin/bash_stop_root.sh" ]; then
source "\$AMPATH/sbin/bash_stop_root.sh"
fi
STARTUPFILE
close (DisplayCT);
}
my $statusMessage = do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/DisplayCT-$displayDaemon.sh\" target=\"_blank\">DisplayCT-$displayDaemon...
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createAsnmtapDisplayCTscript {
my ($typeMonitoring, $typeServersCharMorS, $typeActiveServer, $serverFQDN, $serverASNMTAP_PATH , $serverRSYNC_PATH , $serverSSH_PATH, $subdir, $debug) = @_;
my $typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/asnmtap-display.sh\" target=\"_blank\">asnmtap-display.sh ($subdir)</a><...
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createRsyncMirrorScriptsFailover {
my ($serverID, $typeMonitoring, $typeServers, $typeActiveServer, $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH, $collectorDaemon, $matchingRsyncMirrorConfigFai...
my $typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
my ($filename, $command, $rvOpen);
my $statusMessage = '';
if ( $typeServers ) { # Failover
# --------------------------------------------------------------------------
# Failover between $masterFQDN and $slaveFQDN
# --------------------------------------------------------------------------
$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
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
my \$rsync_version_2_6_7_or_higher = 1;
# 1 = 'capture_exec("\$system_action")' or 0 = 'system ("\$system_action")'
my \$captureOutput = $CAPTUREOUTPUT;
RSYNCMIRRORFILE
close (RsyncMirror);
}
$statusMessage .= do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "M-$typeActiveServer-$masterFQDN/master/rsync-wrapper-failover-$masterFQDN.sh\" target=\"_blank\">rsync-wrapper-failover-$...
}
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>Failover Monitoring from $slaveFQDN for Collector Daemon '$collectorDaemon'</td></tr>";
my ($hostnameAdminCollector, undef) = split (/\./, $slaveFQDN, 2);
if ( $collectorDaemon eq $hostnameAdminCollector ) {
# ------------------------------------------------------------------------
# Failover between $slaveFQDN and $masterFQDN
# ------------------------------------------------------------------------
$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
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
my \$rsync_version_2_6_7_or_higher = 1;
# 1 = 'capture_exec("\$system_action")' or 0 = 'system ("\$system_action")'
my \$captureOutput = $CAPTUREOUTPUT;
RSYNCMIRRORFILE
close (RsyncMirror);
}
$statusMessage .= do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/" .$typeMonitoringCharDorC. "S-$typeActiveServer-$slaveFQDN/slave/rsync-wrapper-failover-$slaveFQDN.sh\" target=\"_blank\">rsync-wrapper-failover-$s...
}
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>Failover Monitoring from $masterFQDN for Admin Collector Daemon '$collectorDaemon'</td></tr>";
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
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
Delete=' '
# AdditionalParams='' # --numeric-ids, -H, -v and -R
Reverse=no # 'yes' -> from master to slave
# 'no' -> from slave to master
RSYNCMIRRORFILE
close (RsyncMirror);
}
$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]
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
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
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
Delete=' --delete --delete-after '
# AdditionalParams='' # --numeric-ids, -H, -v and -R
Reverse=no # 'yes' -> from slave to master
# 'no' -> from master to slave
RSYNCMIRRORFILE
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-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]
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub createRsyncMirrorScriptsDistributed {
my ($serverID, $typeMonitoring, $typeServers, $typeActiveServer, $masterFQDN, $masterASNMTAP_PATH, $masterRSYNC_PATH, $masterSSH_PATH, $slaveFQDN, $slaveASNMTAP_PATH, $slaveRSYNC_PATH, $slaveSSH_PATH, $centralTypeMonitoring, $centralTypeServers, $c...
my $typeMonitoringCharDorC = ($typeMonitoring) ? 'D' : 'C';
my ($filename, $command, $rvOpen);
my $statusMessage = '';
if ( $typeMonitoring ) { # Distributed
$filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/CM-$centralTypeActiveServer-$centralMasterFQDN/master/rsync-wrapper-distributed-$centralMasterFQDN.sh";
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
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
my \$rsync_version_2_6_7_or_higher = 1;
# 1 = 'capture_exec("\$system_action")' or 0 = 'system ("\$system_action")'
my \$captureOutput = $CAPTUREOUTPUT;
RSYNCMIRRORFILE
close (RsyncMirror);
}
$statusMessage .= do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/CM-$centralTypeActiveServer-$centralMasterFQDN/master/rsync-wrapper-distributed-$centralMasterFQDN.sh\" target=\"_blank\">rsync-wrapper-distributed-$c...
}
if ( $centralTypeServers == $centralTypeServers ) {
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
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
my \$rsync_version_2_6_7_or_higher = 1;
# 1 = 'capture_exec("\$system_action")' or 0 = 'system ("\$system_action")'
my \$captureOutput = $CAPTUREOUTPUT;
RSYNCMIRRORFILE
close (RsyncMirror);
}
$statusMessage .= do_system_call ($command, $debug);
$statusMessage .= "<tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><a href=\"/$CONFIGDIR/generated/CS-$centralTypeActiveServer-$centralSlaveFQDN/master/rsync-wrapper-distributed-$centralSlaveFQDN.sh\" target=\"_blank\">rsync-wrapper-distributed-...
}
}
$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
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
Delete=''
# AdditionalParams='' # --numeric-ids, -H, -v and -R
Reverse=no # 'yes' -> from slave to master
# 'no' -> from master to slave
RSYNCMIRRORFILE
close (RsyncMirror);
}
$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;
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
RSYNCMIRRORFILE
close (RsyncMirror);
}
$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
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
Delete=''
# AdditionalParams='' # --numeric-ids, -H, -v and -R
Reverse=no # 'yes' -> from slave to master
# 'no' -> from master to slave
RSYNCMIRRORFILE
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]
# ------------------------------------------------------------------------------
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
closedir DIR;
}
return ($directoryAndFileList);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub do_compare_view {
my ($command, $details, $debug) = @_;
sub do_compare_diff {
my ($compareView, $type, $details, $debug) = @_;
my ($path, $generated, $installed, $compareDiff);
$path = $generated = $installed = '';
if ($type == 1) {
my (undef, $dummy) = split (/Only in generated\//, $compareView);
($path, $generated) = split (/: /, $dummy);
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
my (undef, $dummy) = split (/Only in installed\//, $compareView);
($path, $installed) = split (/: /, $dummy);
$compareDiff = "$path/$installed removed" if ( $debug eq 'T' );
} elsif ($type == 3) {
my (undef, $dummy) = split (/Files /, $compareView);
($generated, $dummy) = split (/ and /, $dummy);
($installed, undef) = split (/ differ/, $dummy);
$compareDiff = "$generated and $installed differ<BR>" if ( $debug eq 'T' );
if ($details) {
my $command = "$DIFFCOMMAND -bra -I 'generated on 20[0-9][0-9]/[0-9][0-9]/[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]' $APPLICATIONPATH/tmp/$CONFIGDIR/$generated $APPLICATIONPATH/tmp/$CONFIGDIR/$installed";
my @compareDiff = `$command 2>&1`;
foreach my $compareLine (@compareDiff) { $compareDiff .= "$compareLine<BR>"; };
}
}
return ($path, $generated, $installed, $compareDiff);
}
my $statusMessage = '';
my @compareView = `$command 2>&1`;
my %commands;
my $_id = 0;
my $connectArguments = "-o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=$WWWKEYPATH/.ssh/known_hosts' -i '$WWWKEYPATH/.ssh/$SSHIDENTITY'";
foreach my $compareView (@compareView) {
chomp ($compareView);
$compareView =~ s/^\s+//g;
$compareView =~ s/$APPLICATIONPATH\/tmp\/$CONFIGDIR\///g;
if ($compareView ne '') {
my ($type, $activeServer, $server, $path, $subpath, $generated, $installed, $compareDiff, $compareText);
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
($type, $activeServer, $server) = split (/-/, $path, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
($server, $subpath) = split (/\//, $server, 2);
$subpath .= ($subpath eq '') ? '' : '/';
# Copy '/opt/asnmtap/applications/tmp/$CONFIGDIR/generated/DM-[MS]-distributed.citap.com/etc/DisplayCT-distributed' to 'distributed.citap.com:/opt/asnmtap/applications/etc/DisplayCT-distributed'
# $APPLICATIONPATH/tmp/ /generated/<------- $path -------->/<--- $generated ----> <----- $server ----->:$APPLICATIONPATH/<---- $generated --->
# or
# Copy '/opt/asnmtap/applications/tmp/$CONFIGDIR/generated/CM-[MS]-asnmtap.citap.be/master/CollectorCT-index.sh' to 'asnmtap.citap.be:/opt/asnmtap/applications/master/CollectorCT-index.sh'
# $APPLICATIONPATH/tmp/ /generated/<------- $path -------->/<----------------- $generated ----------------> <------ $server ----->:$APPLICATIONPATH/$subpath/<------------ $generated ----------->
$commands {$server} {SCP} {++$_id} {auto} = 1;
$commands {$server} {SCP} {$_id} {label} = '+a';
$commands {$server} {SCP} {$_id} {active} = $active;
$commands {$server} {SCP} {$_id} {command} = "$SCPCOMMAND $connectArguments $APPLICATIONPATH/tmp/$CONFIGDIR/generated/$path/$generated $SSHLOGONNAME\@$server:". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$subpath$ge...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {SCP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
if (($generated =~ /^DisplayCT-[\w-]+.sh$/) or ($generated =~ /^CollectorCT-[\w-]+.sh$/)) {
$commands {$server} {CHMOD} {++$_id} {auto} = 1;
$commands {$server} {CHMOD} {$_id} {label} = '+b';
$commands {$server} {CHMOD} {$_id} {active} = $active;
$commands {$server} {CHMOD} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server chmod 755 ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$subpath$generated";
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {CHMOD} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {START} {++$_id} {auto} = 1;
$commands {$server} {START} {$_id} {label} = '+c';
$commands {$server} {START} {$_id} {active} = $active;
$commands {$server} {START} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$subpath$generated start";
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {START} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
} elsif (($generated =~ /rsync-wrapper-distributed-[\w\-.]+.sh$/) or ($generated =~ /rsync-wrapper-failover-[\w\-.]+.sh$/)) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '+d';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "'$generated' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$todo = 1;
} elsif (($generated =~ /rsync-mirror-failover-[\w\-.]+.sh$/) or ($generated =~ /rsync-mirror-distributed-[\w\-.]+.sh$/)) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '+e';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "Add 'n-59/5 * * * * $APPLICATIONPATH/$path/$generated > /dev/null' to crontab ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$todo = 1;
}
}
} elsif ( $compareView =~ /^Only in generated:/ ) {
if ($details) {
$compareText = "$compareView";
} else {
my (undef, $servername) = split (/: /, $compareView, 2);
($type, $activeServer, $server) = split (/-/, $servername, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
$commands {$server} {SCP} {++$_id} {auto} = 1;
$commands {$server} {SCP} {$_id} {label} = '+f';
$commands {$server} {SCP} {$_id} {active} = $active;
$commands {$server} {SCP} {$_id} {command} = "$SCPCOMMAND $connectArguments $APPLICATIONPATH/tmp/$CONFIGDIR/generated/$servername $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications';
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {SCP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '+g';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = read_directory ("$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$servername", '', '', '<br>', $debug) ." ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
if ($type =~ /^[CD]${activeServer}$/) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '+h';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "Now 'DisplayCT-*.sh start' and 'CollectorCT-*.sh start' and add 'rsync-mirror-*.sh' to crontab '$compareView' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
} else {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '+i';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "Now add 'rsync-mirror-*.sh' to crontab '$compareView' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
}
$todo = 1;
}
} elsif ( $compareView =~ /^Only in installed\// ) {
($path, $generated, $installed, $compareDiff) = do_compare_diff ($compareView, 2, $details, $debug);
if ($details) {
$compareText = "File '$path/$installed' removed from the generated configuration.";
} else {
my ($servername, $directory) = split (/\//, $path, 2);
($type, $activeServer, $server) = split (/-/, $servername, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
if (($installed =~ /^DisplayCT-[\w-]+.sh$/) or ($installed =~ /^CollectorCT-[\w-]+.sh$/)) {
$commands {$server} {STOP} {++$_id} {auto} = 0;
$commands {$server} {STOP} {$_id} {label} = '-a';
$commands {$server} {STOP} {$_id} {active} = $active;
$commands {$server} {STOP} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications'. ( (defined $directory) ? "/$directory" : '' ) ."/$installed stop"...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {STOP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
} elsif ((($type eq 'CS' or $type eq 'DS') and ($installed =~ /^rsync-mirror-failover-[\w\-.]+.sh$/))
or (($type eq 'DM' or $type eq 'DS') and ($installed =~ /^rsync-mirror-distributed-[\w\-.]+.sh$/))) {
$commands {$server} {CRONTAB} {++$_id} {auto} = 0;
$commands {$server} {CRONTAB} {$_id} {label} = '-b';
$commands {$server} {CRONTAB} {$_id} {active} = $active;
$commands {$server} {CRONTAB} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server DELETE ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications'. ( (defined $directory) ? "/$directory" : '' ) ."/$insta...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {CRONTAB} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
# my ($installedConf, undef) = split (/.sh/, $installed);
# $commands {$server} {REMOVE} {++$_id} {auto} = 0;
# $commands {$server} {REMOVE} {$_id} {label} = '-c';
# $commands {$server} {REMOVE} {$_id} {active} = $active;
# $commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications'. ( (defined $directory) ? "/$directory" : '' ) ."/$installedC...
# $compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$todo = 1;
} elsif ((($type eq 'CM' or $type eq 'DM') and ($installed =~ /^rsync-wrapper-failover-[\w\-.]+.sh$/))
or (($type eq 'CM' or $type eq 'CS') and ($installed =~ /^rsync-wrapper-distributed-[\w\-.]+.sh$/))) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '-d';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "'$installed' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$todo = 1;
} else {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '-e';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "UNKNOWN '$path' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
}
# Remove 'distributed.citap.com:/opt/asnmtap/applications/etc/DisplayCT-distributed-magweg'
# <----- $server ----->:$APPLICATIONPATH/<------- $installed ------->
$commands {$server} {REMOVE} {++$_id} {auto} = 1;
$commands {$server} {REMOVE} {$_id} {label} = '-f';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications'. ( (defined $directory) ? "/$directory" : '' ) ."/$installed";
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
}
} elsif ( $compareView =~ /^Only in installed:/ ) {
if ($details) {
$compareText = "$compareView";
} else {
my (undef, $servername) = split (/: /, $compareView, 2);
($type, $activeServer, $server) = split (/-/, $servername, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '-g';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = read_directory ("$APPLICATIONPATH/tmp/$CONFIGDIR/installed", '', '', '', $debug) ." ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {STOP} {++$_id} {auto} = 0;
$commands {$server} {STOP} {$_id} {label} = '-h';
$commands {$server} {STOP} {$_id} {active} = $active;
$commands {$server} {STOP} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/asnmt...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {STOP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {REMOVE} {++$_id} {auto} = 0;
$commands {$server} {REMOVE} {$_id} {label} = '-i';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {STOP} {++$_id} {auto} = 0;
$commands {$server} {STOP} {$_id} {label} = '-j';
$commands {$server} {STOP} {$_id} {active} = $active;
$commands {$server} {STOP} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/asnmt...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {STOP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {REMOVE} {++$_id} {auto} = 0;
$commands {$server} {REMOVE} {$_id} {label} = '-k';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {CRONTAB} {++$_id} {auto} = 0;
$commands {$server} {CRONTAB} {$_id} {label} = '-l';
$commands {$server} {CRONTAB} {$_id} {active} = $active;
$commands {$server} {CRONTAB} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server DELETE ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {CRONTAB} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {REMOVE} {++$_id} {auto} = 0;
$commands {$server} {REMOVE} {$_id} {label} = '-m';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$commands {$server} {REMOVE} {++$_id} {auto} = 0;
$commands {$server} {REMOVE} {$_id} {label} = '-n';
$commands {$server} {REMOVE} {$_id} {active} = $active;
$commands {$server} {REMOVE} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server rm ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {REMOVE} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
$todo = 1;
}
} elsif ( $compareView =~ /^Files generated\// ) {
($path, $generated, $installed, $compareDiff) = do_compare_diff ($compareView, 3, $details, $debug);
if ($details) {
$compareText = "File '$generated' changed into the generated configuration.";
} else {
my (undef, $servername, $filename) = split (/\//, $generated, 3);
($type, $activeServer, $server) = split (/-/, $servername, 3);
my $active = ( ( $type =~ /^[CD]${activeServer}$/ ) ? 1 : 0 );
# Replace 'distributed.citap.be:/opt/asnmtap/applications/slave/asnmtap-display.sh' with '/opt/asnmtap/applications/tmp/$CONFIGDIR/generated/DS-[SM]-distributed.citap.be/slave/asnmtap-display.sh'
# <----- $server ---->:$APPLICATIONPATH/<------ $filename -----> $APPLICATIONPATH/tmp/ /<---------------------- $generated ---------------------->
$commands {$server} {SCP} {++$_id} {auto} = 1;
$commands {$server} {SCP} {$_id} {label} = '=a';
$commands {$server} {SCP} {$_id} {active} = $active;
$commands {$server} {SCP} {$_id} {command} = "$SCPCOMMAND $connectArguments $APPLICATIONPATH/tmp/$CONFIGDIR/$generated $SSHLOGONNAME\@$server:". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$filename";
$compareText .= '<FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {SCP} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
if (($filename =~ /^etc\/DisplayCT-[\w-]+$/) or ($filename =~ /^etc\/CollectorCT-[\w-]+$/)) {
$filename =~ s/etc\///g;
$commands {$server} {RELOAD} {++$_id} {auto} = 1;
$commands {$server} {RELOAD} {$_id} {label} = '=b';
$commands {$server} {RELOAD} {$_id} {active} = $active;
$commands {$server} {RELOAD} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/$...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {RELOAD} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
} elsif (($filename =~ /^(slave|master)\/asnmtap-display.sh$/) or ($filename =~ /^(slave|master)\/asnmtap-collector.sh$/)) {
$commands {$server} {TODO} {++$_id} {auto} = 0;
$commands {$server} {TODO} {$_id} {label} = '=c';
$commands {$server} {TODO} {$_id} {active} = $active;
$commands {$server} {TODO} {$_id} {command} = "'$filename' ?";
$compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
} elsif (($filename =~ /^(slave|master)\/DisplayCT-[\w-]+\.sh$/) or ($filename =~ /^(slave|master)\/CollectorCT-[\w-]+\.sh$/)) {
$commands {$server} {START} {++$_id} {auto} = 0;
$commands {$server} {START} {$_id} {label} = '=d';
$commands {$server} {START} {$_id} {active} = $active;
$commands {$server} {START} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/$f...
$compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {START} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
# } elsif ( $filename =~ /^master\/rsync-mirror-failover-[\w\-.]+.conf$/ or $filename =~ /^slave\/rsync-mirror-failover-[\w\-.]+.conf$/) {
# deze bestanden worden reeds gecopieerd door middel van bovenstaande SCP in deze sectie
}
}
} elsif ( $compareView =~ /^diff: installed: No such file or directory/ ) {
$compareText = "The installed configuration doesn't exist.";
} elsif ( $compareView =~ /^diff: generated: No such file or directory/ ) {
$compareText = "The generated configuration doesn't exist.";
} else {
$compareText = "<b>Under construction:</b> < $compareView >";
}
unless ( $details ) { $compareText = "<b>$compareText</b>" if (defined $compareText and ($todo or (defined $activeServer and $type =~ /^[CD]${activeServer}$/))); }
$statusMessage .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>$compareView</td></tr>" if ($details or $debug eq 'T');
$statusMessage .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$compareDiff</td></tr>" if (defined $compareDiff);
$statusMessage .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td>$compareText</td></tr>" if (defined $compareText);
}
}
my ($commandsToExecute, $commandsExecuted, $commandsTODO) = ( $_id, 0 );
foreach my $_servers ( sort keys %commands ) {
my $_server = $commands {$_servers};
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{NOBLOCK}\"><td>$_servers</td></tr>";
my $exitCurrentServer = 0;
foreach my $type ( 'TODO', 'SCP', 'CHMOD', 'RELOAD', 'STOP', 'START', 'CRONTAB', 'REMOVE' ) {
next if ( $exitCurrentServer );
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>$type</td></tr>";
my $_type = $_server->{$type};
foreach my $_id ( keys %$_type ) {
next if ( $exitCurrentServer );
my $auto = ( ( exists $_type->{$_id}{auto} and $_type->{$_id}{auto} ) ? $_type->{$_id}{auto} : 0 );
my $label = ( ( exists $_type->{$_id}{label} and $_type->{$_id}{label} ) ? $_type->{$_id}{label} : '??' );
my $active = ( ( exists $_type->{$_id}{active} and $_type->{$_id}{active} ) ? $_type->{$_id}{active} : 0 );
my $command = ( ( exists $_type->{$_id}{command} and $_type->{$_id}{command} ) ? $_type->{$_id}{command} : '' );
unless ( defined $command ) {
my $prefix = ( ( $debug eq 'T' ) ? "E) '$label' [$_id] " : '' );
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><FONT COLOR=\"red\">${prefix}${command}</FONT></td></tr>";
} elsif ( $type !~ /^(?:RELOAD|STOP|START)$/ or ( $type =~ /^(?:RELOAD|STOP|START)$/ and $active ) ) {
if ( $Cauto == 1 and $auto == 1 ) {
my $color = 'red';
my @capture = `$command 2>&1`;
my $exit_value = $? >> 8;
my $signal_num = $? & 127;
my $dumped_core = $? & 128;
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td><FONT COLOR=\"white\">$exit_value - $signal_num - $dumped_core - ". join('<br>', @capture) ."</FONT></td></tr>" if ( $debug eq 'T' );
if ( $exit_value == 0 && $signal_num == 0 && $dumped_core == 0 ) {
my ($lineNumber, $proccessNextLine) = (0, 0);
foreach my $capture ( @capture ) {
$capture =~ s/\r$//g;
$capture =~ s/\n$//g;
next unless ( defined $capture and ! $exitCurrentServer );
$lineNumber++;
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td><FONT COLOR=\"cyaan\">$capture</FONT></td></tr>";
if ( $lineNumber == 1 ) {
for ( $type ) {
/^SCP$/ && do { last; };
/^CHMOD$/ && do { last; };
/^RELOAD$/ && do {
$exitCurrentServer = ( ( $capture =~ /^Reload:(?:\s)*'(Collector|Display)(?:\s)*(.)*'(?:\s)*...$/ ) ? 0 : 1 );
last; };
/^STOP$/ && do {
$exitCurrentServer = ( ( $capture =~ /^(Stop:(?:\s)*'(Collector|Display)(?:\s)*(.)*'(?:\s)*...|'(Collector|Display)(?:\s)*(.)*'(?:\s)*already stopped)$/ ) ? 0 : 1 );
last; };
/^START$/ && do {
$exitCurrentServer = ( ( $capture =~ /^Start:(?:\s)*'(Collector|Display)(?:\s)*(.)*'(?:\s)*...$/ ) ? 0 : 1 );
$proccessNextLine++ unless ( $exitCurrentServer );
last; };
/^CRONTAB$/ && do { last; };
/^REMOVE$/ && do { last; };
$exitCurrentServer = 1;
}
} elsif ( $proccessNextLine ) {
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td><FONT COLOR=\"cyaan\">proccess next line: $proccessNextLine - $capture</FONT></td></tr>";
} else {
my $match = 0;
if ( $debug eq 'T' ) {
for ( $capture ) {
/kill:(?:\s)*\((?:\d)*\)(?:\s)*-(?:\s)*No such process$/ && do { $match = 1; $exitCurrentServer = 1; last; };
/^cat:(?:\s)*cannot(?:\s)*open(?:\s)*(.)*\.pid$/ && do { $match = 2; $exitCurrentServer = 1; last; };
}
} else {
$exitCurrentServer = 1;
}
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td><FONT COLOR=\"cyaan\">match rule: $match - $capture</FONT></td></tr>";
}
}
$color = '#99CC99' unless ( $exitCurrentServer );
} else {
$exitCurrentServer = 1;
foreach my $capture ( @capture ) {
$capture =~ s/\r$//g;
$capture =~ s/\n$//g;
applications/htmlroot/cgi-bin/admin/generateConfig.pl view on Meta::CPAN
if ( $debug eq 'T' ) {
for ( $capture ) {
/^ksh:(?:\s)*(.)*:(?:\s)*not found$/ && do { $match = 127; last; }; # exit_value = 127
/^ksh:(?:\s)*(.)*:(?:\s)*cannot execute$/ && do { $match = 126; last; }; # exit_value = 126
/^scp:(?:\s)*(.)*:(?:\s)*No such file or directory$/ && do { $match = 1; last; }; # exit_value = 1
$match = '?';
}
}
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td><FONT COLOR=\"cyaan\">match rule: $match = exit_value: $exit_value - $capture</FONT></td></tr>";
}
}
my $prefix = ( ( $debug eq 'T' ) ? "A) '$label' [$_id] " : '' );
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><b><FONT COLOR=\"$color\">${prefix}${command}</FONT></b></td></tr>";
} else { # implementatie moet nog gebeuren
my $color = ( ( $auto == 1 ) ? '#99CC99' : 'white');
my $prefix = ( ( $debug eq 'T' ) ? "I) '$label' [$_id] " : '' );
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><b><FONT COLOR=\"$color\">${prefix}${command}</FONT></b></td></tr>";
}
} else { # no action required
my $prefix = ( ( $debug eq 'T' ) ? "N) '$label' [$_id] " : '' );
$commandsTODO .= "\n <tr bgcolor=\"$COLORSTABLE{ENDBLOCK}\"><td><FONT COLOR=\"#99CC99\">${prefix}${command}</FONT></td></tr>";
}
$commandsExecuted++ unless ( $exitCurrentServer );
}
}
}
$statusMessage .= $commandsTODO if (defined $commandsTODO);
# APE #
# unless ($details)
# $action = 'errorView' unless ( $commandsToExecute eq $commandsExecuted );
# }
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub do_system_call {
my ($command, $debug) = @_;
my ($stdout, $stderr, $exit_value, $signal_num, $dumped_core, $status, $statusMessage);
if ($CAPTUREOUTPUT) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec("$command");
} else {
system ("$command"); $stdout = $stderr = '';
}
if ( $debug eq 'T' ) {
$exit_value = $? >> 8;
$signal_num = $? & 127;
$dumped_core = $? & 128;
$statusMessage = "<tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>$command: ";
$statusMessage .= ( $exit_value == 0 && $signal_num == 0 && $dumped_core == 0 && $stderr eq '' ) ? 'Success' : "Failed '$stderr'";
$statusMessage .= "</td></tr>";
} else {
$statusMessage = '';
}
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub system_call {
my ($command, $parameters, $debug) = @_;
my $doSystemCall = 0;
my $statusMessage = '';
if ( $command eq "mkdir" ) {
$doSystemCall = 1 unless ( -e "$parameters" );
} elsif ( $command eq "rm -rf" ) {
if ($parameters =~ /$APPLICATIONPATH\/tmp\/$CONFIGDIR\// and -e "$parameters") { $doSystemCall = 1; }
} elsif ( $command eq "cp" ) {
if ($parameters =~ /^$APPLICATIONPATH\/tmp\/$CONFIGDIR/) { $doSystemCall = 1; }
} elsif ( $command eq "mv" ) {
if ($parameters =~ /^$APPLICATIONPATH\/tmp\/$CONFIGDIR/) { $doSystemCall = 1; }
} elsif ( $command =~ /diff -braq -I/ ) {
if ($parameters =~ /^$APPLICATIONPATH\/tmp\/$CONFIGDIR\/generated $APPLICATIONPATH\/tmp\/$CONFIGDIR\/installed/) { $statusMessage = do_compare_view("$command $parameters", 1, $debug); }
} elsif ( $command =~ /diff -braq -E/ ) {
$command =~ s/diff -braq -E/diff -braq -I/g;
if ($parameters =~ /^$APPLICATIONPATH\/tmp\/$CONFIGDIR\/generated $APPLICATIONPATH\/tmp\/$CONFIGDIR\/installed/) { $statusMessage = do_compare_view("$command $parameters", 0, $debug); }
}
if ( $doSystemCall ) {
$statusMessage = do_system_call ("$command $parameters", $debug);
if ( $command eq "mkdir" and $parameters =~ /^$APPLICATIONPATH\/tmp\/$CONFIGDIR/ ) {
$statusMessage .= do_system_call ("cp $APPLICATIONPATH/tools/templates/HEADER.html $parameters/", $debug);
$statusMessage .= do_system_call ("cp $APPLICATIONPATH/tools/templates/FOOTER.html $parameters/", $debug);
}
}
return ($statusMessage);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/comments.pl view on Meta::CPAN
<td>Solved: </td>
<td>
<b><input type="text" name="solvedDate" value="$CsolvedDate" size="10" maxlength="10"></b> <a href="#" onclick="cal1Calendar.select(document.forms[1].solvedDate, 'solvedDateCalendar','yyyy-MM-dd'); return false;" name="solvedDateCalend...
<b><input type="text" name="solvedTime" value="$CsolvedTime" size="8" maxlength="8" onChange="ReadISO8601time(document.forms['comments'].solvedTime.value);"></b> format: hh:mm:ss, 00:00:00 to 23:59:59
</td>
</tr><tr><td> </td><td> </td>
HTML
}
print <<HTML;
</tr><tr><td> </td><td>Please enter all required information before committing the command. Required fields are marked in bold.</td>
</tr><tr align="left"><td align="right"><br><input type="submit" value="$submitButton"></td><td><br><input type="reset" value="Reset"></td></tr>
</table></td></tr>
HTML
} elsif ($action eq 'deleteView' or $action eq 'editView' or $action eq 'updateView') {
print <<HTML;
<tr align="center"><td>
<input type="hidden" name="catalogID" value="$CcatalogID">
<input type="hidden" name="id" value="$Cid">
<input type="hidden" name="uKey" value="$CuKey">
<input type="hidden" name="problemSolved" value="$CproblemSolved">
applications/htmlroot/cgi-bin/getArchivedDisplays.pl view on Meta::CPAN
<b><input type="text" name="creationDate" value="$CcreationDate" size="10" maxlength="10"></b> <a href="#" onclick="cal1Calendar.select(document.forms[1].creationDate, 'creationDateCalendar','yyyy-MM-dd'); return false;" name="entryDat...
<b><input type="text" name="creationTime" value="$CcreationTime" size="8" maxlength="8" onChange="ReadISO8601time(document.forms['getArchivedDisplays'].creationTime.value);"></b> format: hh:mm:ss, 00:00:00 to 23:59:59
</tr><tr align="left"><td align="right"><br><input type="submit" value="Go"></td><td><br><input type="reset" value="Reset"></td></tr>
</table>
</form>
<HR>
EndOfHtml
}
if ( defined $creationTime and defined $displayDaemon ) {
my $command = "archive cd $APPLICATIONPATH; $PERLCOMMAND ./display.pl --loop=F --creationTime=\"$creationTime\" --displayTime=T --lockMySQL=F --debug=F --hostname=$SERVERNAMEREADONLY --checklist=DisplayCT-$displayDaemon --pagedir=_loop_${remote...
print "<P class=\"RunStatusOnDemandHtmlTitle\">$htmlTitle: <font class=\"RunStatusOnDemandCommand\">$command</font></P><IMG SRC=\"".$IMAGESURL."/gears.gif\" HSPACE=\"0\" VSPACE=\"0\" BORDER=\"0\" NAME=\"Progress\" title=\"Please Wait ...\" alt=...
my ($rStatus, $rStdout, $rStderr) = call_system ("$SSHCOMMAND -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=$WWWKEYPATH/.ssh/known_hosts' -i '$WWWKEYPATH/.ssh/ssh' $SSHLOGONNAME\@localhost '$command'", ($debug eq 'T') ? 1 : 0);
$rStderr =~ s/^stdin: is not a tty//;
chomp ($rStderr);
if ( $rStderr ) {
print "<tr><td><pre>Status : '$rStatus'\n\nCommand: '$command'\n\nMessage: $rStderr\n\nSTDOUT : '$rStdout'\n\nSTDERR : '$rStderr'></pre></tr></td></table>\n";
} else {
print "<tr><td><a href=\"$HTTPSURL/nav/_loop_${remoteUser}_${pageDir}/$pageset.html\" target=\"_blank\">$htmlTitle for $creationTime</a></tr></td></table>\n";
}
} else {
print "<br>Missing Display Daemon 'date/time'<br>";
}
print '<BR>', "\n";
}
}
applications/htmlroot/cgi-bin/htmlToPdf.pl view on Meta::CPAN
my $subTitle = "HTML to PDF";
my $message;
if ( ( ! defined $scriptname ) or ( ! defined $sessionID ) ) {
$message = "Scriptname and/or CGISESSID missing";
} else {
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&detailed=$selDetailed&catalogID=$CcatalogID&uKey1=$uKey1&uKey2=$uKey2&uKey3=$uKey3&startDate=$startDate&endDate=$...
if ($HTMLtoPDFprg eq 'htmldoc') {
my $command = "$HTMLtoPDFprg -t pdf $HTMLTOPDFOPTNS 'http://${REMOTE_HOST}$scriptname?$urlAccessParameters'";
if ( $debug eq 'T' ) {
$message = $command;
} else {
$ENV{HTMLDOC_NOCGI} = 1;
select(STDOUT); $| = 1;
print "Content-Type: application/pdf\n";
print "Content-disposition: attachment; filename=GeneratedReport.pdf\n\n";
my ($status, $stdout, $stderr) = call_system ("$command", $debug);
print $stdout;
}
} else {
$message = "$HTMLtoPDFprg not supported";
}
}
if ( defined $message ) {
print "Content-Type: Text/HTML\n\n";
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', '', $sessionID);
applications/htmlroot/cgi-bin/moderator/comments.pl view on Meta::CPAN
<li>problem is automatically solved when 'current Timeslot' > 'Suspention Date/time'</li>
</ul>
</li>
<li>persistent:
<ul type="disc">
<li>problem is automatically solved when 'current Timeslot' > 'Suspention Date/time'</li>
<li>problem is <b>never</b> automatically solved when 'Suspention Date/time' is missing</li>
</ul>
</li>
</ul></td>
</tr><tr><td> </td><td>Please enter all required information before committing the command. Required fields are marked in bold.</td>
</tr><tr align="left"><td align="right"><br><input type="submit" value="Insert"></td><td><br><input type="reset" value="Reset"></td></tr>
</table></td></tr>
HTML
} else {
print "<tr><td colspan=\"2\"><b>uKey from CatalogID overview:</b><br><br>$CatalogIDuKeyListStatus</td></tr>\n";
}
print " </table>\n";
if ($action eq 'insertView') {
applications/htmlroot/cgi-bin/moderator/downtimes.pl view on Meta::CPAN
<b><input type="text" name="activationTime" value="$CactivationTime" size="8" maxlength="8" onChange="ReadISO8601time(document.forms['downtimes'].activationTime.value);"></b> format: hh:mm:ss, 00:00:00 to 23:59:59
</td>
</tr><tr>
<td>Suspention: </td>
<td>
<b><input type="text" name="suspentionDate" value="$CsuspentionDate" size="10" maxlength="10"></b>
<a href="#" onclick="cal1Calendar.select(document.forms[0].suspentionDate, 'suspentionDateCalendar','yyyy-MM-dd'); return false;" name="suspentionDateCalendar" id="suspentionDateCalendar"><img src="$IMAGESURL/cal.gif" alt="Calendar" border="0"></...
<b><input type="text" name="suspentionTime" value="$CsuspentionTime" size="8" maxlength="8" onChange="ReadISO8601time(document.forms['downtimes'].suspentionTime.value);"></b> format: hh:mm:ss, 00:00:00 to 23:59:59
</td>
</tr><tr><td> </td><td> </td>
</tr><tr><td> </td><td>Please enter all required information before committing the command. Required fields are marked in bold.</td>
</tr><tr align="left"><td align="right"><br><input type="submit" value="Insert"></td><td><br><input type="reset" value="Reset"></td></tr>
</table></td></tr>
HTML
} else {
print "<tr><td colspan=\"2\">$CatalogIDuKeyListStatus</td></tr>\n";
}
print " </table>\n";
if ($action eq 'insertView') {
applications/htmlroot/cgi-bin/moderator/runStatusOnDemand.pl view on Meta::CPAN
# 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') : 'moderator'; $pageset =~ s/\+/ /g;
my $debug = (defined $cgi->param('debug')) ? $cgi->param('debug') : 'F';
my $status = (defined $cgi->param('status')) ? $cgi->param('status') : '<NIHIL>'; $status =~ s/\+/ /g;
my $action = (defined $cgi->param('action')) ? $cgi->param('action') : '<NIHIL>';
my $Cpid = (defined $cgi->param('pid')) ? $cgi->param('pid') : -1;
my $Cppid = (defined $cgi->param('ppid')) ? $cgi->param('ppid') : -1;
my $Ccommand = (defined $cgi->param('command')) ? $cgi->param('command') : '<NIHIL>';
my $command = '';
my $FORMATPSA = "<tr><td class=\"%s\">%s %s %s %s %s %s %s %s</td><td class=\"%s\">%s</td></tr>\n";
my $FORMATPS = "<tr><td colspan=\"2\" class=\"%s\">%s %s %s %s %s %s %s %s</td>\n";
my (%daemonProcessTableCmndline, %daemonProcessTablePctmem, %daemonProcessTableSize, %daemonProcessTableTtydev, %daemonProcessTableStart, %daemonProcessTableState) = ();
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
my $htmlTitle = $APPLICATION;
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, $userType, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'modera...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&status=$status";
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>status : $status<br>action : $action<br>pid : $Cpid<br>ppid : $Cppid<br>command : $Ccommand<br>URL ... : $urlAccessParameters</pr...
my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&status=$status";
unless ( defined $errorUserAccessControl ) {
# 'Moderator' = 2, 'Administrator' = 4 & 'Server Administrator' = 8
if ($userType >= 4) {
($iconAdd, $iconDelete, $iconDetails, $iconEdit) = (1, 1, 1, 1);
} else {
($iconAdd, $iconDelete, $iconDetails, $iconEdit) = (0, 0, 0, 0);
}
applications/htmlroot/cgi-bin/moderator/runStatusOnDemand.pl view on Meta::CPAN
<input type="hidden" name="debug" value="$debug">
<table border=0>
<tr align="left"><td>Status:</td><td>$typeStatusSelect</td></tr>
<tr align="left"><td align="right"><br><input type="submit" value="Launch"></td><td><br><input type="reset" value="Reset"></td></tr>
</table>
</form>
<HR>
EndOfHtml
if ($action eq 'kill') {
doRequestedActions ($htmlTitle, "$Ccommand $Cpid", "$Ccommand $Cpid", "Process(es) killed.", "Process(es) not killed.", $debug);
} elsif ($action =~ /^(?:start|stop|reload|restart)$/) {
doRequestedActions ($htmlTitle, "script $Ccommand $action", "script $Ccommand $action", "$Ccommand ${action}ed.", "$Ccommand not ${action}ed.", $debug);
} elsif ($action eq 'remove') {
doRequestedActions ($htmlTitle, "remove $Ccommand", "remove $Ccommand", "$Ccommand removed.", "$Ccommand not removed.", $debug);
} elsif ($status ne '<NIHIL>') {
my $binMasterOrSlave = '<NIHIL>';
if (-s "$APPLICATIONPATH/master/asnmtap-$status.sh") {
$binMasterOrSlave = 'master';
} elsif (-s "$APPLICATIONPATH/slave/asnmtap-$status.sh") {
$binMasterOrSlave = 'slave';
} elsif (-s "$APPLICATIONPATH/bin/asnmtap-$status.sh") {
$binMasterOrSlave = 'bin';
}
if ($binMasterOrSlave ne '<NIHIL>') {
my ($capture_array, $daemonCaptureHeader, $daemonCaptureStatus, $daemonCaptureParent);
my (%daemonCaptureArrayName, %daemonCaptureArrayPid, %daemonCaptureArrayParent) = ();
my (%daemonProcessTableParent, %daemonProcessTableChild, %daemonProcessTableSubChild) = ();
$command = "asnmtap-$status.sh status";
print "<P class=\"RunStatusOnDemandHtmlTitle\">$htmlTitle: <font class=\"RunStatusOnDemandCommand\">$APPLICATIONPATH/$binMasterOrSlave/$command</font></P><IMG SRC=\"".$IMAGESURL."/gears.gif\" HSPACE=\"0\" VSPACE=\"0\" BORDER=\"0\" NAME=\"Progre...
my $_ppid = 1;
if (-e '/usr/bin/zonename') { # Solaris 10 root into an non global zone where pid != 1 & pid == ppid
my $zonename = `/usr/bin/zonename`;
if ( $zonename ne 'global' ) {
$_ppid = `ps -e -o 'pid ppid zone fname' | grep zsched | awk '{print \$1}'`;
}
}
my @capture_array = `cd $APPLICATIONPATH/$binMasterOrSlave; $PERLCOMMAND $command 2>&1`;
use Proc::ProcessTable;
my $tProcessTable = new Proc::ProcessTable;
my $daemonPidStatus = ( ($status eq 'display') ? 'Display' : ( ($status eq 'collector') ? 'Collector' : 'importDataThroughCatalog' ) );
my $prefix = ( ( $status eq 'importDataThroughCatalog' ) ? '' : 'CT-');
my @daemonPidPathFilenames = glob("$PIDPATH/${daemonPidStatus}$prefix". ( $prefix eq '' ? '' : '*' ) ."\.pid");
applications/htmlroot/cgi-bin/moderator/runStatusOnDemand.pl view on Meta::CPAN
if ($state == 3 and defined $daemonCaptureArrayPid {$daemon}) {
my $pidParent = $daemonCaptureArrayPid {$daemon};
delete $daemonCaptureArrayPid {$daemon};
if (defined $daemonProcessTableParent {$pidParent}) {
my $cmndline = ($daemonProcessTableCmndline {$pidParent} =~ /(\.\/[\w-]+.pl)/) ? $1 . ' ...' : $daemonProcessTableCmndline {$pidParent};
if ($iconAdd or $iconDelete or $iconDetails or $iconEdit ) {
my $urlAction = '';
$urlAction .= "<A HREF=\"$urlWithAccessParameters&pid=$pidParent&ppid=1&command=$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh&action=reload\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{daemon...
$urlAction .= "<A HREF=\"$urlWithAccessParameters&pid=$pidParent&ppid=1&command=$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh&action=restart\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{daemo...
$urlAction .= "<A HREF=\"$urlWithAccessParameters&pid=$pidParent&ppid=1&command=$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh&action=stop\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{daemonSt...
printf($FORMATPSA, "RunStatusOnDemandCaptureParent", $pidParent, 1, $daemonProcessTablePctmem {$pidParent}, $daemonProcessTableSize {$pidParent}, $daemonProcessTableTtydev {$pidParent}, $daemonProcessTableState {$pidParent}, scalar(lo...
} else {
printf($FORMATPS, "RunStatusOnDemandCaptureParent", $pidParent, $daemonProcessTableParent {$pidParent}, $daemonProcessTablePctmem {$pidParent}, $daemonProcessTableSize {$pidParent}, $daemonProcessTableTtydev {$pidParent}, $daemonProce...
}
while ( my ($pidChild, $ppidChild) = each(%daemonProcessTableChild) ) {
if ($ppidChild == $pidParent) {
my $cmndline = ($daemonProcessTableCmndline {$pidChild} =~ /^(sh -c cd \Q$PLUGINPATH\E; \.\/[\w-]+.pl)/) ? $1 . ' ...' : $daemonProcessTableCmndline {$pidChild};
if ($iconDelete) {
my $urlAction = "<A HREF=\"$urlWithAccessParameters&pid=$pidChild&ppid=$ppidChild&command=killall&action=kill\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{pidKill}\" ALT=\"Kill\" BORDER=0></A>";
printf($FORMATPSA, "RunStatusOnDemandCaptureChild", $pidChild, $ppidChild, $daemonProcessTablePctmem {$pidChild}, $daemonProcessTableSize {$pidChild}, $daemonProcessTableTtydev {$pidChild}, $daemonProcessTableState {$pidChild}, sc...
} else {
printf($FORMATPS, "RunStatusOnDemandCaptureChild", $pidChild, $ppidChild, $daemonProcessTablePctmem {$pidChild}, $daemonProcessTableSize {$pidChild}, $daemonProcessTableTtydev {$pidChild}, $daemonProcessTableState {$pidChild}, sca...
}
while ( my ($pidSubChild, $ppidSubChild) = each(%daemonProcessTableSubChild) ) {
if ($ppidSubChild == $pidChild) {
my $cmndline = ($daemonProcessTableCmndline {$pidSubChild} =~ /^(\Q$PERLCOMMAND\E \.\/[\w-]+.pl)/) ? $1 . ' ...' : $daemonProcessTableCmndline {$pidSubChild};
printf($FORMATPS, "RunStatusOnDemandCaptureSubChild", $pidSubChild, $ppidSubChild, $daemonProcessTablePctmem {$pidSubChild}, $daemonProcessTableSize {$pidSubChild}, $daemonProcessTableTtydev {$pidSubChild}, $daemonProcessTableSt...
delete $daemonProcessTableSubChild {$pidSubChild};
applications/htmlroot/cgi-bin/moderator/runStatusOnDemand.pl view on Meta::CPAN
delete $daemonProcessTableChild {$pidChild};
}
}
delete $daemonProcessTableParent {$pidParent};
}
} else {
if ($state == -1 or $state == 1) {
if ($iconDelete) {
my $urlAction = "<A HREF=\"$urlWithAccessParameters&pid=<NIHIL>&ppid=<NIHIL>&command=$PIDPATH/${daemonPidStatus}$urlDaemon.pid&action=remove\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{pidRemove}\" ALT=\"Remove\" BORDER=0></A...
print "<tr><td class=\"RunStatusOnDemandCaptureDebug\">No running process for pidfile '$PIDPATH/${daemonPidStatus}$urlDaemon.pid' found</td><td class=\"RunStatusOnDemandCaptureDebugAction\">$urlAction</td></tr>\n";
} else {
print "<tr><td colspan=\"2\" class=\"RunStatusOnDemandCaptureDebug\">No running process for pidfile '$PIDPATH/${daemonPidStatus}$urlDaemon.pid' found</td></tr>\n";
}
} elsif ($state == 0 or $state == 2) {
if ($iconAdd) {
my $urlAction = "<A HREF=\"$urlWithAccessParameters&pid=<NIHIL>&ppid=<NIHIL>&command=$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh&action=start\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{da...
print "<tr><td class=\"RunStatusOnDemandCaptureDebug\">$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh start</td><td class=\"RunStatusOnDemandCaptureDebugAction\">$urlAction</td></tr>\n";
} else {
print "<tr><td colspan=\"2\" class=\"RunStatusOnDemandCaptureDebug\">$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh start</td></tr>\n";
}
} else {
print "<tr><td colspan=\"2\" class=\"RunStatusOnDemandCaptureDebug\">Under construction: Daemon: '$daemonPidStatus ASNMTAP $daemon' running # $state</td></tr>\n";
}
delete $daemonCaptureArrayPid {$daemon};
}
applications/htmlroot/cgi-bin/moderator/runStatusOnDemand.pl view on Meta::CPAN
sub listAllProblems {
my ($classType, $text, $daemonPidStatus, $prefix, $daemonProcessTableHash, $regex, $action, $debug) = @_;
print "<tr><td colspan=\"2\" class=\"RunStatusOnDemandCaptureRunning\">$text</td></tr>\n" if (keys (%$daemonProcessTableHash));
while ( my ($pid, $ppid) = each(%$daemonProcessTableHash) ) {
my $cmndline = (defined $regex and $daemonProcessTableCmndline {$pid} =~ /$regex/) ? $1 . ' ...' : $daemonProcessTableCmndline {$pid};
if ($iconDelete) {
if ($action eq 'remove') {
my $urlAction = "<A HREF=\"$urlWithAccessParameters&pid=<NIHIL>&ppid=<NIHIL>&command=$PIDPATH/${daemonPidStatus}${prefix}${pid}.pid&action=remove\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{pidRemove}\" ALT=\"Remove\" BORDER=0></A>";
print "<tr><td class=\"RunStatusOnDemandCapture$classType\">No running process for pidfile '$PIDPATH/${daemonPidStatus}${prefix}${pid}.pid' found</td><td class=\"RunStatusOnDemandCapture${classType}Action\">$urlAction</td></tr>\n";
} else {
my $urlAction = "<A HREF=\"$urlWithAccessParameters&pid=$pid&ppid=$ppid&command=killall&action=$action\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{pidKill}\" ALT=\"$action\" BORDER=0></A>";
printf($FORMATPSA, "RunStatusOnDemandCapture$classType", $pid, $ppid, $daemonProcessTablePctmem {$pid}, $daemonProcessTableSize {$pid}, $daemonProcessTableTtydev {$pid}, $daemonProcessTableState {$pid}, scalar(localtime($daemonProcessTableSta...
}
} else {
if ($action eq 'remove') {
print "<tr><td colspan=\"2\" class=\"RunStatusOnDemandCapture$classType\">No running process for pidfile '$PIDPATH/${daemonPidStatus}${prefix}${pid}.pid' found</td></tr>\n";
} else {
printf($FORMATPS, "RunStatusOnDemandCapture$classType", $pid, $ppid, $daemonProcessTablePctmem {$pid}, $daemonProcessTableSize {$pid}, $daemonProcessTableTtydev {$pid}, $daemonProcessTableState {$pid}, scalar(localtime($daemonProcessTableStar...
}
}
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub doRequestedActions {
my ($htmlTitle, $title, $command, $statusOK, $statusNOK, $debug) = @_;
print "<P class=\"RunStatusOnDemandHtmlTitle\">$htmlTitle: <font class=\"RunStatusOnDemandCommand\">$title</font></P><IMG SRC=\"".$IMAGESURL."/gears.gif\" HSPACE=\"0\" VSPACE=\"0\" BORDER=\"0\" NAME=\"Progress\" title=\"Please Wait ...\" alt=\"Plea...
my ($rStatus, $rStdout, $rStderr) = call_system ("$SSHCOMMAND -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=$WWWKEYPATH/.ssh/known_hosts' -i '$WWWKEYPATH/.ssh/ssh' $SSHLOGONNAME\@localhost '$command'", ($debug eq 'T') ? 1 : 0);
$rStderr =~ s/^stdin: is not a tty//;
chomp ($rStderr);
# my $message = ($rStderr) ? $rStderr : (($rStatus) ? $statusOK : $statusNOK);
my $message = ($rStderr) ? $rStderr : $statusOK;
print "<tr><td><pre>Status : '$rStatus'\n\nCommand: '$command'\n\nMessage: $message\n\nSTDOUT : '$rStdout'\n\nSTDERR : '$rStderr'></pre></tr></td></table>\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
applications/htmlroot/cgi-bin/runCmdOnDemand.pl view on Meta::CPAN
use ASNMTAP::Asnmtap::Applications::CGI v3.002.003;
use ASNMTAP::Asnmtap::Applications::CGI qw(:APPLICATIONS :CGI :MEMBER :DBREADONLY :DBTABLES $PERLCOMMAND $SSHCOMMAND $SSHLOGONNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
use vars qw($PROGNAME);
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$PROGNAME = "runCmdOnDemand.pl";
my $prgtext = "Run command on demand 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.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# URL Access Parameters
my $cgi = new CGI;
my $CcatalogID = (defined $cgi->param('catalogID')) ? $cgi->param('catalogID') : $CATALOGID;
my $CcatalogIDreload = (defined $cgi->param('catalogIDreload')) ? $cgi->param('catalogIDreload') : 0;
my $uKey = (defined $cgi->param('uKey')) ? $cgi->param('uKey') : '<NIHIL>'; $uKey =~ s/\+/ /g;
my $pagedir = (defined $cgi->param('pagedir')) ? $cgi->param('pagedir') : 'index'; $pagedir =~ s/\+/ /g;
applications/htmlroot/cgi-bin/runCmdOnDemand.pl view on Meta::CPAN
my $htmlTitle = $APPLICATION .' - '. $ENVIRONMENT{$environment};
my $selectF = ($debug eq 'F') ? "selected" : '';
my $selectT = ($debug eq 'T') ? "selected" : '';
my $selectL = ($debug eq 'L') ? "selected" : '';
my $selectM = ($debug eq 'M') ? "selected" : '';
my $selectA = ($debug eq 'A') ? "selected" : '';
my $selectS = ($debug eq 'S') ? "selected" : '';
my ($command, $FQDN, $typeActiveServer, $masterFQDN, $slaveFQDN) = ('', '');
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, $userType, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'guest'...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&uKey=$uKey";
unless ( defined $errorUserAccessControl ) {
applications/htmlroot/cgi-bin/runCmdOnDemand.pl view on Meta::CPAN
($rv, $uKeySelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $uKey, 'uKey', '', '', '', '', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
if ( $rv ) {
if ($uKey ne '<NIHIL>') {
$sql = "select distinct test, $SERVERTABLPLUGINS.environment, $SERVERTABLPLUGINS.arguments, argumentsOndemand, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as optionValueTitle, trendline, typeActiv...
$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 ) {
my ($dCommand, $environment, $arguments, $argumentsOndemand, $title, $trendline, $typeActiveServer, $masterFQDN, $slaveFQDN) = $sth->fetchrow_array();
$command = $dCommand;
$FQDN = (($typeActiveServer eq 'M') ? $masterFQDN : $slaveFQDN);
# ($FQDN, undef) = split (/\./, $FQDN, 2);
if ($environment ne '') { $command .= " --environment=" . $environment; }
if ($arguments ne '') { $command .= " " . $arguments; }
if ($argumentsOndemand ne '') { $command .= " " . $argumentsOndemand; }
if (int($trendline) > 0) { $command .= " --trendline=" . $trendline; }
$htmlTitle = 'Results for '. $title .' from '. $CcatalogID ." launched on $FQDN (?= $RUNCMDONDEMAND)";
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
}
}
$dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
}
applications/htmlroot/cgi-bin/runCmdOnDemand.pl view on Meta::CPAN
print <<EndOfHtml;
</select>
</td></tr>
<tr align="left"><td align="right"><br><input type="submit" value="Launch"></td><td><br><input type="reset" value="Reset"></td></tr>
</table>
</form>
<HR>
EndOfHtml
if (!$CcatalogIDreload and $uKey ne '<NIHIL>') {
my $commandMaskedPassword = maskPassword ($command);
print "<P class=\"RunCmdOnDemandHtmlTitle\">$htmlTitle:<br> <font class=\"RunCmdOnDemandCommand\">$commandMaskedPassword --onDemand=Y --debug=$debug --asnmtapEnv='F|F|F'</font></P><IMG SRC=\"".$IMAGESURL."/gears.gif\" HSPACE=\"0\" VSPACE=\"0\" ...
my ($capture_long, $capture_html, $capture_text, $capture_debug, $capture_array, @WebTransactResponses, @capture_array);
$capture_long = $capture_html = $capture_text = $capture_debug = $capture_array = 0;
# my $capture_exec = ( $RUNCMDONDEMAND eq 'probe' ) ? "$SSHCOMMAND -i '$SSHKEYPATH/$SSHLOGONNAME/.ssh/asnmtap.id' -o 'StrictHostKeyChecking=no' $SSHLOGONNAME\@$FQDN \"if [ -d /opt/monitoring/asnmtap/plugins/ ]; then cd /opt/monitoring/asnmtap/plu...
my $capture_exec = ( $RUNCMDONDEMAND eq 'probe' ) ? "$SSHCOMMAND -i '$SSHKEYPATH/$SSHLOGONNAME/asnmtap.id' -o 'StrictHostKeyChecking=no' $SSHLOGONNAME\@$FQDN \"if [ -d /opt/monitoring/asnmtap/plugins/ ]; then cd /opt/monitoring/asnmtap/plugins/...
if ( 1 == 1 ) {
@capture_array = `$capture_exec`;
} else {
my ($stdout, $stderr, $exit_value, $signal_num, $dumped_core);
if ($CAPTUREOUTPUT) {
use IO::CaptureOutput qw(capture_exec);
($stdout, $stderr) = capture_exec("$capture_exec");
} else {
applications/htmlroot/overlib.js view on Meta::CPAN
//\mini
////////
// PRE-INIT
// Ignore these lines, configuration is below.
////////
var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.21', 1);
var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3; var FCHAIN=4;
var olHideForm=0; // parameter for hiding SELECT and ActiveX elements in IE5.5+
var olHautoFlag = 0; // flags for over-riding VAUTO and HAUTO if corresponding
var olVautoFlag = 0; // positioning commands are used on the command line
var hookPts = new Array(), postParse = new Array(), cmdLine = new Array(), runTime = new Array();
// for plugins
registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy...
////////
// DEFAULT CONFIGURATION
// Settings you want everywhere are set here. All of this can also be
// changed on your html page or through an overLIB call.
////////
if (typeof ol_fgcolor=='undefined') var ol_fgcolor="#CCCCFF";
applications/htmlroot/overlib.js view on Meta::CPAN
}
capExtent.onmousemove = mseHandler;
if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE);
}
////////
// PARSING FUNCTIONS
////////
// Does the actual command parsing.
function parseTokens(pf, ar) {
// What the next argument is expected to be.
var v, i, mode=-1, par = (pf != 'ol_');
var fnMark = (par && !ar.length ? 1 : 0);
for (i = 0; i < ar.length; i++) {
if (mode < 0) {
// Arg is maintext,unless its a number between pmStart and pmUpper
// then its a command.
if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) {
fnMark = (par ? 1 : 0);
i--; // backup one so that the next block can parse it
} else {
switch(pf) {
case 'ol_':
ol_text = ar[i].toString();
break;
default:
o3_text=ar[i].toString();
applications/htmlroot/overlib.js view on Meta::CPAN
over.captureEvents(Event.MOUSEOUT || Event.MOUSEOVER);
over.onmouseover = function () { if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid = 0; } }
over.onmouseout = function (e) { if (olHideDelay) hideDelay(olHideDelay); else cClick(e); }
} else {
over.onmouseover = function () {hoveringSwitch = true; if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid =0; } }
}
return 0;
}
// Function to scan command line arguments for multiples
function opt_MULTIPLEARGS(i, args, parameter) {
var k=i, re, pV, str='';
for(k=i; k<args.length; k++) {
if(typeof args[k] == 'number' && args[k]>pmStart) break;
str += args[k] + ',';
}
if (str) str = str.substring(0,--str.length);
k--; // reduce by one so the for loop this is in works correctly
applications/htmlroot/overlib.js view on Meta::CPAN
// Runs plugin functions to set runtime variables.
function setRunTimeVariables(){
if (typeof runTime != 'undefined' && runTime.length) {
for (var k = 0; k < runTime.length; k++) {
runTime[k]();
}
}
}
// Runs plugin functions to parse commands.
function parseCmdLine(pf, i, args) {
if (typeof cmdLine != 'undefined' && cmdLine.length) {
for (var k = 0; k < cmdLine.length; k++) {
var j = cmdLine[k](pf, i, args);
if (j >- 1) {
i = j;
break;
}
}
}
applications/htmlroot/overlib.js view on Meta::CPAN
}
}
return true;
}
////////
// PLUGIN REGISTRATION FUNCTIONS
////////
// Registers commands and creates constants.
function registerCommands(cmdStr) {
if (typeof cmdStr!='string') return;
var pM = cmdStr.split(',');
pms = pms.concat(pM);
for (var i = 0; i< pM.length; i++) {
eval(pM[i].toUpperCase()+'='+pmCount++);
}
}
// Registers no-parameter commands
function registerNoParameterCommands(cmdStr) {
if (!cmdStr && typeof cmdStr != 'string') return;
pmt=(!pmt) ? cmdStr : pmt + ',' + cmdStr;
}
// Register a function to hook at a certain point.
function registerHook(fnHookTo, fnRef, hookType, optPm) {
var hookPt, last = typeof optPm;
if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return;
applications/htmlroot/overlib.js view on Meta::CPAN
function registerRunTimeFunction(fn) {
if (isFunction(fn)) {
if (typeof fn == 'object') {
runTime = runTime.concat(fn);
} else {
runTime[runTime.length++] = fn;
}
}
}
// Register a function that will handle command parsing.
function registerCmdLineFunction(fn){
if (isFunction(fn)) {
if (typeof fn == 'object') {
cmdLine = cmdLine.concat(fn);
} else {
cmdLine[cmdLine.length++] = fn;
}
}
}
// Register a function that does things after command parsing.
function registerPostParseFunction(fn){
if (isFunction(fn)) {
if (typeof fn == 'object') {
postParse = postParse.concat(fn);
} else {
postParse[postParse.length++] = fn;
}
}
}
applications/htmlroot/overlib_anchor.js view on Meta::CPAN
////////
function setAnchorVariables() {
o3_anchor = ol_anchor;
o3_anchorx = ol_anchorx;
o3_anchory = ol_anchory;
o3_noanchorwarn = ol_noanchorwarn;
o3_anchoralign = ol_anchoralign;
mrkObj = null; // initialize this variable
}
// Parses Reference Mark commands
function parseAnchorExtras(pf,i,ar) {
var v, k=i;
if (k < ar.length) {
if (ar[k] == ANCHOR) { eval(pf + "anchor = '" + escSglQuote(ar[++k]) + "'"); return k; }
if (ar[k] == ANCHORX) { eval(pf + 'anchorx = ' + ar[++k]); return k; }
if (ar[k] == ANCHORY) { eval(pf + 'anchory = ' + ar[++k]); return k; }
if (ar[k] == NOANCHORWARN) { eval(pf + 'noanchorwarn = (' + pf + 'noanchorwarn==1) ? 0 : 1'); return k; }
if (ar[k] == ANCHORALIGN) { k = opt_MULTIPLEARGS(++k, ar, (pf + 'anchoralign')); return k; }
}
applications/htmlroot/overlib_centerpopup.js view on Meta::CPAN
// Runtime variables init. Don't change for config!
var o3_centerpopup = 0;
var o3_centeroffset = '0';
////////
// PLUGIN FUNCTIONS
////////
function setCenterPopupVariables() {
o3_centerpopup = ol_centerpopup;
o3_centeroffset = ol_centeroffset;
}
// Parses Shadow and Scroll commands
function parseCenterPopupExtras(pf,i,ar) {
var k = i,v;
if (k < ar.length) {
if (ar[k] == CENTERPOPUP) { eval(pf + 'centerpopup = (' + pf + 'centerpopup == 0) ? 1 : 0'); return k; }
if (ar[k] == CENTEROFFSET) { k = opt_MULTIPLEARGS(++k,ar,(pf + 'centeroffset')); return k; }
}
return -1;
}
applications/htmlroot/overlib_crossframe.js view on Meta::CPAN
////////
if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.10)) alert('overLIB 4.10 or later is required for the Cross Frame Support Plugin.');
else {
registerCommands('frame');
////////
// PLUGIN FUNCTIONS
///////
// Parses FRAME command
function parseFrameExtras(pf,i,ar) {
var k = i,v;
if (k < ar.length) {
if (ar[k] == FRAME) { v = ar[++k]; if(pf == 'ol_') ol_frame = v; else opt_FRAME(v); return k; }
}
return -1;
}
applications/htmlroot/overlib_cssstyle.js view on Meta::CPAN
o3_captionsizeunit=ol_captionsizeunit;
o3_captiondecoration=ol_captiondecoration;
o3_captionstyle=ol_captionstyle;
o3_captionweight=ol_captionweight;
o3_closesizeunit=ol_closesizeunit;
o3_closedecoration=ol_closedecoration;
o3_closestyle=ol_closestyle;
o3_closeweight=ol_closeweight;
}
// Parses CSS Style commands.
function parseCSSStyleExtras(pf, i, ar) {
var k = i;
if (k < ar.length) {
if (ar[k]==CSSSTYLE) { eval(pf+'css='+ar[k]); return k; }
if (ar[k]==PADUNIT) { eval(pf+'padunit="'+ar[++k]+'"'); return k; }
if (ar[k]==HEIGHTUNIT) { eval(pf+'heightunit="'+ar[++k]+'"'); return k; }
if (ar[k]==WIDTHUNIT) { eval(pf+'widthunit="'+ar[++k]+'"'); return k; }
if (ar[k]==TEXTSIZEUNIT) { eval(pf+'textsizeunit="'+ar[++k]+'"'); return k; }
if (ar[k]==TEXTDECORATION) { eval(pf+'textdecoration="'+ar[++k]+'"'); return k; }
applications/htmlroot/overlib_followscroll.js view on Meta::CPAN
////////
// PLUGIN FUNCTIONS
////////
function setScrollVariables() {
o3_followscroll=ol_followscroll;
o3_followscrollrefresh=ol_followscrollrefresh;
}
// Parses Shadow and Scroll commands
function parseScrollExtras(pf,i,ar) {
var k=i,v;
if (k < ar.length) {
if (ar[k]==FOLLOWSCROLL) { eval(pf +'followscroll=('+pf+'followscroll==0) ? 1 : 0'); return k; }
if (ar[k]==FOLLOWSCROLLREFRESH) { eval(pf+'followscrollrefresh='+ar[++k]); return k; }
}
return -1;
}
applications/htmlroot/overlib_setonoff.js view on Meta::CPAN
// HELPER FUNCTIONS
///////
// searches arg list for COMMAND;
function hasCommand(istrt, args, COMMAND) {
for (var i = istrt; i < args.length; i++) {
if (typeof args[i] == 'number' && args[i] == COMMAND) return i;
}
return -1;
}
// scans for toggle like commands to be forced ON/OFF
function scanCommandSet(pf, args) {
var k = -1, j, je;
if (olSetType) {
// search for SETON command
while ((k = hasCommand(++k, args, SETON)) < args.length && k > -1) {
je = opt_MULTICOMMANDS(k + 1, args);
for (j = k + 1; j < (k + je); j++) setNoParamCommand(1, pf, args[j]);
k += (je - 1);
}
// search for SETOFF command
k = -1;
while ((k = hasCommand(++k, args, SETOFF)) < args.length && k > -1) {
je = opt_MULTICOMMANDS(k + 1, args);
for (j = k + 1; j < (k + je); j++) setNoParamCommand(0, pf, args[j]);
k += (je - 1);
}
}
return true;
}
var olRe;
// set command according to whichType (0 or 1)
function setNoParamCommand(whichType, pf, COMMAND) {
var v = pms[COMMAND - 1 - pmStart];
if(pmt && !olRe) olRe = eval('/' + pmt.split(',').join('|') + '/');
if (pf != 'ol_' && /capturefirst/.test(v)) return; // no o3_capturefirst variable
if (pf != 'ol_' && /wrap/.test(v) && eval(pf + 'wrap') && (whichType == 0)) {
nbspCleanup(); // undo wrap effects since checked after all parsing
o3_width = ol_width;
}
applications/htmlroot/overlib_shadow.js view on Meta::CPAN
function setShadowVariables() {
o3_shadow=ol_shadow;
o3_shadowcolor=ol_shadowcolor;
o3_shadowimage=ol_shadowimage;
o3_shadowopacity=ol_shadowopacity;
o3_shadowx=ol_shadowx;
o3_shadowy=ol_shadowy;
}
// Parses shadow commands
function parseShadowExtras(pf,i,ar) {
var k = i, v;
if (k < ar.length) {
if (ar[k]==SHADOW) { eval(pf +'shadow=('+pf+'shadow==0) ? 1 : 0'); return k; }
if (ar[k]==SHADOWCOLOR) { eval(pf+'shadowcolor="'+ar[++k]+'"'); return k; }
if (ar[k]==SHADOWOPACITY) {v=ar[++k]; eval(pf+'shadowopacity='+(olOp ? 0 : v)); return k; }
if (ar[k]==SHADOWIMAGE) { eval(pf+'shadowimage="'+ar[++k]+'"'); return k; }
if (ar[k]==SHADOWX) { eval(pf+'shadowx='+ar[++k]); return k; }
if (ar[k]==SHADOWY) { eval(pf+'shadowy='+ar[++k]); return k; }
applications/htmlroot/snmptraps/etc/config.ini.php view on Meta::CPAN
;#########################################################
[global]
;# Select here a language (EN = English / DE = German)
language = EN
;# When you will use a authentification, then enable this option (0=off / 1=on)
useAuthentification = 1
;# If you use the authentification, then entry here the User that
;# may changes on the Web-Frontend comma seperated.
allowedUser = ape,yvdh,snmptt
;# If you use the authentification, then entry here the User that may 'mark as read'
;# or 'Delete this trap' on the Web-Frontend comma seperated.
allowedAction = ape,yvdh
;# Ignore this option, when you don`t use a table for archiving the Traps and/or
;# unknown-Traps in your database
tableArchive = _archive
;# When you use a database for unknown-Traps, then enable this option (0=off / 1=on)
;# If you enable this option, then you musst have a table in your database for unknown
;# traps.
useUnknownTraps = 1