ASNMTAP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

                                 - 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
                               - UPDATE /applications/tools/mysql/asnmtap-3.002.001-database-schema.png
                               - UPDATE create_ASNMTAP_jUnit_configuration_for_jUnit.pl

Changes  view on Meta::CPAN

                                 - ALTER TABLE `eventsChangesLogData` ADD COLUMN `posTimeslot` INT(11) NOT NULL default '9' AFTER prevTimeslot;
                               - NEW TABLE `eventsDisplayData` for MySQL'
                                 - CREATE TABLE `eventsDisplayData` (
                                 -   `catalogID` varchar(5) NOT NULL default 'CID',
                                 -   `posTimeslot` int(11) NOT NULL DEFAULT '0',
                                 -   `uKey` varchar(11) NOT NULL default '',
                                 -   `replicationStatus` ENUM('I','U','R') NOT NULL DEFAULT 'I',
                                 -   `test` varchar(512) NOT NULL default '',
                                 -   `title` varchar(75) NOT NULL default '',
                                 -   `status` varchar(9) NOT NULL default '',
                                 -   `startDate` date NOT NULL default '0000-00-00',
                                 -   `startTime` time NOT NULL default '00:00:00',
                                 -   `endDate` date NOT NULL default '0000-00-00',
                                 -   `endTime` time NOT NULL default '00:00:00',
                                 -   `duration` time NOT NULL default '00:00:00',
                                 -   `statusMessage` varchar(1024) NOT NULL default '',
                                 -   `step` smallint(6) NOT NULL default '0',
                                 -   `timeslot` varchar(10) NOT NULL default '',
                                 -   `instability` tinyint(1) NOT NULL default '9',
                                 -   `persistent` tinyint(1) NOT NULL default '9',
                                 -   `downtime` tinyint(1) NOT NULL default '9',
                                 -   `filename` varchar(254) default '',

Changes  view on Meta::CPAN

                               - ADD show comments
                               - ADD short description
                               - FIX Use of uninitialized value in concatenation (.) or string at line 333
                               /moderator/collectorDaemonSchedulingReports.pl
                               - FIX Use of uninitialized value in split at line 79.
                               /moderator/plugins.pl
                               - NEW Plugins (to edit short description, trendline, holiday bundle and uploading plugindoc)
                               /moderator/trendlineCorrectionReports.pl
                               - FIX Use of uninitialized value in split at line 93.
                               - FIX Possible precedence problem on bitwise & operator at line 117.
                               - FIX switch startdate with enddate
                               /admin/reports.pl
                               - ADD show comments
                               - NEW Select 'Reports Perfdata'
                               /admin/reports_perfdata.pl
                               - NEW Reports Perfdata (to define the 'Performance Times' that are used by the automatically generated Reports)
                               /sadmin/crontabs.pl
                               - FIX 'select SQL_NO_CACHE count(id) from crontabs' with 'select SQL_NO_CACHE count(lineNumber) from crontabs'
                               /sadmin/plugins.pl
                               - ADD short desription
                               - FIX $notActivated = ($Cactivated) ? '' : ' not'; with $notActivated = ($CTactivated) ? '' : ' not';

Changes  view on Meta::CPAN

                               - NEW table `environment`
                               - add `userPassword` varchar(15) NOT NULL default '' at table reports
                               - remove `reportTitle` varchar(100) NOT NULL default '' from table reports
                               - add `downtimeScheduling` tinyint(1) NOT NULL default '1' and `generatedReports` tinyint(1) NOT NULL default '0' at table users
                               FIX Popup Calendar
                               - replace document.forms[0].endDate with document.forms[1].endDate
                               collector.pl
                               - add automatically the environment at the end off the title
                               collector.pl & display.pl
                               - update atime and mtime from the PID file every timeslot
                               - email message for started, stopped & reloaded
                               collectorCrontabSchedulingReports.pl & collectorDaemonSchedulingReports.pl
                               - show only the Plugins regarding correspondending server
                               comments.pl & holidayBundleSetDowntimes.pl
                               - Sending email for: Downtime Scheduling
                               detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl
                               - Problem details: link to the correspondending 'Debug Report' when 'Format Output' equals 'HTML'
                               detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl, generateChart.pl & trendlineCorrectionReports.pl
                               - replace round(avg(duration), 2) with round(avg(time_to_sec(duration)), 2) because of wrong averages
                               display.pl
                               - possibility for sound on/off

Changes  view on Meta::CPAN

might arise from it's use.

Selling the code for this program without prior written consent is expressly 
forbidden. In other words, please ask first before you try and make money off 
of my program.

Obtain permission before redistributing this software over the Internet or
in any other medium. In all cases copyright and header must remain intact.


Version 3.000.002, 2006/01/08, we actually started a total rewrite into Object Oriented Perl: ASNMTAP Package Object Oriented Perl

package ASNMTAP::Asnmtap
package ASNMTAP::Asnmtap::Time

package ASNMTAP::Asnmtap::Plugins
package ASNMTAP::Asnmtap::Plugins::Mail
package ASNMTAP::Asnmtap::Plugins::Modem
package ASNMTAP::Asnmtap::Plugins::Nagios
package ASNMTAP::Asnmtap::Plugins::SOAP
package ASNMTAP::Asnmtap::Plugins::WebTransact
package ASNMTAP::Asnmtap::Plugins::XML

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Version 3.000.001, 2006/01/01, we actually started a total rewrite of v2.002.000: ASNMTAP Package

package ASNMTAP::Asnmtap
package ASNMTAP::Asnmtap::Time

package ASNMTAP::Asnmtap::Applications
package ASNMTAP::Asnmtap::Applications::CGI
package ASNMTAP::Asnmtap::Applications::Display
package ASNMTAP::Asnmtap::Applications::Collector

package ASNMTAP::Asnmtap::Plugins

INSTALL  view on Meta::CPAN


    <Directory "/opt/asnmtap/applications/htmlroot/cgi-bin">
      AllowOverride AuthConfig
      Options ExecCGI
      Order allow,deny
      Allow from all
    </Directory>
  </VirtualHost>


  restart your web server


  Install MySQL client need to be installed
  -----------------------------------------

  MySQL version 4.x
    mysql -u root -p  < /opt/asnmtap/applications/tools/mysql/asnmtap-3.002.003.sql
   or
    mysql -u root -p  < /opt/asnmtap/applications/tools/mysql/asnmtap-3.002.003-distributed.sql

MANIFEST  view on Meta::CPAN

Changes												History of this package
README												Get you started with this package
MANIFEST											This file
MANIFEST.SKIP										MANIFEST.SKIP file
AUTHORS                                             Authors File
INSTALL                                             Installation DOC
META.yml                                            Module meta-data (added by MakeMaker)
Makefile.PL											Makefile generator
Asnmtap.cnf                                         General config file for ASNMTAP
fixRights.sh                                        Fix Rights
autoinstall.sh										Auto Install

MANIFEST  view on Meta::CPAN

applications/htmlroot/img/awstats.gif
applications/htmlroot/img/blue.gif
applications/htmlroot/img/blue-ack.gif
applications/htmlroot/img/blue-unstable.gif
applications/htmlroot/img/cal.gif
applications/htmlroot/img/clear.gif
applications/htmlroot/img/clear-ack.gif
applications/htmlroot/img/clear-unstable.gif
applications/htmlroot/img/cupido.gif
applications/htmlroot/img/daemonReload.gif
applications/htmlroot/img/daemonRestart.gif
applications/htmlroot/img/daemonStart.gif
applications/htmlroot/img/daemonStop.gif
applications/htmlroot/img/data.gif
applications/htmlroot/img/down.gif
applications/htmlroot/img/exclaim.gif
applications/htmlroot/img/fw0/0.gif
applications/htmlroot/img/fw0/1.gif
applications/htmlroot/img/fw0/2.gif
applications/htmlroot/img/fw0/3.gif
applications/htmlroot/img/fw0/4.gif

MANIFEST  view on Meta::CPAN

applications/htmlroot/img/red.gif
applications/htmlroot/img/red-ack.gif
applications/htmlroot/img/red-unstable.gif
applications/htmlroot/img/report.gif
applications/htmlroot/img/running.gif
applications/htmlroot/img/spacer.gif
applications/htmlroot/img/snowflake-1.gif
applications/htmlroot/img/snowflake-2.gif
applications/htmlroot/img/snowflake-3.gif
applications/htmlroot/img/snowflake-4.gif
applications/htmlroot/img/start.gif
applications/htmlroot/img/startRefresh.gif
applications/htmlroot/img/stop.gif
applications/htmlroot/img/stopRefresh.gif
applications/htmlroot/img/toggle.gif
applications/htmlroot/img/up.gif
applications/htmlroot/img/yellow.gif
applications/htmlroot/img/yellow-ack.gif
applications/htmlroot/img/yellow-unstable.gif

applications/htmlroot/pdf/ApplicationMonitorVersion2.000.xxx.pdf
applications/htmlroot/pdf/CheckDummy.pdf

README  view on Meta::CPAN

         Disk Filesystem monitoring (DF, sysdDF),
         Intrusion Detection for FW-1 (ID, sysdID)
         Process System daemons (PS, sysdPS),
         Reachability of Remote Hosts on a network (RH, sysdRH),
         Rotate Logfiles (system activity files) (RL),
         Remote Socket monitoring (RS, sysdRS),
         System Activity monitoring (SA, sysdSA).

         sysdCT : (1.60.1.13) <minute (0-59)> <hour (0-23)> <day of the month (1-31)> <month of the year (1-12)> <day of the week (0-6 with 0=Sunday)> DF|ID|PS|RH|RL|RS|SA

         sysdDF : (1.60.1.2)  filesystem:percent:[optional stop action]:[optional start action]:support team email

         sysdID : (1.60.1.14) ... preparations ...

         sysdPS : (1.60.1.1)  process:comment:[optional stop action]:[optional start action]:support team email

         sysdRH : (1.60.1.9)  hostname:ip-adres:gateway:[protocol]:[timeout]:[bytes]:[optional stop action]:[optional start action]:support team email
                                                       icmp|tcp|udp   >= 0   <= 1024
         sysdRS : (1.60.1.15) protocol:ip-adres:port:service:[request]:[timeout]:[status]:[optional stop action]:[optional start action]:support team email
                               tcp|udp                                    >= 0
         sysdSA : (1.60.1.11) process:activity:comment:priority:facility:logfile:[optional stop action]:[optional start action]:support team email

         2002/03/02 - 2003/03/01, from v1.60.16.x until v1.60.17-01

         2002/01/03 - 2002/02/26, from v1.60.14.x until v1.60.15.x

         2001/12/26 - 2002/01/02, from v1.60.13.x until v1.60.14.x

         2000/10/19 - 2001/12/24, from v1.60.1.x until v1.60.13.x

'Process System daemons' is based on 'sysdaemon 1.60' written by Trans-Euro I.T Ltd

applications/Applications.cnf  view on Meta::CPAN

#    first           2arrowLeft.gif
#    last            2arrowRight.gif
#  </RECORD>

#  <SYSTEM>
#    pidKill         pidKill.gif
#    pidRemove       pidRemove.gif
#    daemonReload    daemonReload.gif
#    daemonStart     daemonStart.gif
#    daemonStop      daemonStop.gif
#    daemonRestart   daemonRestart.gif
#  </SYSTEM>
#</ICONS>

#<SOUND>
#    0               attention.wav
#    1               warning.wav
#    2               critical.wav
#    3               unknown.wav
#    4               attention.wav
#    5               attention.wav

applications/archive.pl  view on Meta::CPAN

  $dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = errorTrapDBI("Cannot connect to the database", $debug); 

  if ($dbh and $rv) {
    $year  = get_year  ($eventsAgo);
    $month = get_month ($eventsAgo);
    $day   = get_day   ($eventsAgo);

    $timeslot = timelocal ( 0, 0, 0, $day, ($month-1), ($year-1900) );

    if ($debug) {
      $sql = "select SQL_NO_CACHE catalogID, id, endDate, startDate, timeslot, uKey from $SERVERTABLEVENTS force index (key_timeslot) where timeslot < '" .$timeslot. "'";
      print "\nTable: '$SERVERTABLEVENTS', Year: '$year', Month: '$month', Day: '$day', Timeslot: '$timeslot', Date: " .scalar(localtime($timeslot)). "\n<$sql>\n";
    } else {
      $sql = "select SQL_NO_CACHE catalogID, id, endDate from $SERVERTABLEVENTS force index (key_timeslot) where timeslot < '" .$timeslot. "'";
      print EMAILREPORT "\nTable: '$SERVERTABLEVENTS', Year: '$year', Month: '$month', Day: '$day', Timeslot: '$timeslot'\n";
    }

    $sth = $dbh->prepare($sql) or $rv = errorTrapDBI("dbh->prepare: $sql", $debug);
    $rv  = $sth->execute() or $rv = errorTrapDBI("sth->execute: $sql", $debug) if $rv;

    if ( $rv ) {
      while (my $ref = $sth->fetchrow_hashref()) {
        ($yearMOVE, $monthMOVE, undef) = split (/-/, $ref->{endDate});

        print "\n", $ref->{catalogID}, " ", $ref->{id}, " ", $ref->{uKey}, " ", $ref->{startDate}, " ", $ref->{endDate}, " ",$ref->{timeslot}, " \n" if ($debug);

        $sqlMOVE = 'REPLACE INTO `' .$SERVERTABLEVENTS. '_' .$yearMOVE. '_' .$monthMOVE. '` SELECT * FROM `' .$SERVERTABLEVENTS. '` WHERE catalogID = "' .$ref->{catalogID}. '" and id = "' .$ref->{id}. '"';

        if ( $yearMOVE ne '0000' and  $monthMOVE ne '00' ) {
          print "$sqlMOVE\n" if ($debug);
          $dbh->do( $sqlMOVE ) or $rv = errorTrapDBI("Cannot dbh->do: $sql", $debug) unless ( $debug );

          if ( $rv ) {
            $sqlMOVE = 'DELETE FROM `' .$SERVERTABLEVENTS. '` WHERE catalogID = "' .$ref->{catalogID}. '" and id = "' .$ref->{id}. '"';
            print "$sqlMOVE\n" if ($debug);

applications/bin/asnmtap-importDataThroughCatalog.sh  view on Meta::CPAN

#!/bin/bash
# ---------------------------------------------------------------
# © Copyright 2009-2011 Alex Peeters [alex.peeters@citap.be]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping

PATH_ASNMTAP=/opt/asnmtap

if [ "$ASNMTAP_PATH" ]; then
  PATH_ASNMTAP=$ASNMTAP_PATH
fi

AMNAME="Import Data Through Catalog ASNMTAP importDataThroughCatalog"
AMPATH=$PATH_ASNMTAP/applications
AMCMD=importDataThroughCatalog.pl

applications/bin/asnmtap-importDataThroughCatalog.sh  view on Meta::CPAN

if [ -f "$AMPATH/sbin/bash_stop_root.sh" ]; then
  source "$AMPATH/sbin/bash_stop_root.sh"
fi

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

[ -f $AMPATH/bin/$AMCMD ] || exit 0

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

start() {
  echo "Start: 'All ASNMTAP Import Data Through Catalog' ..."

  # Start daemons
  if [ -f $PIDPATH/$PIDNAME ]
  then
    echo "'$AMNAME' already running, otherwise remove '$PIDNAME'"
  else
    echo "Start: '$AMNAME' ..."
    cd $AMPATH/bin
    PATH=$PATH MANPATH=$MANPATH PERL5LIB=$PERL5LIB LD_LIBRARY_PATH=$LD_LIBRARY_PATH ./$AMCMD $AMPARA &

applications/bin/asnmtap-importDataThroughCatalog.sh  view on Meta::CPAN

    kill -QUIT `cat $PIDPATH/$PIDNAME`

    sleep 1
  else
    echo "'$AMNAME' already stopped"
  fi
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

restart() {
  echo "Restart: 'All ASNMTAP Import Data Through Catalog' ..."

  while [ -f $PIDPATH/$PIDNAME ]
  do
    stop
  done

  start
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

reload() {
  echo "Reload: 'All ASNMTAP Import Data Through Catalog' ..."

  echo "Reload: '$AMNAME' ..."
  kill -HUP `cat $PIDPATH/$PIDNAME`
}

applications/bin/asnmtap-importDataThroughCatalog.sh  view on Meta::CPAN

    ps -ef | grep `cat $PIDPATH/$PIDNAME`
  else
    echo "Status: '$AMNAME' is not running"
  fi
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# See how we were called.
case "$1" in
  start)
           start
           ;;
  stop)
           stop
           ;;
  restart)
           restart
           ;;
  reload)
           reload
           ;;
  status)
           status
           ;;
  *)
           echo "Usage: '$AMNAME' {start|stop|restart|reload|status}"
           exit 1
esac

exit 0

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

applications/bin/generateReports.pl  view on Meta::CPAN

my @arrayDays   = ('<NIHIL>', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
my @arrayMonths = ('<NIHIL>', 'January', 'Februari', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

for (my $dayAfter = ( $daysAfter ) ? 1 : 0; $dayAfter <= $daysAfter; $dayAfter++) {
  my ($urlAccessParametersDay, $urlAccessParametersWeek, $urlAccessParametersMonth, $urlAccessParametersQuarter, $urlAccessParametersYear);
  my $emailMessage = "\n";

  # Yesterday - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  my ($dayReportYear, $dayReportMonth, $dayReportDay) = Add_Delta_Days ( $currentYear, $currentMonth, $currentDay, -$dayAfter );
  $emailMessage .= "Report Daily     : for day $dayReportDay from the month $dayReportMonth into the year $dayReportYear\n";
  $urlAccessParametersDay = "inputType=fromto&startDate=$dayReportYear-$dayReportMonth-$dayReportDay&endDate=";
  my $dayReportDayOfWeek = Day_of_Week ($dayReportYear, $dayReportMonth, $dayReportDay);

  # Last day of the week  - - - - - - - - - - - - - - - - - - - - - - - -
  my $weekReportWeek = 0;

  if ($dayReportDayOfWeek == 7) {
    my $weekReportYear;
    ($weekReportWeek, $weekReportYear) = Week_of_Year( $dayReportYear, $dayReportMonth, $dayReportDay ); 
    $emailMessage .= "Report Weekly    : for week $weekReportWeek into the year $weekReportYear\n";
    $urlAccessParametersWeek = "inputType=week&year=$weekReportYear&week=$weekReportWeek";

applications/collector-test.pl  view on Meta::CPAN

              }
            }

            $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 {

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

  # printDebugAll ("kill -WARN <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");

  if ( $CHILD_OFF or $! =~ /\QASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = \E(\d*)\Q\n\E/ or $@ =~ /\QASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = \E(\d*)\Q\n\E/ ) {
    my $alarm = ( ( defined $CHILD_OFF and $CHILD_OFF ) ? $CHILD_OFF : $1 );

    if ( defined $alarm ) {
      use Proc::ProcessTable;
      my $t = new Proc::ProcessTable;

      foreach my $process ( @{$t->table} ) {
        if ( $process->ppid == $$ and ( timelocal( (localtime)[0,1,2,3,4,5] ) - $process->start ) >= $alarm ) {
          $process->kill(9);
          $boolean_signal_kill = 1;
          printDebugAll ("kill -9 <$PROGNAME v$version -C $collectorlist> pid: <". $process->pid ."> ppid: <$$>");
        }
      }
    }
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

applications/collector-test.pl  view on Meta::CPAN

  my ($asnmtapEnv, $currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $resultsdir, $title, $system_action, $status, $interval, $instability, $persistent, $downtime, $debug, $dbiFilename, $logging, $httpdump, $dumphttp, $queryMySQL) = @_;

  my $rvOpen;
  my $action = '';
  my $httpdumpFilename    = '';
  my $httpdumpFilenameTmp = '';
  my $debugFilename       = '<NIHIL>';
  my $dumphttpRename      = '<NIHIL>';
  my ($stdout, $stderr, $exit_value, $signal_num, $dumped_core);

  my ($loggedStatus, $returnStatus, $startDate, $startTime, $endDate, $endTime, $msgCommand);
  $startDate = get_csvfiledate();
  $startTime = get_csvfiletime();
  ($msgCommand, undef) = split(/\.pl/, $system_action);

  if ($dumphttp ne 'N') {
    $httpdumpFilename = $httpdump . get_datetime() .'-'. $msgCommand .'-'. $catalogID_uniqueKey;
    $httpdumpFilenameTmp = $httpdumpFilename .'.tmp';
  }

  $boolean_signal_kill = 0;

  if (-e "$PLUGINPATH/$msgCommand.pl") {

applications/collector-test.pl  view on Meta::CPAN


  my ($duration) = $returnStatus =~ m/Trendline=([0-9.]+)s;[0-9.]+;;;$/i;

  if (defined $duration) {
    my ($thour, $tmin, $tsec);
    $thour = int ($duration / 3600);
    $tmin  = int (int ($duration % 3600) / 60);
    $tsec  = int ($duration % 60);
    $duration = sprintf("%02d:%02d:%02d", $thour, $tmin, $tsec);
  } else {
    my ($tyear, $tmonth, $tday, $thour, $tmin, $tsec, @startDateTime, @endDateTime, @diffDateTime);

    ($tyear, $tmonth, $tday) = split(/\//, $startDate);
    ($thour, $tmin, $tsec)   = split(/\:/, $startTime);
    @startDateTime = ($tyear, $tmonth, $tday, $thour, $tmin, $tsec);

    ($tyear, $tmonth, $tday) = split(/\//, $endDate);
    ($thour, $tmin, $tsec)   = split(/\:/, $endTime);
    @endDateTime = ($tyear, $tmonth, $tday, $thour, $tmin, $tsec);

    @diffDateTime = Delta_DHMS(@startDateTime, @endDateTime);
    $duration = sprintf("%02d:%02d:%02d", $diffDateTime[1], $diffDateTime[2], $diffDateTime[3]);
  }

# my ($outputData, $performanceData) = split(/\|/, $returnStatus, 2);
  my $_returnStatus = reverse $returnStatus;
  my ($_outputData, $_performanceData) = reverse split(/\|/, $_returnStatus, 2);
  my $outputData = reverse $_outputData;
  my $performanceData = reverse $_performanceData;

  $rvOpen = open(CSV,">>$logging-$msgCommand-$catalogID_uniqueKey-csv.txt");

  if ($rvOpen) {
    print CSV '"', $catalogID, '","","', $uniqueKey, '","I","', $system_action, '","', $title, '","', $dumphttpRename, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","', $duration, '","', $outputData, '","', $performanceDa...
    close(CSV);
  } else {
    print "Cannot open $logging-$msgCommand-$catalogID_uniqueKey-csv.txt to print debug information\n";
  }

  if ( $boolean_perfParseInstalled ) {
    if (defined $performanceData) {
      my $perfParseTimeslot = get_timeslot ($currentDate);

      my $perfParseCommand;

applications/collector-test.pl  view on Meta::CPAN

        system ("$perfParseCommand"); $stdout = $stderr = '';
      }

      $exit_value  = $? >> 8;
      $signal_num  = $? & 127;
      $dumped_core = $? & 128;
      printDebugNOK ("    perfParse ----- : $perfParseCommand: <$exit_value><$signal_num><$dumped_core><$stderr>") unless ( $exit_value == 0 && $signal_num == 0 && $dumped_core == 0 && $stderr eq '' );
    }
  }

  insertEntryDBI ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $dbiFilename.$msgCommand.'-'.$catalogID_uniqueKey.'-sql', $system_action, $interval, $dumphttpRename, $logging, $debug, $startDate, $startTime, $endDate, $endTime, ...
  return $action;
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub printDebugAll {
  my ($l_text) = @_;

  if ($boolean_screenDebug or $boolean_debug_all) {
    chomp ($l_text);

applications/collector-test.pl  view on Meta::CPAN

      close(NOKDEBUG);
    } else {
      print "Cannot open $tlogging-nok.txt to print debug information\n";
    }
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub insertEntryDBI {
  my ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $dbiFilename, $test, $interval, $status, $logging, $debug, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $filename, $insertMySQL, $queryMySQ...

  return ( 1 ) unless ( $insertMySQL );

  my ($sth, $lockString, $findString, $updateString, $insertString, $flushString, $unlockString, $insertEntryDBI, $updateEntryDBI);
  $insertEntryDBI = 0;
  $updateEntryDBI = 0;
  my ($dbh, $rv, $alarmMessage) = DBI_connect ( $DATABASE, $serverName, $SERVERPORTREADWRITE, $SERVERUSERREADWRITE, $SERVERPASSREADWRITE, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $st...

  if ($dbh and $rv) {
    if ($queryMySQL) {
      my $numbersEntryDBI = 0;
      $findString = 'select SQL_NO_CACHE status from '.$SERVERTABLEVENTS.' where catalogID = "' .$catalogID. '" and uKey = "' .$uniqueKey. '" and step <> "0" and timeslot = "' . get_timeslot ($currentDate) . '" order by id desc';
      printDebugAll ("query Entry DBI: <$findString>") if ($debug eq 'T');
      $sth = $dbh->prepare($findString) or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instabilit...
      ($rv, undef) = DBI_execute ($rv, \$sth, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $i...

      if ($rv) {
  	    while (my $ref = $sth->fetchrow_hashref()) {
	      $numbersEntryDBI++;
          if ( $ref->{status} eq '<NIHIL>' or $ref->{status} eq 'OFFLINE' or $ref->{status} eq 'NO TEST' ) { $updateEntryDBI = 1; }
        }

        $insertEntryDBI = 1 unless ( $numbersEntryDBI );
        printDebugAll ("query Entry DBI: # <$numbersEntryDBI> insert <$insertEntryDBI> change <$updateEntryDBI>") if ($debug eq 'T');
      }

      $sth->finish() or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $do...
    } else {
      $insertEntryDBI = 1;
    }
  } else {
    $logger->info("     DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage") if ( defined $logger and $logger->is_info() );
  }

  if ($insertEntryDBI or $updateEntryDBI) {
    if ($lockMySQL) {
      if ($dbh and $rv) {
        $lockString = 'LOCK TABLES ' .$SERVERTABLEVENTS. ' WRITE, ' .$SERVERTABLEVENTSCHNGSLGDT. ' WRITE';
        ($rv, undef, undef) = DBI_do ($rv, \$dbh, $lockString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfda...
      }
    }

    if ($dbh and $rv) {
      $statusMessage =~ s/"/'/g;

      if ($updateEntryDBI) {
        $updateString = 'UPDATE ' .$SERVERTABLEVENTS. ' SET catalogID="' .$catalogID. '", uKey="' .$uniqueKey. '", replicationStatus="U", test="' .$test. '", title="' .$title. '", status="' .$status. '", startDate="' .$startDate. '", startTime="' .$s...
        ($rv, undef, undef) = DBI_do ($rv, \$dbh, $updateString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perf...
      } elsif ($insertEntryDBI) {
        $insertString = 'INSERT INTO ' .$SERVERTABLEVENTS. ' SET catalogID="' .$catalogID. '", uKey="' .$uniqueKey. '", replicationStatus="I", test="' .$test. '", title="' .$title. '", status="' .$status. '", startDate="' .$startDate. '", startTime="...
        ($rv, undef, undef) = DBI_do ($rv, \$dbh, $insertString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perf...
      }

      my ( $lastStatus, $lastTimeslot, $prevStatus, $prevTimeslot ) = ( $status, get_timeslot ($currentDate), '', '' );
      my $sql = "select SQL_NO_CACHE lastStatus, lastTimeslot from $SERVERTABLEVENTSCHNGSLGDT where catalogID = '$catalogID' and uKey = '$uniqueKey'";
      my $sth = $dbh->prepare( $sql ) or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability,...
      ($rv, undef) = DBI_execute ($rv, \$sth, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $i...

      if ( $rv ) {
        if ( $sth->rows ) {
	      ($prevStatus, $prevTimeslot) = $sth->fetchrow_array() or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $...
          $sth->finish() or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent,...
          $updateString = 'UPDATE ' .$SERVERTABLEVENTSCHNGSLGDT. ' SET replicationStatus="U", lastStatus="' .$lastStatus. '", lastTimeslot="' .$lastTimeslot. '", prevStatus="' .$prevStatus. '", prevTimeslot="' .$prevTimeslot. '" where catalogID="' .$...
          ($rv, undef, undef) = DBI_do ($rv, \$dbh, $updateString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $pe...
        } else {
          $insertString = 'INSERT INTO ' .$SERVERTABLEVENTSCHNGSLGDT. ' SET catalogID="' .$catalogID. '", uKey="' .$uniqueKey. '", replicationStatus="I", lastStatus="' .$lastStatus. '", lastTimeslot="' .$lastTimeslot. '", prevStatus="' .$prevStatus. ...
          ($rv, undef, undef) = DBI_do ($rv, \$dbh, $insertString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $pe...
        }
      }
    }

    if ($lockMySQL) {
      if ($dbh and $rv) {
        $unlockString = 'UNLOCK TABLES';
        ($rv, undef, undef) = DBI_do ($rv, \$dbh, $unlockString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perf...
      }
    }
  }

  if ($dbh and $rv) {
    $dbh->disconnect or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $do...
    my $environment = (($test =~ /\-\-environment=([PASTDL])/) ? $1 : 'P');
    $rv = graphEntryDBI ($catalogID, $uniqueKey, $title, $environment, $dbiFilename, $interval, 121, 6, 1, 0, get_trendline_from_test ($test), 0, $debug) if ($interval > 0);
  }

  return $rv;
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub errorTrapDBI {
  my ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $downtime, $filename, $error_message, $l...

  print $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";

  my $tlogging = $logging . get_logfiledate();

  my ($msgCommand, undef) = split(/\.pl/, $test);

  # APE # TODO - REMOVE
  # my $rvOpen = open(DEBUG,">>$tlogging-$msgCommand-$catalogID_uniqueKey.sql");

  # if ($rvOpen) {
  #   print DEBUG '"', $catalogID, '","","', $uniqueKey, '","I","', $test, '","', $title, '","', $status, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","', $duration, '","', $statusMessage, '","', $perfdata, '","', $inter...
  #   close(DEBUG);
  # } else {
  #   print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey.sql to print debug information\n";
  # }

  my %VALUES = (
    'catalogID'         => $catalogID,
    'id'                => 0,
    'uKey'              => $uniqueKey,
    'replicationStatus' => 'I',
    'test'              => $test,
    'title'             => $title,
    'status'            => $status,
    'startDate'         => $startDate,
    'startTime'         => $startTime,
    'endDate'           => $endDate,
    'endTime'           => $endTime,
    'duration'          => $duration,
    'statusMessage'     => $statusMessage,
    'perfdata'          => $perfdata,
    'step'              => $interval * 60,
    'timeslot'          => get_timeslot ($currentDate),
    'instability'       => $instability,
    'persistent'        => $persistent,
    'downtime'          => $downtime,

applications/collector-test.pl  view on Meta::CPAN


  my $_debug = ( ( $debug eq 'T' ) ? 1 : 0);
  my $dbh = CSV_prepare_table ($logging, get_logfiledate() . "-$msgCommand-$catalogID_uniqueKey", '.sql', $SERVERTABLEVENTS, \@EVENTS, \%EVENTS, \$logger, $_debug);
  my $rv = CSV_insert_into_table (1, $dbh, $SERVERTABLEVENTS, \@EVENTS, \%VALUES, 'id', \$logger, $_debug);
  CSV_cleanup_table ($dbh, \$logger, $_debug);

  my $rvOpen = open(DEBUG,">>$tlogging-$msgCommand-$catalogID_uniqueKey-sql-error.txt");

  if ($rvOpen) {
    print DEBUG $error_message, "\n--> ERROR: $DBI::err ($DBI::errstr)\n";
    print DEBUG $CATALOGID, " --> ", $catalogID, " <-> ", $uniqueKey, " <-> ", $title, " <-> ", $status, "\n--> ", $startDate, " <-> ", $startTime, " <-> ", $endDate, " <-> ", $endTime, " <-> ", $duration, " <-> ", $interval*60, " <-> ", get_timeslot...
    close(DEBUG);
  } else {
    print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey-sql-error.txt to print debug information\n";
  }

  unless ( -e "$RESULTSPATH/$collectorlist-MySQL-sql-error.txt" ) {
    my $tDebug = ($debug eq 'T') ? 2 : 0;
    my $subject = "$prgtext / Current status for $collectorlist: " . get_datetimeSignal();
    my $message = get_datetimeSignal() . " $error_message\n--> ERROR: $DBI::err ($DBI::errstr)\n";
    my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $message, $tDebug );

applications/collector-test.pl  view on Meta::CPAN

  my $width      = 893;
  my $hight      = 558;
  my $xOffset    = 74;
  my $yOffset    = 28;
  my $yMarkColor = 0xFFFFDC;
  my $background = 0xF7F7F7;

  print "Generating RRD alike graph\n" if ($debug eq 'T');

  my (@dataOK, @dataCritical, @dataWarning, @dataUnknown, @dataNoTest, @dataOffline, @RRDlabels);
  my ($step, $lastTimeslot, $firstTimeslot, $duration, $startTime, $status, $timeslot, $findString);

  $step          = $interval * 60;
  $lastTimeslot  = timelocal (0, (localtime)[1,2,3,4,5]);
  $firstTimeslot = $lastTimeslot - ($step * ($limitTest));
  $findString    = "select SQL_NO_CACHE duration, startTime, status, timeslot from $SERVERTABLEVENTS force index (uKey) where catalogID = '$catalogID' and uKey = '$uniqueKey' and step <> '0' and (timeslot between '$firstTimeslot' and '$lastTimeslot')...
  print "$findString\n" if ($debug eq 'T');

  # data en labels in array zetten
  my ($counter, $seconden, $ttimeslot);

  for ( $counter = 0; $counter < $limitTest; $counter++) {
    push (@dataOK,       "0");
    push (@dataWarning,  "0");
    push (@dataCritical, "0");
    push (@dataUnknown,  "0");

applications/collector-test.pl  view on Meta::CPAN

  # db connect & sql query
  my ($dbh, $rv, $alarmMessage) = DBI_connect ( $DATABASE, $serverName, $SERVERPORTREADWRITE, $SERVERUSERREADWRITE, $SERVERPASSREADWRITE, $alarm, \&errorTrapDBIgraphEntry, ["Cannot connect to the database"], \$logger, $debug, $boolean_debug_all );

  if ($dbh and $rv) {
    my $sth = $dbh->prepare( $findString ) or $rv = errorTrapDBIgraphEntry("Cannot dbh->prepare: $findString", \$logger, $debug);
    ($rv, $alarmMessage) = DBI_execute ($rv, \$sth, $alarm, \&errorTrapDBIgraphEntry, ["Cannot sth->execute: $findString"], \$logger, $debug);

    unless ( $rv ) {
      $title .= " - DBI_execute - alarm: $alarm - $alarmMessage";
    } else {
      $sth->bind_columns( \$duration, \$startTime, \$status, \$timeslot ) or $rv = errorTrapDBIgraphEntry("Cannot sth->bind_columns: $findString", \$logger, $debug);

      unless ( $rv ) {
        $title .= " - Cannot sth->bind_columns";
      } else {
        $counter = 0;
        my $limitTrendline = ($yMarkValue) ? $yMarkValue * 2.5 : 9000;

        while( $sth->fetch() ) {
          $seconden  = int(substr($duration, 6, 2)) + int(substr($duration, 3, 2)*60) + int(substr($duration, 0, 2)*3600);
          $seconden += 0.5 if ($seconden == 0); # correction for to fast testresults

applications/collector-test.pl  view on Meta::CPAN

              $dataWarning[$ttimeslot]  = '-5';
            } elsif ($status eq 'UNKNOWN'){
              $dataUnknown[$ttimeslot]  = '-5';
            } elsif ($status eq 'NO TEST') {
              $dataNoTest[$ttimeslot]   = '-5';
            } elsif ($status eq 'OFFLINE') {
              $dataOffline[$ttimeslot]  = '-5';
            }
          }

  	      $RRDlabels[int($limitTest - $counter - 1)] = substr($startTime, 0, 5) unless ( $counter % $xLabelStep );
          $counter++;
        }
      }

      $sth->finish() or $rv = errorTrapDBIgraphEntry("Cannot sth->finish: $findString", \$logger, $debug);
	}

    $dbh->disconnect or $rv = errorTrapDBIgraphEntry("Sorry, the database was unable to add your entry.", \$logger, $debug);
  } else {
    $title .= " - DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage";

applications/collector-test.pl  view on Meta::CPAN

  # Add a stacked bar layer to the chart
  my $layer = $c->addBarLayer2($perlchartdir::Stack);

  # Set the axes width to 1 pixels
  $c->yAxis()->setWidth(1);
  $c->xAxis()->setWidth(1);

  # Add a title to the y axis
  $c->yAxis()->setTitle("Response time", "arial.ttf", 9);

  # Set the margins at the two ends of the axis during auto-scaling, and whether to start the axis from zero
  $c->yAxis()->setAutoScale(0, 0, 0);

  # Add a mark line ore zone to the chart and add the first two data sets to the chart as a stacked bar group
  if ($yMarkValue) {
	if ($markOrZone) {
	  $c->yAxis()->addMark($yMarkValue, $yMarkColor);
  	} else {
	  $c->yAxis()->addZone($yMarkValue, 3600, $yMarkColor);
	  $c->yAxis()->addZone(0, -6, $yMarkColor);
    }

applications/collector.pl  view on Meta::CPAN

              }
            }

            $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 {

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

  # printDebugAll ("kill -WARN <$PROGNAME v$version -C $collectorlist> pid: <$pidfile>");

  if ( $CHILD_OFF or $! =~ /\QASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = \E(\d*)\Q\n\E/ or $@ =~ /\QASNMTAP::Asnmtap::Applications::Collector::CHILD_OFF = \E(\d*)\Q\n\E/ ) {
    my $alarm = ( ( defined $CHILD_OFF and $CHILD_OFF ) ? $CHILD_OFF : $1 );

    if ( defined $alarm ) {
      use Proc::ProcessTable;
      my $t = new Proc::ProcessTable;

      foreach my $process ( @{$t->table} ) {
        if ( $process->ppid == $$ and ( timelocal( (localtime)[0,1,2,3,4,5] ) - $process->start ) >= $alarm ) {
          $process->kill(9);
          $boolean_signal_kill = 1;
          printDebugAll ("kill -9 <$PROGNAME v$version -C $collectorlist> pid: <". $process->pid ."> ppid: <$$>");
        }
      }
    }
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

applications/collector.pl  view on Meta::CPAN

  my ($asnmtapEnv, $currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $resultsdir, $title, $system_action, $status, $interval, $instability, $persistent, $downtime, $debug, $dbiFilename, $logging, $httpdump, $dumphttp, $queryMySQL) = @_;

  my $rvOpen;
  my $action = '';
  my $httpdumpFilename    = '';
  my $httpdumpFilenameTmp = '';
  my $debugFilename       = '<NIHIL>';
  my $dumphttpRename      = '<NIHIL>';
  my ($stdout, $stderr, $exit_value, $signal_num, $dumped_core);

  my ($loggedStatus, $returnStatus, $startDate, $startTime, $endDate, $endTime, $msgCommand);
  $startDate = get_csvfiledate();
  $startTime = get_csvfiletime();
  ($msgCommand, undef) = split(/\.pl/, $system_action);

  if ($dumphttp ne 'N') {
    $httpdumpFilename = $httpdump . get_datetime() .'-'. $msgCommand .'-'. $catalogID_uniqueKey;
    $httpdumpFilenameTmp = $httpdumpFilename .'.tmp';
  }

  $boolean_signal_kill = 0;

  if (-e "$PLUGINPATH/$msgCommand.pl") {

applications/collector.pl  view on Meta::CPAN


  my ($duration) = $returnStatus =~ m/Trendline=([0-9.]+)s;[0-9.]+;;;$/i;

  if (defined $duration) {
    my ($thour, $tmin, $tsec);
    $thour = int ($duration / 3600);
    $tmin  = int (int ($duration % 3600) / 60);
    $tsec  = int ($duration % 60);
    $duration = sprintf("%02d:%02d:%02d", $thour, $tmin, $tsec);
  } else {
    my ($tyear, $tmonth, $tday, $thour, $tmin, $tsec, @startDateTime, @endDateTime, @diffDateTime);

    ($tyear, $tmonth, $tday) = split(/\//, $startDate);
    ($thour, $tmin, $tsec)   = split(/\:/, $startTime);
    @startDateTime = ($tyear, $tmonth, $tday, $thour, $tmin, $tsec);

    ($tyear, $tmonth, $tday) = split(/\//, $endDate);
    ($thour, $tmin, $tsec)   = split(/\:/, $endTime);
    @endDateTime = ($tyear, $tmonth, $tday, $thour, $tmin, $tsec);

    @diffDateTime = Delta_DHMS(@startDateTime, @endDateTime);
    $duration = sprintf("%02d:%02d:%02d", $diffDateTime[1], $diffDateTime[2], $diffDateTime[3]);
  }

# my ($outputData, $performanceData) = split(/\|/, $returnStatus, 2);
  my $_returnStatus = reverse $returnStatus;
  my ($_outputData, $_performanceData) = reverse split(/\|/, $_returnStatus, 2);
  my $outputData = reverse $_outputData;
  my $performanceData = reverse $_performanceData;

  $rvOpen = open(CSV,">>$logging-$msgCommand-$catalogID_uniqueKey-csv.txt");

  if ($rvOpen) {
    print CSV '"', $catalogID, '","","', $uniqueKey, '","I","', $system_action, '","', $title, '","', $dumphttpRename, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","', $duration, '","', $outputData, '","', $performanceDa...
    close(CSV);
  } else {
    print "Cannot open $logging-$msgCommand-$catalogID_uniqueKey-csv.txt to print debug information\n";
  }

  if ( $boolean_perfParseInstalled ) {
    if (defined $performanceData) {
      my $perfParseTimeslot = get_timeslot ($currentDate);

      my $perfParseCommand;

applications/collector.pl  view on Meta::CPAN

        system ("$perfParseCommand"); $stdout = $stderr = '';
      }

      $exit_value  = $? >> 8;
      $signal_num  = $? & 127;
      $dumped_core = $? & 128;
      printDebugNOK ("    perfParse ----- : $perfParseCommand: <$exit_value><$signal_num><$dumped_core><$stderr>") unless ( $exit_value == 0 && $signal_num == 0 && $dumped_core == 0 && $stderr eq '' );
    }
  }

  insertEntryDBI ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $dbiFilename.$msgCommand.'-'.$catalogID_uniqueKey.'-sql', $system_action, $interval, $dumphttpRename, $logging, $debug, $startDate, $startTime, $endDate, $endTime, ...
  return $action;
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub printDebugAll {
  my ($l_text) = @_;

  if ($boolean_screenDebug or $boolean_debug_all) {
    chomp ($l_text);

applications/collector.pl  view on Meta::CPAN

      close(NOKDEBUG);
    } else {
      print "Cannot open $tlogging-nok.txt to print debug information\n";
    }
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub insertEntryDBI {
  my ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $title, $dbiFilename, $test, $interval, $status, $logging, $debug, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $filename, $insertMySQL, $queryMySQ...

  return ( 1 ) unless ( $insertMySQL );

  my ($sth, $lockString, $findString, $updateString, $insertString, $flushString, $unlockString, $insertEntryDBI, $updateEntryDBI);
  $insertEntryDBI = 0;
  $updateEntryDBI = 0;
  my ($dbh, $rv, $alarmMessage) = DBI_connect ( $DATABASE, $serverName, $SERVERPORTREADWRITE, $SERVERUSERREADWRITE, $SERVERPASSREADWRITE, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $st...

  if ($dbh and $rv) {
    if ($queryMySQL) {
      my $numbersEntryDBI = 0;
      $findString = 'select SQL_NO_CACHE status from '.$SERVERTABLEVENTS.' where catalogID = "' .$catalogID. '" and uKey = "' .$uniqueKey. '" and step <> "0" and timeslot = "' . get_timeslot ($currentDate) . '" order by id desc';
      printDebugAll ("query Entry DBI: <$findString>") if ($debug eq 'T');
      $sth = $dbh->prepare($findString) or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instabilit...
      ($rv, undef) = DBI_execute ($rv, \$sth, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $i...

      if ($rv) {
  	    while (my $ref = $sth->fetchrow_hashref()) {
	      $numbersEntryDBI++;
          if ( $ref->{status} eq '<NIHIL>' or $ref->{status} eq 'OFFLINE' or $ref->{status} eq 'NO TEST' ) { $updateEntryDBI = 1; }
        }

        $insertEntryDBI = 1 unless ( $numbersEntryDBI );
        printDebugAll ("query Entry DBI: # <$numbersEntryDBI> insert <$insertEntryDBI> change <$updateEntryDBI>") if ($debug eq 'T');
      }

      $sth->finish() or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $do...
    } else {
      $insertEntryDBI = 1;
    }
  } else {
    $logger->info("     DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage") if ( defined $logger and $logger->is_info() );
  }

  if ($insertEntryDBI or $updateEntryDBI) {
    if ($lockMySQL) {
      if ($dbh and $rv) {
        $lockString = 'LOCK TABLES ' .$SERVERTABLEVENTS. ' WRITE, ' .$SERVERTABLEVENTSCHNGSLGDT. ' WRITE';
        ($rv, undef, undef) = DBI_do ($rv, \$dbh, $lockString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfda...
      }
    }

    if ($dbh and $rv) {
      $statusMessage =~ s/"/'/g;

      if ($updateEntryDBI) {
        $updateString = 'UPDATE ' .$SERVERTABLEVENTS. ' SET catalogID="' .$catalogID. '", uKey="' .$uniqueKey. '", replicationStatus="U", test="' .$test. '", title="' .$title. '", status="' .$status. '", startDate="' .$startDate. '", startTime="' .$s...
        ($rv, undef, undef) = DBI_do ($rv, \$dbh, $updateString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perf...
      } elsif ($insertEntryDBI) {
        $insertString = 'INSERT INTO ' .$SERVERTABLEVENTS. ' SET catalogID="' .$catalogID. '", uKey="' .$uniqueKey. '", replicationStatus="I", test="' .$test. '", title="' .$title. '", status="' .$status. '", startDate="' .$startDate. '", startTime="...
        ($rv, undef, undef) = DBI_do ($rv, \$dbh, $insertString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perf...
      }

      my ( $lastStatus, $lastTimeslot, $prevStatus, $prevTimeslot ) = ( $status, get_timeslot ($currentDate), '', '' );
      my $sql = "select SQL_NO_CACHE lastStatus, lastTimeslot from $SERVERTABLEVENTSCHNGSLGDT where catalogID = '$catalogID' and uKey = '$uniqueKey'";
      my $sth = $dbh->prepare( $sql ) or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability,...
      ($rv, undef) = DBI_execute ($rv, \$sth, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $i...

      if ( $rv ) {
        if ( $sth->rows ) {
	      ($prevStatus, $prevTimeslot) = $sth->fetchrow_array() or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $...
          $sth->finish() or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent,...
          $updateString = 'UPDATE ' .$SERVERTABLEVENTSCHNGSLGDT. ' SET replicationStatus="U", lastStatus="' .$lastStatus. '", lastTimeslot="' .$lastTimeslot. '", prevStatus="' .$prevStatus. '", prevTimeslot="' .$prevTimeslot. '" where catalogID="' .$...
          ($rv, undef, undef) = DBI_do ($rv, \$dbh, $updateString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $pe...
        } else {
          $insertString = 'INSERT INTO ' .$SERVERTABLEVENTSCHNGSLGDT. ' SET catalogID="' .$catalogID. '", uKey="' .$uniqueKey. '", replicationStatus="I", lastStatus="' .$lastStatus. '", lastTimeslot="' .$lastTimeslot. '", prevStatus="' .$prevStatus. ...
          ($rv, undef, undef) = DBI_do ($rv, \$dbh, $insertString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $pe...
        }
      }
    }

    if ($lockMySQL) {
      if ($dbh and $rv) {
        $unlockString = 'UNLOCK TABLES';
        ($rv, undef, undef) = DBI_do ($rv, \$dbh, $unlockString, $alarm, \&errorTrapDBI, [$currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perf...
      }
    }
  }

  if ($dbh and $rv) {
    $dbh->disconnect or $rv = errorTrapDBI($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $do...
    my $environment = (($test =~ /\-\-environment=([PASTDL])/) ? $1 : 'P');
    $rv = graphEntryDBI ($catalogID, $uniqueKey, $title, $environment, $dbiFilename, $interval, 121, 6, 1, 0, get_trendline_from_test ($test), 0, $debug) if ($interval > 0);
  }

  return $rv;
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub errorTrapDBI {
  my ($currentDate, $catalogID_uniqueKey, $catalogID, $uniqueKey, $test, $title, $status, $startDate, $startTime, $endDate, $endTime, $duration, $statusMessage, $perfdata, $interval, $instability, $persistent, $downtime, $filename, $error_message, $l...

  print $error_message, "\nERROR: $DBI::err ($DBI::errstr)\n";

  my $tlogging = $logging . get_logfiledate();

  my ($msgCommand, undef) = split(/\.pl/, $test);

  # APE # TODO - REMOVE
  # my $rvOpen = open(DEBUG,">>$tlogging-$msgCommand-$catalogID_uniqueKey.sql");

  # if ($rvOpen) {
  #   print DEBUG '"', $catalogID, '","","', $uniqueKey, '","I","', $test, '","', $title, '","', $status, '","', $startDate, '","', $startTime, '","', $endDate, '","', $endTime, '","', $duration, '","', $statusMessage, '","', $perfdata, '","', $inter...
  #   close(DEBUG);
  # } else {
  #   print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey.sql to print debug information\n";
  # }

  my %VALUES = (
    'catalogID'         => $catalogID,
    'id'                => 0,
    'uKey'              => $uniqueKey,
    'replicationStatus' => 'I',
    'test'              => $test,
    'title'             => $title,
    'status'            => $status,
    'startDate'         => $startDate,
    'startTime'         => $startTime,
    'endDate'           => $endDate,
    'endTime'           => $endTime,
    'duration'          => $duration,
    'statusMessage'     => $statusMessage,
    'perfdata'          => $perfdata,
    'step'              => $interval * 60,
    'timeslot'          => get_timeslot ($currentDate),
    'instability'       => $instability,
    'persistent'        => $persistent,
    'downtime'          => $downtime,

applications/collector.pl  view on Meta::CPAN


  my $_debug = ( ( $debug eq 'T' ) ? 1 : 0);
  my $dbh = CSV_prepare_table ($logging, get_logfiledate() . "-$msgCommand-$catalogID_uniqueKey", '.sql', $SERVERTABLEVENTS, \@EVENTS, \%EVENTS, \$logger, $_debug);
  my $rv = CSV_insert_into_table (1, $dbh, $SERVERTABLEVENTS, \@EVENTS, \%VALUES, 'id', \$logger, $_debug);
  CSV_cleanup_table ($dbh, \$logger, $_debug);

  my $rvOpen = open(DEBUG,">>$tlogging-$msgCommand-$catalogID_uniqueKey-sql-error.txt");

  if ($rvOpen) {
    print DEBUG $error_message, "\n--> ERROR: $DBI::err ($DBI::errstr)\n";
    print DEBUG $CATALOGID, " --> ", $catalogID, " <-> ", $uniqueKey, " <-> ", $title, " <-> ", $status, "\n--> ", $startDate, " <-> ", $startTime, " <-> ", $endDate, " <-> ", $endTime, " <-> ", $duration, " <-> ", $interval*60, " <-> ", get_timeslot...
    close(DEBUG);
  } else {
    print "Cannot open $tlogging-$msgCommand-$catalogID_uniqueKey-sql-error.txt to print debug information\n";
  }

  unless ( -e "$RESULTSPATH/$collectorlist-MySQL-sql-error.txt" ) {
    my $tDebug = ($debug eq 'T') ? 2 : 0;
    my $subject = "$prgtext / Current status for $collectorlist: " . get_datetimeSignal();
    my $message = get_datetimeSignal() . " $error_message\n--> ERROR: $DBI::err ($DBI::errstr)\n";
    my $returnCode = sending_mail ( $SERVERLISTSMTP, $SENDEMAILTO, $SENDMAILFROM, $subject, $message, $tDebug );

applications/collector.pl  view on Meta::CPAN

  my $width      = 893;
  my $hight      = 558;
  my $xOffset    = 74;
  my $yOffset    = 28;
  my $yMarkColor = 0xFFFFDC;
  my $background = 0xF7F7F7;

  print "Generating RRD alike graph\n" if ($debug eq 'T');

  my (@dataOK, @dataCritical, @dataWarning, @dataUnknown, @dataNoTest, @dataOffline, @RRDlabels);
  my ($step, $lastTimeslot, $firstTimeslot, $duration, $startTime, $status, $timeslot, $findString);

  $step          = $interval * 60;
  $lastTimeslot  = timelocal (0, (localtime)[1,2,3,4,5]);
  $firstTimeslot = $lastTimeslot - ($step * ($limitTest));
  $findString    = "select SQL_NO_CACHE duration, startTime, status, timeslot from $SERVERTABLEVENTS force index (uKey) where catalogID = '$catalogID' and uKey = '$uniqueKey' and step <> '0' and (timeslot between '$firstTimeslot' and '$lastTimeslot')...
  print "$findString\n" if ($debug eq 'T');

  # data en labels in array zetten
  my ($counter, $seconden, $ttimeslot);

  for ( $counter = 0; $counter < $limitTest; $counter++) {
    push (@dataOK,       "0");
    push (@dataWarning,  "0");
    push (@dataCritical, "0");
    push (@dataUnknown,  "0");

applications/collector.pl  view on Meta::CPAN

  # db connect & sql query
  my ($dbh, $rv, $alarmMessage) = DBI_connect ( $DATABASE, $serverName, $SERVERPORTREADWRITE, $SERVERUSERREADWRITE, $SERVERPASSREADWRITE, $alarm, \&errorTrapDBIgraphEntry, ["Cannot connect to the database"], \$logger, $debug, $boolean_debug_all );

  if ($dbh and $rv) {
    my $sth = $dbh->prepare( $findString ) or $rv = errorTrapDBIgraphEntry("Cannot dbh->prepare: $findString", \$logger, $debug);
    ($rv, $alarmMessage) = DBI_execute ($rv, \$sth, $alarm, \&errorTrapDBIgraphEntry, ["Cannot sth->execute: $findString"], \$logger, $debug);

    unless ( $rv ) {
      $title .= " - DBI_execute - alarm: $alarm - $alarmMessage";
    } else {
      $sth->bind_columns( \$duration, \$startTime, \$status, \$timeslot ) or $rv = errorTrapDBIgraphEntry("Cannot sth->bind_columns: $findString", \$logger, $debug);

      unless ( $rv ) {
        $title .= " - Cannot sth->bind_columns";
      } else {
        $counter = 0;
        my $limitTrendline = ($yMarkValue) ? $yMarkValue * 2.5 : 9000;

        while( $sth->fetch() ) {
          $seconden  = int(substr($duration, 6, 2)) + int(substr($duration, 3, 2)*60) + int(substr($duration, 0, 2)*3600);
          $seconden += 0.5 if ($seconden == 0); # correction for to fast testresults

applications/collector.pl  view on Meta::CPAN

              $dataWarning[$ttimeslot]  = '-5';
            } elsif ($status eq 'UNKNOWN'){
              $dataUnknown[$ttimeslot]  = '-5';
            } elsif ($status eq 'NO TEST') {
              $dataNoTest[$ttimeslot]   = '-5';
            } elsif ($status eq 'OFFLINE') {
              $dataOffline[$ttimeslot]  = '-5';
            }
          }

  	      $RRDlabels[int($limitTest - $counter - 1)] = substr($startTime, 0, 5) unless ( $counter % $xLabelStep );
          $counter++;
        }
      }

      $sth->finish() or $rv = errorTrapDBIgraphEntry("Cannot sth->finish: $findString", \$logger, $debug);
	}

    $dbh->disconnect or $rv = errorTrapDBIgraphEntry("Sorry, the database was unable to add your entry.", \$logger, $debug);
  } else {
    $title .= " - DBI_connect - Cannot connect to the database - alarm: $alarm - alarmMessage: $alarmMessage";

applications/collector.pl  view on Meta::CPAN

  # Add a stacked bar layer to the chart
  my $layer = $c->addBarLayer2($perlchartdir::Stack);

  # Set the axes width to 1 pixels
  $c->yAxis()->setWidth(1);
  $c->xAxis()->setWidth(1);

  # Add a title to the y axis
  $c->yAxis()->setTitle("Response time", "arial.ttf", 9);

  # Set the margins at the two ends of the axis during auto-scaling, and whether to start the axis from zero
  $c->yAxis()->setAutoScale(0, 0, 0);

  # Add a mark line ore zone to the chart and add the first two data sets to the chart as a stacked bar group
  if ($yMarkValue) {
	if ($markOrZone) {
	  $c->yAxis()->addMark($yMarkValue, $yMarkColor);
  	} else {
	  $c->yAxis()->addZone($yMarkValue, 3600, $yMarkColor);
	  $c->yAxis()->addZone(0, -6, $yMarkColor);
    }

applications/display-test.pl  view on Meta::CPAN

  if ($opt_l eq 'F' || $opt_l eq 'T') {
    $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;

applications/display-test.pl  view on Meta::CPAN


            $sth->finish() or $rv = errorTrapDBI($checklist, "Cannot sth->finish: $sql");
          }

          $step          = $tinterval * 60;
          $lastTimeslot  = get_timeslot ($creationDate);
          $firstTimeslot = $lastTimeslot - ($step * $NUMBEROFFTESTS);
          $timeCorrectie = 0;

          if ( $trigger ) {
            $findString  = 'select SQL_NO_CACHE title, duration, timeslot, startTime, endTime, endDate, status, statusMessage, perfdata, filename from '.$SERVERTABLEVENTSDISPLAYDT.' where catalogID="' .$catalogID. '" and uKey = "'.$uniqueKey.'" and s...
          } else {
            $findString  = 'select SQL_NO_CACHE title, duration, timeslot, startTime, endTime, endDate, status, statusMessage, perfdata, filename from '.$SERVERTABLEVENTS.' force index (uKey) where catalogID="' .$catalogID. '" and uKey = "'.$uniqueKe...
          }

          print "<", $findString, ">\n" if ($debug);
          $sth = $dbh->prepare($findString) or $rv = errorTrapDBI($checklist, "Cannot dbh->prepare: $findString");
          $sth->execute or $rv = errorTrapDBI($checklist, "Cannot sth->execute: $findString") if $rv;

          my (@itemTimelocal, @itemStatus, @itemStarttime, @itemTimeslot, @tempStatusMessage);
          @itemTimelocal = @itemStatus = @itemStarttime = @itemTimeslot = @tempStatusMessage = ();
          $timeValue = $lastTimeslot;

applications/display-test.pl  view on Meta::CPAN

            push (@tempStatusMessage, undef);
            $timeValue -= $step;
          }

          $timeValue = $lastTimeslot;
          $inIMW = 1;

          if ($rv) {
            while (my $ref = $sth->fetchrow_hashref()) {
              $timeslot = ( $step ? int(($lastTimeslot - $ref->{timeslot}) / $step) : 0 );
              print "<", $timeslot, "><", $ref->{title}, "><", $ref->{startTime}, "><", $ref->{timeslot}, ">\n" if ($debug);

              if ($timeslot >= 0) {
                my $dstatus = ($ref->{status} eq '<NIHIL>') ? 'UNKNOWN' : $ref->{status};
	  	          $tstatus = $dstatus;

                if ($dstatus eq 'OK' and $trendline) {
                  my $tSeconden = int(substr($ref->{duration}, 6, 2)) + int(substr($ref->{duration}, 3, 2)*60) + int(substr($ref->{duration}, 0, 2)*3600);
			            $tstatus = 'TRENDLINE' if ($tSeconden > $trendline);
	  		        }

                $itemStatus[$timeslot] = $tstatus;
                $itemStarttime[$timeslot] = $ref->{startTime};
                $itemTimeslot[$timeslot]  = $ref->{timeslot};

                unless ( defined $ref->{perfdata} and $ref->{perfdata} ne '' ) { # remove performance data
                # ($ref->{statusMessage}, undef) = split(/\|/, $ref->{statusMessage}, 2);
                  my $statusMessage = reverse $ref->{statusMessage};
                  my ($_statusMessage, undef) = reverse split(/\|/, $statusMessage, 2);
                  $ref->{statusMessage} = reverse $_statusMessage;
                }

                if ( -e $RESULTSPATH .'/'. $ref->{filename} ) {

applications/display-test.pl  view on Meta::CPAN

                }

                if ( $timeslot == 0 or ( $timeslot == 1 and $itemStatus[0] eq 'IN PROGRESS' ) ) {
                  $statusOverlib = ( $timeslot ? $itemStatus[1] : $itemStatus[0] );

                  if ($pagedirOrig =~ /^(?:index|test)$/ and -s "$APPLICATIONPATH/custom/cartography.pm") {
                    require "$APPLICATIONPATH/custom/cartography.pm";
                    createGifForCartography( $catalogID_uniqueKey, $statusOverlib );
                  }

                  $inIMW = inIncidentMonitoringWindow ($catalogID, $uniqueKey, $ref->{timeslot}, $ref->{startTime}, $ref->{endTime}, $ref->{endDate}, \%timeperiodID_days, \%catalogID_uKey_timeperiodID, $debug);
                }

                if ($dstatus ne 'OK' and $dstatus ne 'OFFLINE' and $dstatus ne 'NO DATA' and $dstatus ne 'NO TEST') {
                  $tempStatusMessage[$timeslot] = '<IMG SRC="'.$IMAGESURL.'/'.$statusIcon.'" WIDTH="16" HEIGHT="16" BORDER=0 title="'.$tstatus.'" alt="'.$tstatus.'"></TD><TD class="StatusMessage">'.$ref->{startTime}.'</TD><TD class="StatusMessage">'....

                  if ( $timeslot == 0 or ( $timeslot == 1 and $itemStatus[0] eq 'IN PROGRESS' ) ) {
                    $ref->{statusMessage} =~ s/'/`/g;
                    $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;

applications/display-test.pl  view on Meta::CPAN


  if ($debug) {
    use Data::Dumper;
    print Dumper ( $hash_catalogID_uKey_timeperiodID ), "\n\n";
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub inIncidentMonitoringWindow {
  my ($catalogID, $uniqueKey, $timeslot, $startTime, $endTime, $endDate, $timeperiodID_days, $catalogID_uKey_timeperiodID, $debug) = @_;

  my $InIMW;

  my ($year, $month, $day) = split (/[-\/]/, $endDate);

  if (defined $year and defined $month and defined $day) {
    my $Year  = $year-1900;
    my $Month = $month-1;
    my $wDay = (localtime( timelocal( 0, 0, 0, $day, $Month, $Year ) ))[6];
    my $timeperiodes = ( exists $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{$wDay} ) ? $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{$wDay} : $$timeperiodID_days{$catalogID}->{$$catalogID_uKey_timeperio...

applications/display-test.pl  view on Meta::CPAN

  }

  return ($InIMW);
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub printHtmlHeader {
  my $htmlTitle = shift(@_);

  print_header (*HTML, $pagedir, "$pageset-cv", $htmlTitle, "Full View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef);
  print HTML '<TABLE WIDTH="100%">', "\n";

  print_header (*HTMLCV, $pagedir, "$pageset-mcv", $htmlTitle, "Condenced View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef);
  print HTMLCV '<TABLE WIDTH="100%">', "\n";

  print_header (*HTMLMCV, $pagedir, "$pageset", $htmlTitle, "Minimal Condenced View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef...
  print HTMLMCV '<TABLE WIDTH="100%">', "\n";
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub printGroepHeader {
  my ($title, $show) = @_;

  if ($show) {
    $groupFullView = $groupCondensedView = 0;

applications/display-test.pl  view on Meta::CPAN

  }
</script>
EOH

  if ($playSoundStatus) {
    print HTML <<EOH;
<script language="JavaScript" type="text/javascript">
  var soundState = getSoundCookie( 'soundState' );

  if ( soundState != null && soundState == 'on' ) {
    playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
    dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
  }
</script>
EOH
  }

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  print HTMLCV '</TABLE>', "\n";

applications/display-test.pl  view on Meta::CPAN

  }
</script>
EOH

  if ($playSoundStatus) {
    print HTMLCV <<EOH;
<script language="JavaScript" type="text/javascript">
  var soundState = getSoundCookie( 'soundState' );

  if ( soundState != null && soundState == 'on' ) {
    playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
    dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
  }
</script>
EOH
  }

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  print HTMLMCV '</TABLE>', "\n";

applications/display-test.pl  view on Meta::CPAN

  }
</script>
EOH

  if ($playSoundStatus) {
    print HTMLMCV <<EOH;
<script language="JavaScript" type="text/javascript">
  var soundState = getSoundCookie( 'soundState' );

  if ( soundState != null && soundState == 'on' ) {
    playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
    dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
  }
</script>
EOH
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub maskPassword {

applications/display.pl  view on Meta::CPAN

  if ($opt_l eq 'F' || $opt_l eq 'T') {
    $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;

applications/display.pl  view on Meta::CPAN


            $sth->finish() or $rv = errorTrapDBI($checklist, "Cannot sth->finish: $sql");
          }

          $step          = $tinterval * 60;
          $lastTimeslot  = get_timeslot ($creationDate);
          $firstTimeslot = $lastTimeslot - ($step * $NUMBEROFFTESTS);
          $timeCorrectie = 0;

          if ( $trigger ) {
            $findString  = 'select SQL_NO_CACHE title, duration, timeslot, startTime, endTime, endDate, status, statusMessage, perfdata, filename from '.$SERVERTABLEVENTSDISPLAYDT.' where catalogID="' .$catalogID. '" and uKey = "'.$uniqueKey.'" and s...
          } else {
            $findString  = 'select SQL_NO_CACHE title, duration, timeslot, startTime, endTime, endDate, status, statusMessage, perfdata, filename from '.$SERVERTABLEVENTS.' force index (uKey) where catalogID="' .$catalogID. '" and uKey = "'.$uniqueKe...
          }

          print "<", $findString, ">\n" if ($debug);
          $sth = $dbh->prepare($findString) or $rv = errorTrapDBI($checklist, "Cannot dbh->prepare: $findString");
          $sth->execute or $rv = errorTrapDBI($checklist, "Cannot sth->execute: $findString") if $rv;

          my (@itemTimelocal, @itemStatus, @itemStarttime, @itemTimeslot, @tempStatusMessage);
          @itemTimelocal = @itemStatus = @itemStarttime = @itemTimeslot = @tempStatusMessage = ();
          $timeValue = $lastTimeslot;

applications/display.pl  view on Meta::CPAN

            push (@tempStatusMessage, undef);
            $timeValue -= $step;
          }

          $timeValue = $lastTimeslot;
          $inIMW = 1;

          if ($rv) {
            while (my $ref = $sth->fetchrow_hashref()) {
              $timeslot = ( $step ? int(($lastTimeslot - $ref->{timeslot}) / $step) : 0 );
              print "<", $timeslot, "><", $ref->{title}, "><", $ref->{startTime}, "><", $ref->{timeslot}, ">\n" if ($debug);

              if ($timeslot >= 0) {
                my $dstatus = ($ref->{status} eq '<NIHIL>') ? 'UNKNOWN' : $ref->{status};
	  	          $tstatus = $dstatus;

                if ($dstatus eq 'OK' and $trendline) {
                  my $tSeconden = int(substr($ref->{duration}, 6, 2)) + int(substr($ref->{duration}, 3, 2)*60) + int(substr($ref->{duration}, 0, 2)*3600);
			            $tstatus = 'TRENDLINE' if ($tSeconden > $trendline);
	  		        }

                $itemStatus[$timeslot] = $tstatus;
                $itemStarttime[$timeslot] = $ref->{startTime};
                $itemTimeslot[$timeslot]  = $ref->{timeslot};

                unless ( defined $ref->{perfdata} and $ref->{perfdata} ne '' ) { # remove performance data
                # ($ref->{statusMessage}, undef) = split(/\|/, $ref->{statusMessage}, 2);
                  my $statusMessage = reverse $ref->{statusMessage};
                  my ($_statusMessage, undef) = reverse split(/\|/, $statusMessage, 2);
                  $ref->{statusMessage} = reverse $_statusMessage;
                }

                if ( -e $RESULTSPATH .'/'. $ref->{filename} ) {

applications/display.pl  view on Meta::CPAN

                }

                if ( $timeslot == 0 or ( $timeslot == 1 and $itemStatus[0] eq 'IN PROGRESS' ) ) {
                  $statusOverlib = ( $timeslot ? $itemStatus[1] : $itemStatus[0] );

                  if ($pagedirOrig =~ /^(?:index|test)$/ and -s "$APPLICATIONPATH/custom/cartography.pm") {
                    require "$APPLICATIONPATH/custom/cartography.pm";
                    createGifForCartography( $catalogID_uniqueKey, $statusOverlib );
                  }

                  $inIMW = inIncidentMonitoringWindow ($catalogID, $uniqueKey, $ref->{timeslot}, $ref->{startTime}, $ref->{endTime}, $ref->{endDate}, \%timeperiodID_days, \%catalogID_uKey_timeperiodID, $debug);
                }

                if ($dstatus ne 'OK' and $dstatus ne 'OFFLINE' and $dstatus ne 'NO DATA' and $dstatus ne 'NO TEST') {
                  $tempStatusMessage[$timeslot] = '<IMG SRC="'.$IMAGESURL.'/'.$statusIcon.'" WIDTH="16" HEIGHT="16" BORDER=0 title="'.$tstatus.'" alt="'.$tstatus.'"></TD><TD class="StatusMessage">'.$ref->{startTime}.'</TD><TD class="StatusMessage">'....

                  if ( $timeslot == 0 or ( $timeslot == 1 and $itemStatus[0] eq 'IN PROGRESS' ) ) {
                    $ref->{statusMessage} =~ s/'/`/g;
                    $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;

applications/display.pl  view on Meta::CPAN


  if ($debug) {
    use Data::Dumper;
    print Dumper ( $hash_catalogID_uKey_timeperiodID ), "\n\n";
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub inIncidentMonitoringWindow {
  my ($catalogID, $uniqueKey, $timeslot, $startTime, $endTime, $endDate, $timeperiodID_days, $catalogID_uKey_timeperiodID, $debug) = @_;

  my $InIMW;

  my ($year, $month, $day) = split (/[-\/]/, $endDate);

  if (defined $year and defined $month and defined $day) {
    my $Year  = $year-1900;
    my $Month = $month-1;
    my $wDay = (localtime( timelocal( 0, 0, 0, $day, $Month, $Year ) ))[6];
    my $timeperiodes = ( exists $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{$wDay} ) ? $$catalogID_uKey_timeperiodID{$catalogID}->{$uniqueKey}->{SDE_IMW}->{$wDay} : $$timeperiodID_days{$catalogID}->{$$catalogID_uKey_timeperio...

applications/display.pl  view on Meta::CPAN

  }

  return ($InIMW);
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub printHtmlHeader {
  my $htmlTitle = shift(@_);

  print_header (*HTML, $pagedir, "$pageset-cv", $htmlTitle, "Full View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef);
  print HTML '<TABLE WIDTH="100%">', "\n";

  print_header (*HTMLCV, $pagedir, "$pageset-mcv", $htmlTitle, "Condenced View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef);
  print HTMLCV '<TABLE WIDTH="100%">', "\n";

  print_header (*HTMLMCV, $pagedir, "$pageset", $htmlTitle, "Minimal Condenced View", 60, "ONLOAD=\"startRefresh(); initSound();\"", 'T', "<script type=\"text/javascript\" src=\"$HTTPSURL/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script>", undef...
  print HTMLMCV '<TABLE WIDTH="100%">', "\n";
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub printGroepHeader {
  my ($title, $show) = @_;

  if ($show) {
    $groupFullView = $groupCondensedView = 0;

applications/display.pl  view on Meta::CPAN

  }
</script>
EOH

  if ($playSoundStatus) {
    print HTML <<EOH;
<script language="JavaScript" type="text/javascript">
  var soundState = getSoundCookie( 'soundState' );

  if ( soundState != null && soundState == 'on' ) {
    playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
    dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
  }
</script>
EOH
  }

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  print HTMLCV '</TABLE>', "\n";

applications/display.pl  view on Meta::CPAN

  }
</script>
EOH

  if ($playSoundStatus) {
    print HTMLCV <<EOH;
<script language="JavaScript" type="text/javascript">
  var soundState = getSoundCookie( 'soundState' );

  if ( soundState != null && soundState == 'on' ) {
    playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
    dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
  }
</script>
EOH
  }

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  print HTMLMCV '</TABLE>', "\n";

applications/display.pl  view on Meta::CPAN

  }
</script>
EOH

  if ($playSoundStatus) {
    print HTMLMCV <<EOH;
<script language="JavaScript" type="text/javascript">
  var soundState = getSoundCookie( 'soundState' );

  if ( soundState != null && soundState == 'on' ) {
    playSound = '<embed src="$HTTPSURL/sound/$SOUND{$playSoundStatus}" width="" height="" alt="" hidden="true" autostart="true" loop="false"><\\/embed>';
    dynamicContentNS4NS6FF ('SoundStatus', playSound, 1);
  }
</script>
EOH
  }
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub maskPassword {

applications/htmlroot/CalendarPopup.js  view on Meta::CPAN

function CP_setReturnQuarterFunction(name){this.returnQuarterFunction = name;}
function CP_setReturnYearFunction(name){this.returnYearFunction = name;}
function CP_setMonthNames(){for(var i=0;i<arguments.length;i++){this.monthNames[i] = arguments[i];}this.copyMonthNamesToWindow();}
function CP_setMonthAbbreviations(){for(var i=0;i<arguments.length;i++){this.monthAbbreviations[i] = arguments[i];}this.copyMonthNamesToWindow();}
function CP_setDayHeaders(){for(var i=0;i<arguments.length;i++){this.dayHeaders[i] = arguments[i];}}
function CP_setWeekStartDay(day){this.weekStartDay = day;}
function CP_showYearNavigation(){this.isShowYearNavigation =(arguments.length>0)?arguments[0]:true;}
function CP_setDisplayType(type){if(type!="date"&&type!="week-end"&&type!="month"&&type!="quarter"&&type!="year"){alert("Invalid display type! Must be one of: date,week-end,month,quarter,year");return false;}this.displayType=type;}
function CP_setYearSelectStartOffset(num){this.yearSelectStartOffset=num;}
function CP_setDisabledWeekDays(){this.disabledWeekDays = new Object();for(var i=0;i<arguments.length;i++){this.disabledWeekDays[arguments[i]] = true;}}
function CP_addDisabledDates(start, end){if(arguments.length==1){end=start;}if(start==null && end==null){return;}if(this.disabledDatesExpression!=""){this.disabledDatesExpression+= "||";}if(start!=null){start = parseDate(start);start=""+start.getFull...
function CP_setTodayText(text){this.todayText = text;}
function CP_setCssPrefix(val){this.cssPrefix = val;}
function CP_showNavigationDropdowns(){this.isShowNavigationDropdowns =(arguments.length>0)?arguments[0]:true;}
function CP_showYearNavigationInput(){this.isShowYearNavigationInput =(arguments.length>0)?arguments[0]:true;}
function CP_hideCalendar(){if(arguments.length > 0){window.popupWindowObjects[arguments[0]].hidePopup();}else{this.hidePopup();}}
function CP_refreshCalendar(index){var calObject = window.popupWindowObjects[index];if(arguments.length>1){calObject.populate(calObject.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]));}else{calObject.populate(calObject....
function CP_showCalendar(anchorname){if(arguments.length>1){if(arguments[1]==null||arguments[1]==""){this.currentDate=new Date();}else{this.currentDate=new Date(parseDate(arguments[1]));}}this.populate(this.getCalendar());this.showPopup(anchorname);}
function CP_select(inputobj, linkname, format){var selectedDate=(arguments.length>3)?arguments[3]:null;if(!window.getDateFromFormat){alert("calendar.select: To use this method you must also include 'date.js' for date formatting");return;}if(this.disp...
function getCalendarStyles(){var result = "";var p = "";if(this!=null && typeof(this.cssPrefix)!="undefined" && this.cssPrefix!=null && this.cssPrefix!=""){p=this.cssPrefix;}result += "<STYLE>\n";result += "."+p+"cpYearNavigation,."+p+"cpMonthNavigat...
function CP_getCalendar(){var now = new Date();if(this.type == "WINDOW"){var windowref = "window.opener.";}else{var windowref = "";}var result = "";if(this.type == "WINDOW"){result += "<HTML><HEAD><TITLE>Calendar</TITLE>"+this.getStyles()+"</HEAD><BO...

applications/htmlroot/JSFX_Halloween.js  view on Meta::CPAN

	JSFX.Browser.getMaxY		= function() {
			return(document.body.scrollTop
				+document.body.clientHeight);
	}
} 
/*** END OF CODE FROM JSFX.Browser.js ***/
/*** START OF CODE FROM JSFX.Ghosts.js ***/

JSFX.Halloween = new Object();
JSFX.Halloween.Ghosts = new Array();
JSFX.Halloween.start = function()
{
	if(JSFX.Halloween.theTimer == null)
	{
		JSFX.Halloween.theTimer = setTimeout("JSFX.Halloween.animateAll()", 40);
	}
}
JSFX.Halloween.animateAll = function()
{
	JSFX.Halloween.theTimer = setTimeout("JSFX.Halloween.animateAll()", 40);
	var sp = JSFX.Halloween.Ghosts;

applications/htmlroot/JSFX_Halloween.js  view on Meta::CPAN

	myGhost.h = 30;
	myGhost.targetX = Math.random()*JSFX.Browser.getMaxX();
	myGhost.targetY = Math.random()*JSFX.Browser.getMaxY();
	myGhost.state = "off"
	myGhost.animate = JSFX.animateGhosts;
	myGhost.hide();
	myGhost.setOpacity(this.op);
	myGhost.moveTo(myGhost.x,myGhost.y);
	myGhost.setzIndex(100+JSFX.Halloween.Ghosts.length);
	JSFX.Halloween.Ghosts[JSFX.Halloween.Ghosts.length] = myGhost;
	JSFX.Halloween.start();
}
JSFX.animateGhosts = function()
{
	if(this.state == "off")
	{
		if(Math.random() > .99)
		{
			this.state="up";
			this.show();
		}

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN

  my $command  = "cat $APPLICATIONPATH/tools/templates/CollectorCT-template.sh >> $filename";

  my $rvOpen = open(CollectorCT, ">$filename");

  if ($rvOpen) {
    print CollectorCT <<STARTUPFILE;
#!/bin/bash
# ---------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping

AMNAME=\"Collector ASNMTAP $collectorDaemon\"
AMPATH=$serverASNMTAP_PATH/applications
AMCMD=collector.pl
AMPARA=\"--hostname=$databaseFQDN --mode=$mode --collectorlist=CollectorCT-$collectorDaemon --dumphttp=$dumphttp --status=$status --debug=$debugDaemon --screenDebug=$debugAllScreen --allDebug=$debugAllFile --nokDebug=$debugNokFile\"
PIDPATH=$serverASNMTAP_PATH/pid
PIDNAME=CollectorCT-$collectorDaemon.pid

if [ -f ~/.profile ]; then
  source ~/.profile

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN


  $filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/asnmtap-collector.sh";
  $rvOpen = open(AsnmtapCollectorCTscript, ">$filename");

  if ($rvOpen) {
    print AsnmtapCollectorCTscript <<STARTUPFILE;
#!/bin/sh
# ---------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping

AMNAME=\"All ASNMTAP Collectors\"
AMPATH=$serverASNMTAP_PATH/applications/$subdir

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

STARTUPFILE

    foreach my $choise ('start', 'stop', 'reload', 'restart', 'status') {
      print AsnmtapCollectorCTscript <<STARTUPFILE;
$choise() {
  # $choise daemons
  echo "\u$choise: '\$AMNAME' ..."
  cd \$AMPATH
STARTUPFILE

      my ($hostname, undef) = split (/\./, $serverFQDN, 2);
      my ($hostnameAdminCollector, undef) = split (/\./, $serverAdminCollectorFQDN, 2);

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN

}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

STARTUPFILE
    }

    print AsnmtapCollectorCTscript <<STARTUPFILE;
# See how we were called.
case "\$1" in
  start)
           start
           ;;
  stop)
           stop
           ;;
  reload)
           reload
           ;;
  restart)
           restart
           ;;
  status)
           status
           ;;
  *)
           echo "Usage: '\$AMNAME' {start|stop|reload|restart|status}"
           exit 1
esac

exit 0

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE

    close (AsnmtapCollectorCTscript);
  }

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN

  my $command  = "cat $APPLICATIONPATH/tools/templates/DisplayCT-template.sh >> $filename";

  my $rvOpen = open(DisplayCT, ">$filename");

  if ($rvOpen) {
    print DisplayCT <<STARTUPFILE;
#!/bin/bash
# ---------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping

AMNAME=\"Display ASNMTAP $displayDaemon\"
AMPATH=$serverASNMTAP_PATH/applications
AMCMD=display.pl
AMPARA=\"--hostname=$databaseFQDN --checklist=DisplayCT-$displayDaemon --pagedir=$pagedirs --loop=$loop --trigger=$trigger --displayTime=$displayTime --lockMySQL=$lockMySQL --debug=$debugDaemon\"
PIDPATH=$serverASNMTAP_PATH/pid
PIDNAME=DisplayCT-$displayDaemon.pid
SOUNDCACHENAME=DisplayCT-$displayDaemon-sound-status.cache

if [ -f ~/.profile ]; then

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN


  $filename = "$APPLICATIONPATH/tmp/$CONFIGDIR/generated/$typeMonitoringCharDorC$typeServersCharMorS-$typeActiveServer-$serverFQDN/$subdir/asnmtap-display.sh";
  $rvOpen = open(AsnmtapDisplayCTscript, ">$filename");

  if ($rvOpen) {
    print AsnmtapDisplayCTscript <<STARTUPFILE;
#!/bin/sh
# ---------------------------------------------------------------
# © Copyright $COPYRIGHT Alex Peeters [alex.peeters\@citap.be]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping

AMNAME=\"All ASNMTAP Displays\"
AMPATH=$serverASNMTAP_PATH/applications/$subdir

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

STARTUPFILE

    foreach my $choise ('start', 'stop', 'reload', 'restart', 'status') {
      print AsnmtapDisplayCTscript <<STARTUPFILE;
$choise() {
  # $choise daemons
  echo "\u$choise: '\$AMNAME' ..."
  cd \$AMPATH
STARTUPFILE

      if ($typeServersCharMorS eq $typeActiveServer or $choise eq 'stop') {
        foreach my $matchingAsnmtapDisplayCTscript (@matchingAsnmtapDisplayCTscript) { print AsnmtapDisplayCTscript "  ./$matchingAsnmtapDisplayCTscript $choise\n"; }
      }

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN

}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

STARTUPFILE
    }

    print AsnmtapDisplayCTscript <<STARTUPFILE;
# See how we were called.
case "\$1" in
  start)
           start
           ;;
  stop)
           stop
           ;;
  reload)
           reload
           ;;
  restart)
           restart
           ;;
  status)
           status
           ;;
  *)
           echo "Usage: '\$AMNAME' {start|stop|reload|restart|status}"
           exit 1
esac

exit 0

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STARTUPFILE

    close (AsnmtapDisplayCTscript);
  }

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN

		  if (($generated =~ /^DisplayCT-[\w-]+.sh$/) or ($generated =~ /^CollectorCT-[\w-]+.sh$/)) {
            $commands {$server} {CHMOD} {++$_id} {auto} = 1;
            $commands {$server} {CHMOD} {$_id} {label} = '+b';
            $commands {$server} {CHMOD} {$_id} {active} = $active;
            $commands {$server} {CHMOD} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server chmod 755 ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$subpath$generated";
            $compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {CHMOD} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );

            $commands {$server} {START} {++$_id} {auto} = 1;
            $commands {$server} {START} {$_id} {label} = '+c';
            $commands {$server} {START} {$_id} {active} = $active;
            $commands {$server} {START} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } ."/applications/$subpath$generated start";
            $compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {START} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
          } elsif (($generated =~ /rsync-wrapper-distributed-[\w\-.]+.sh$/) or ($generated =~ /rsync-wrapper-failover-[\w\-.]+.sh$/)) {
            $commands {$server} {TODO} {++$_id} {auto} = 0;
            $commands {$server} {TODO} {$_id} {label} = '+d';
            $commands {$server} {TODO} {$_id} {active} = $active;
            $commands {$server} {TODO} {$_id} {command} = "'$generated' ?";
            $compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
            $todo = 1;
          } elsif (($generated =~ /rsync-mirror-failover-[\w\-.]+.sh$/) or ($generated =~ /rsync-mirror-distributed-[\w\-.]+.sh$/)) {
            $commands {$server} {TODO} {++$_id} {auto} = 0;

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN

          $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;

applications/htmlroot/cgi-bin/admin/generateConfig.pl  view on Meta::CPAN

 		  } elsif (($filename =~ /^(slave|master)\/asnmtap-display.sh$/)   or ($filename =~ /^(slave|master)\/asnmtap-collector.sh$/)) {
            $commands {$server} {TODO} {++$_id} {auto} = 0;
            $commands {$server} {TODO} {$_id} {label} = '=c';
            $commands {$server} {TODO} {$_id} {active} = $active;
            $commands {$server} {TODO} {$_id} {command} = "'$filename' ?";
            $compareText .= '<br><FONT COLOR="yellow"> ['. $_id .'] '. $commands {$server} {TODO} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
		  } elsif (($filename =~ /^(slave|master)\/DisplayCT-[\w-]+\.sh$/) or ($filename =~ /^(slave|master)\/CollectorCT-[\w-]+\.sh$/)) {
            $commands {$server} {START} {++$_id} {auto} = 0;
            $commands {$server} {START} {$_id} {label} = '=d';
            $commands {$server} {START} {$_id} {active} = $active;
            $commands {$server} {START} {$_id} {command} = "$SSHCOMMAND $connectArguments $SSHLOGONNAME\@$server ". $ASNMTAP_PATH { substr ($type, -1, 1) } { $server } .'/applications/'. ( ($type eq 'CM' or $type eq 'DM') ? 'master' : 'slave' ) ."/$f...
            $compareText .= '<br><FONT COLOR="#99CC99"> ['. $_id .'] '. $commands {$server} {START} {$_id} {command} .'</FONT>' if ( $debug eq 'T' );
        # } elsif ( $filename =~ /^master\/rsync-mirror-failover-[\w\-.]+.conf$/ or $filename =~ /^slave\/rsync-mirror-failover-[\w\-.]+.conf$/) {
            # deze bestanden worden reeds gecopieerd door middel van bovenstaande SCP in deze sectie
          }
        }
      } elsif ( $compareView =~ /^diff: installed: No such file or directory/ ) {
        $compareText = "The installed configuration doesn't exist.";
      } elsif ( $compareView =~ /^diff: generated: No such file or directory/ ) {
        $compareText = "The generated configuration doesn't exist.";
      } else {

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$PROGNAME       = "detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl";
my $prgtext     = "Detailed Statistics, Report Generation And Compare Response Time Trends";
my $version     = do { my @r = (q$Revision: 3.002.003$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; # must be all on one line or MakeMaker will get confused.

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

my ($localYear, $localMonth, $currentYear, $currentMonth, $currentDay, $currentHour, $currentMin, $currentSec) = ((localtime)[5], (localtime)[4], ((localtime)[5] + 1900), ((localtime)[4] + 1), (localtime)[3,2,1,0]);
my $now         = "$currentYear-$currentMonth-$currentDay ($currentHour:$currentMin:$currentSec)";
my $startTime   = timelocal($currentSec, $currentMin, $currentHour, $currentDay, $localMonth, $localYear);
my $endDate;

# URL Access Parameters
my $cgi = new CGI;
my $pagedir          = (defined $cgi->param('pagedir'))         ? $cgi->param('pagedir')         : 'index'; $pagedir =~ s/\+/ /g;
my $pageset          = (defined $cgi->param('pageset'))         ? $cgi->param('pageset')         : 'index-cv'; $pageset =~ s/\+/ /g;
my $debug            = (defined $cgi->param('debug'))           ? $cgi->param('debug')           : 'F';
my $selDetailed      = (defined $cgi->param('detailed'))        ? $cgi->param('detailed')        : 'on';
my $CcatalogID       = (defined $cgi->param('catalogID'))       ? $cgi->param('catalogID')       : $CATALOGID;
my $CcatalogIDreload = (defined $cgi->param('catalogIDreload')) ? $cgi->param('catalogIDreload') : 0;
my $uKey1            = (defined $cgi->param('uKey1'))           ? $cgi->param('uKey1')           : 'none';
my $uKey2            = (defined $cgi->param('uKey2'))           ? $cgi->param('uKey2')           : 'none';
my $uKey3            = (defined $cgi->param('uKey3'))           ? $cgi->param('uKey3')           : 'none';
my $startDate        = (defined $cgi->param('startDate'))       ? $cgi->param('startDate')       : "$currentYear-$currentMonth-$currentDay";
my $inputType        = (defined $cgi->param('inputType'))       ? $cgi->param('inputType')       : 'fromto';
my $selYear          = (defined $cgi->param('year'))            ? $cgi->param('year')            : 0;
my $selWeek          = (defined $cgi->param('week'))            ? $cgi->param('week')            : 0;
my $selMonth         = (defined $cgi->param('month'))           ? $cgi->param('month')           : 0;
my $selQuarter       = (defined $cgi->param('quarter'))         ? $cgi->param('quarter')         : 0;
my $timeperiodID     = (defined $cgi->param('timeperiodID'))    ? $cgi->param('timeperiodID')    : 1;
my $statuspie        = (defined $cgi->param('statuspie'))       ? $cgi->param('statuspie')       : 'off';
my $errorpie         = (defined $cgi->param('errorpie'))        ? $cgi->param('errorpie')        : 'off';
my $bar              = (defined $cgi->param('bar'))             ? $cgi->param('bar')             : 'off';
my $hourlyAvg        = (defined $cgi->param('hourlyAvg'))       ? $cgi->param('hourlyAvg')       : 'off';

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

my ($pageDir, $environment) = split (/\//, $pagedir, 2);
$environment = 'P' unless (defined $environment);

if ( defined $cgi->param('endDate') and $cgi->param('endDate') ) { $endDate = $cgi->param('endDate'); } else { $endDate = ''; }
my $htmlTitle   = ( ( $selDetailed eq 'on' ) ? 'Detailed Statistics and Report Generation' : 'Compare Response Time Trends' );

# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'guest', $c...

# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&detailed=$selDetailed&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&uKey1=$uKey1&uKey2=$uKey2&uKey3=$uKey3&startDate=$startDate&endDate=$endDate&...

# Debug information
print "<pre>pagedir     : $pagedir<br>pageset     : $pageset<br>debug       : $debug<br>CGISESSID   : $sessionID<br>detailed    : $selDetailed<br>catalog ID  : $CcatalogID<br>catalog ID reload : $CcatalogIDreload<br>uKey1       : $uKey1<br>uKey2     ...

unless ( defined $errorUserAccessControl ) {
  if ( $formatOutput eq 'pdf' and ! $htmlToPdf ) {
    my $url = "$HTTPSURL/cgi-bin/htmlToPdf.pl?HTMLtoPDFprg=$HTMLTOPDFPRG&amp;HTMLtoPDFhow=$HTMLTOPDFHOW&amp;scriptname=". $ENV{SCRIPT_NAME} ."&amp;". encode_html_entities('U', $urlAccessParameters);

    print <<EndOfHtml;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
<html>
<head>
  <title>$htmlTitle</title>

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

</BODY>
</HTML>
EndOfHtml

    exit;
  }

  my ($rv, $dbh, $sth, $uKey, $sqlQuery, $sqlSelect, $sqlAverage, $sqlInfo, $sqlErrors, $sqlWhere, $sqlPeriode);
  my ($printerFriendlyOutputBox, $formatOutputSelect, $catalogIDSelect, $uKeySelect1, $uKeySelect2, $uKeySelect3, $images);
  my ($subtime, $endTime, $duration, $seconden, $status, $statusMessage, $title, $Title, $shortDescription, $rest, $dummy, $count);
  my ($averageQ, $numbersOfTestsQ, $startDateQ, $stepQ, $endDateQ, $errorMessage, $chartOrTableChecked);
  my ($checkbox, $tables, $shortDescriptionTextArea, $infoTable, $topxTable, $errorList, $errorDetailList, $commentDetailList, $perfdataDetailList, $responseTable, $goodDate);
  my ($fromto, $years, $weeks, $months, $quarters, $slaWindows, $selectedYear, $selectedWeek, $selectedMonth, $selectedQuarter, $slaWindow, $i);
  my @arrMonths = qw(January Februari March April May June July August September October November December);

  # open connection to database and query data
  $rv  = 1;
  $dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADONLY:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, ...

  if ( $dbh and $rv ) {
    $uKey1 = $uKey2 = $uKey3 = 'none' if ( $CcatalogIDreload );

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

      $checkbox .= "        <input type=\"checkbox\" name=\"dailyAvg\"$dummy> Daily Average (long term stats)";

      $dummy = ($pf eq 'on') ? ' checked' : '';
      $printerFriendlyOutputBox = "<input type=\"checkbox\" name=\"pf\"$dummy> Printer friendly output\n";

      my $comboboxSelectKeysAndValuesPairs = 'html=>HTML';
      $comboboxSelectKeysAndValuesPairs .= '|pdf=>PDF' if ( $HTMLTOPDFPRG ne '<nihil>' and $HTMLTOPDFHOW ne '<nihil>' );
      $formatOutputSelect = create_combobox_from_keys_and_values_pairs ($comboboxSelectKeysAndValuesPairs, 'V', 0, $formatOutput, 'formatOutput', '', '', '', '', $debug);

      my ($numberOfDays, $sqlStartDate, $sqlEndDate, $yearFrom, $monthFrom, $dayFrom, $yearTo, $monthTo, $dayTo);
      ($goodDate, $sqlStartDate, $sqlEndDate, $numberOfDays) = get_sql_startDate_sqlEndDate_numberOfDays_test ($STRICTDATE, $FIRSTSTARTDATE, $inputType, $selYear, $selQuarter, $selMonth, $selWeek, $startDate, $endDate, $currentYear, $currentMonth, $c...
      $errorMessage .= "<br><font color=\"Red\">Wrong Startdate and/or Enddate</font><br>" unless ( $goodDate );

      if ( $selDetailed eq 'on' ) {
        if ($details eq 'on') {
          $dummy = " checked";
          $chartOrTableChecked = 1;
        } else {
          $dummy = '';
        }

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

          $dummy = " checked";
          $chartOrTableChecked = 1;
        } else {
          $dummy = '';
        }

        $tables .= "        <input type=\"checkbox\" name=\"topx\"$dummy> Show Top 20 Slow tests<br>";

        # Sql init & Query's  - - - - - - - - - - - - - - - - - - - - - -
        if ((($details eq 'on') or ($comments eq 'on') or ($perfdata eq 'on') or ($topx eq 'on')) and ! defined $errorMessage) {
          $sqlSelect  = "select SQL_NO_CACHE startDate as startDateQ, startTime, endDate as endDateQ, endTime, duration, status, statusMessage";
          $sqlAverage = "select SQL_NO_CACHE avg(time_to_sec(duration)) as average";
          $sqlErrors  = "select SQL_NO_CACHE statusmessage, count(statusmessage) as aantal";
          $sqlWhere   = "WHERE catalogID='$CcatalogID' and uKey = '$uKey1'";
          $sqlPeriode = "AND startDate BETWEEN '$sqlStartDate' AND '$sqlEndDate' $sqlPeriode " if (defined $sqlStartDate and defined $sqlEndDate);
        }

        my ($numbersOfTests, $step, $average);
        my $forceIndex = "force index (key_startDate)"; $forceIndex = '';

        # Short Description - - - - - - - - - - - - - - - - - - - - - - - -
        if ( $uKey1 ne 'none' ) {
          $sqlQuery = "select SQL_NO_CACHE shortDescription from $SERVERTABLPLUGINS WHERE catalogID = '$CcatalogID' and uKey = '$uKey1'";
          $sth = $dbh->prepare( $sqlQuery ) or $rv = error_trap_DBI("", "Cannot dbh->prepare: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID);
          $sth->execute() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;

          if ( $rv ) {
            ($shortDescription) = $sth->fetchrow_array() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;
            $sth->finish() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID);

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN


            $sth = $dbh->prepare( $sqlQuery ) or $rv = error_trap_DBI("", "Cannot dbh->prepare: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID);
            $sth->execute() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;
            $sth->bind_columns( \$metric_id, \$metric, \$times, \$percentiles, \$unit, \$Unit ) or $rv = error_trap_DBI("", "Cannot sth->bind_columns: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;

            if ( $rv ) {
              if ($sth->rows) {
                my $sqlPeriodePERFDATA = $sqlPeriode;

                if ( $PERFPARSEVERSION eq '20' ) {
                  $sqlPeriodePERFDATA  =~ s/^AND startDate BETWEEN '(\d+-\d+-\d+)' AND '(\d+-\d+-\d+)'/AND FROM_UNIXTIME\(ctime\) BETWEEN '$1 00:00:00' AND '$2 23:59:59'/g;
                  $sqlPeriodePERFDATA  =~ s/(startDate|startTime) BETWEEN/TIME\(FROM_UNIXTIME\(ctime\)\) BETWEEN/g;
                  $sqlPeriodePERFDATA  =~ s/(startDate|startTime)/FROM_UNIXTIME\(ctime\)/g;
                } else {
                  $sqlPeriodePERFDATA  =~ s/^AND startDate BETWEEN '(\d+-\d+-\d+)' AND '(\d+-\d+-\d+)'/AND ctime BETWEEN '$1 00:00:00' AND '$2 23:59:59'/g;
                  $sqlPeriodePERFDATA  =~ s/(startDate|startTime) BETWEEN/TIME\(ctime\) BETWEEN/g;
                  $sqlPeriodePERFDATA  =~ s/(startDate|startTime)/ctime/g;
                }

                my $groupPERFDATA       = ( $inputType eq 'fromto' ) ? 'dayofmonth' : $inputType; # 'dayofmonth' < 4.1.1 <= 'dayofmonth' or 'day' !!!
                my $percentagePERFDATA  = ( $inputType eq 'fromto' and $startDate ne $endDate ) ? 0 : 1;

  	            $perfdataDetailList .= "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\">\n";

                while( $sth->fetch() ) {
    	            $perfdataDetailList .= "<tr><th>&nbsp;$groupPERFDATA&nbsp;</th><th align=\"left\">&nbsp;$metric&nbsp;</th><th>&nbsp;Expression&nbsp;</th></tr>\n";
                  $times = ( defined $times and $times ne '' ) ? '0,'. $times : '0'; 

                  my $sqlValuePERFDATA = '';
                  my $countRows = 0;

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

                            $percentilePERFPARSE = "( $FR * ( $value2 - $value1 ) + $value1 ) = $percentilePERFPARSE" if ( $debug eq 'T' );
                            $perfdataDetailList .= "<tr bgcolor=\"$bgcolor\"><td align=\"right\">&nbsp;$periodePERFPARSE&nbsp;</td><td align=\"right\">&nbsp;$percentilePERFPARSE&nbsp;</td><td>&nbsp;$percentile&nbsp;ste&nbsp;percentile&nbsp;</td></tr>...
                          } elsif ( $debug eq 'T' ) {
                            $perfdataDetailList .= "<tr bgcolor=\"$bgcolor\"><td align=\"right\">&nbsp;</td><td align=\"right\">&nbsp;missing data&nbsp;</td><td>&nbsp;$percentile&nbsp;ste&nbsp;percentile&nbsp;</td></tr>\n";
                          }

                          $sthPERFPARSE->finish() or $rv = error_trap_DBI("", "Cannot sth->finish", $debug, '', "", '', "", -1, '', $sessionID);
                        }
                      }
                    } else {
                      $perfdataDetailList .= "<tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td colspan=\"3\">&nbsp;ASNMTAP/Performance Data: percentile not supported when $startDate ne $endDate&nbsp;</td></tr>\n";
                    }
                  } else {
                    $perfdataDetailList .= "<tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td colspan=\"2\">&nbsp;ASNMTAP/Performance Data: unit not supported&nbsp;%&nbsp;</td><td>&nbsp;$unit/$Unit&nbsp;</td></tr>\n";
                  }
                }

                $perfdataDetailList .= "</table>\n";
              } else {
                $perfdataDetailList .= "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><td width=\"400\">No Performance Data defined!</td></tr></table>";
              }

              $sth->finish() or $rv = error_trap_DBI("", "Cannot sth->finish", $debug, '', "", '', "", -1, '', $sessionID);
            }
          }
        }

        if ($details eq 'on' and ! defined $errorMessage) {
          # Problem Detail  - - - - - - - - - - - - - - - - - - - - - - - -
          my ($oneblock, $block, $firstrun, $nstartDateQ, $nstartTime, $nendDateQ, $nendTime, $nseconden);
          my ($test, $resultsdir, $tel, $wtel, $nstatus, $nrest, $nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $rrest);

          $errorDetailList = "<H1>Problem Details</H1>\n";
          $responseTable = "<H1>Response time warnings</H1>\n";

          $sqlQuery = "select SQL_NO_CACHE test, resultsdir from $SERVERTABLPLUGINS $sqlWhere";
          $sth = $dbh->prepare( $sqlQuery ) or $rv = error_trap_DBI("", "Cannot dbh->prepare: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID);
          $sth->execute() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;

          if ( $rv ) {
            ($test, $resultsdir) = $sth->fetchrow_array() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;
            $sth->finish() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID);

            if ( $rv ) {
              ($test, undef) = split(/\.pl/, $test);
	  
              $sqlQuery = create_sql_query_events_from_range_year_month ($inputType, $sqlStartDate, $sqlEndDate, $sqlSelect, $forceIndex, $sqlWhere, $sqlPeriode, "AND status <> 'OK' AND status <> 'OFFLINE' AND status <> 'NO TEST'", '', "", "order by ...
              $sth = $dbh->prepare( $sqlQuery ) or $rv = error_trap_DBI("", "Cannot dbh->prepare: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID);
              $sth->execute() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;
              $sth->bind_columns( \$startDateQ, \$startTime, \$endDateQ, \$endTime, \$duration, \$status, \$statusMessage ) or $rv = error_trap_DBI("", "Cannot sth->bind_columns: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;
            }
          }

          if ( $rv ) {
            sub createLinkToDebugFile {
              my ($startDate, $startTime, $status, $statusMessage) = @_;

              my ($year, $month, $day) = split (/-/, $startDate);
              my ($hour, $min, $sec) = split (/:/, $startTime);

              if ( $formatOutput ne 'html' or $htmlToPdf ) {
                return ($statusMessage);
              } else {
                my $catalogID_uKey1 = ( ( $CcatalogID eq 'CID' ) ? '' : $CcatalogID .'_' ) . $uKey1;

                if (-e "$PREFIXPATH/$RESULTSDIR/$resultsdir/$DEBUGDIR/$year$month$day$hour$min$sec-$test-$catalogID_uKey1-$status.htm") {
                  return ("<A HREF=\"$RESULTSURL/$resultsdir/$DEBUGDIR/$year$month$day$hour$min$sec-$test-$catalogID_uKey1-$status.htm\" target=\"_blank\">$statusMessage</A>");
                } else {
                  return ($statusMessage);

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

            # ($rest, undef) = split(/\|/, $rest, 2) if (defined $rest); # remove performance data
              if (defined $rest) {
                my $_rest = reverse $rest;
                my ($_rest, undef) = reverse split(/\|/, $_rest, 2);
                my $rest = reverse $_rest;
              } 

              if ($firstrun) {
                $firstrun = 0;
              } else {
                ($oneblock, $block, $rrest, $dummy) = setBlockBGcolor ($oneblock, $status, $step, $startDateQ, $startTime, $nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $nstatus, $nrest);

                if ($rrest =~ /^Response/) {
                  $wtel++;
                  $responseTable .= "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><th width=\"40\"> # </th><th>Start</th><th>Stop</th><th>Duration</th><th>Status</th><th>Status Message</th...
                  $responseTable .= "<tr $block><td>$dummy$wtel</td><td> $nstartDateQ \@ $nstartTime</td><td>$nendDateQ \@ $nendTime</td><td align=\"center\">".$nseconden."s</td><td><font color=\"".$COLORS {$nstatus}."\"> ".encode_html_entities('S', ...
                } else {
                  $tel++;
                  $errorDetailList .= "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><th width=\"40\"> # </th><th>Start</th><th>Stop</th><th>Duration</th><th>Status</th><th>Status Message</...
                  $errorDetailList .= "<tr $block><td>$dummy$tel</td><td> $nstartDateQ \@ $nstartTime</td><td>$nendDateQ \@ $nendTime</td><td align=\"center\">".$nseconden."s</td><td><font color=\"".$COLORS{$nstatus}."\"> ".encode_html_entities('S', ...
                }
              }

              ($nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $nstartDateQ, $nstartTime, $nendDateQ, $nendTime, $nseconden, $nstatus, $nrest) = setPreviousValues ($startDateQ, $startTime, $endDateQ, $endTime, $seconden, $status, $rest);
            }

            if ($tel || $wtel) {
              ($oneblock, $block, $rrest, $dummy) = setBlockBGcolor ($oneblock, $status, 0, $startDateQ, $startTime, $nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $nstatus, $nrest);
  
              if ($rrest =~ /^Response/) {
                $wtel++;
                $responseTable .= "<tr $block><td>$dummy$wtel</td><td> $nstartDateQ \@ $nstartTime</td><td>$nendDateQ \@ $nendTime</td><td align=\"center\">".$nseconden."s</td><td><font color=\"".$COLORS {$nstatus}."\"> ".encode_html_entities('S', $n...
              } else {
                $tel++;
                $errorDetailList .= "<tr $block><td>$dummy$tel</td><td> $nstartDateQ \@ $nstartTime</td><td>$nendDateQ \@ $nendTime</td><td align=\"center\">".$nseconden."s</td><td><font color=\"".$COLORS {$nstatus}."\"> ".encode_html_entities('S', $...
              }
            }

            $responseTable .= "</table>\n<br>\n<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><td>Legende:</td><td>&nbsp;&nbsp;&nbsp;</td><td bgcolor=\"$COLORSTABLE{NOBLOCK}\">&nbsp;&nbsp;&nbsp;Single item...

            if ($tel) {
              $errorDetailList .= "</table>\n<br>\n<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><td>Legende:</td><td>&nbsp;&nbsp;&nbsp;</td><td bgcolor=\"$COLORSTABLE{NOBLOCK}\">&nbsp;&nbsp;&nbsp;Single ...
            } else {
              $errorDetailList .= "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><td width=\"400\">No problems for this period!</td></tr></table>\n";
            }

            $sth->finish() or $rv = error_trap_DBI("", "Cannot sth->finish", $debug, '', "", '', "", -1, '', $sessionID);
          }

          $sqlQuery = create_sql_query_events_from_range_year_month ($inputType, $sqlStartDate, $sqlEndDate, $sqlSelect, $forceIndex, $sqlWhere, $sqlPeriode, "AND status = 'OK' AND statusMessage regexp ': Response time [[:alnum:]]+.[[:alnum:]]+ > tre...
          $sth = $dbh->prepare( $sqlQuery ) or $rv = error_trap_DBI("", "Cannot dbh->prepare: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID);
          $sth->execute() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;
          $sth->bind_columns( \$startDateQ, \$startTime, \$endDateQ, \$endTime, \$duration, \$status, \$statusMessage ) or $rv = error_trap_DBI("", "Cannot sth->bind_columns: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;

          if ( $rv ) {
            $oneblock = $wtel = 0; 

            while( $sth->fetch() ) {
              $seconden = int(substr($duration, 6, 2)) + int(substr($duration, 3, 2)*60) + int(substr($duration, 0, 2)*3600);
              (undef, $rest) = split(/:/, $statusMessage, 2);

            # ($rest, undef) = split(/\|/, $rest, 2) if (defined $rest); # remove performance data
              if (defined $rest) {
                my $_rest = reverse $rest;
                my ($_rest, undef) = reverse split(/\|/, $_rest, 2);
                my $rest = reverse $_rest;
              } 
							
              if ($wtel) {
                ($oneblock, $block, $rrest, $dummy) = setBlockBGcolor ($oneblock, $status, $step, $startDateQ, $startTime, $nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $nstatus, $nrest);
                $responseTable .= "<tr $block><td>$dummy$wtel</td><td> $nstartDateQ \@ $nstartTime</td><td>$nendDateQ \@ $nendTime</td><td align=\"center\">".$nseconden."s</td><td><font color=\"".$COLORS {$nstatus}."\"> " .encode_html_entities('S', $...
              } else {
                $responseTable .= "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><th width=\"40\"> # </th><th>Start</th><th>Stop</th><th>Duration</th><th>Status</th><th>Status Message</th><...
              }

              $wtel++;
              ($nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $nstartDateQ, $nstartTime, $nendDateQ, $nendTime, $nseconden, $nstatus, $nrest) = setPreviousValues ($startDateQ, $startTime, $endDateQ, $endTime, $seconden, $status, $rest);
            }

            if ($wtel) {
              ($oneblock, $block, $rrest, $dummy) = setBlockBGcolor ($oneblock, $status, 0, $startDateQ, $startTime, $nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $nstatus, $nrest);
              $responseTable .= "<tr $block><td>$dummy$wtel</td><td> $nstartDateQ \@ $nstartTime</td><td>$nendDateQ \@ $nendTime</td><td align=\"center\">".$nseconden."s</td><td><font color=\"".$COLORS {$nstatus}."\"> " .encode_html_entities('S', $ns...
              $responseTable .= "</table>\n<br>\n<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><td>Legende:</td><td>&nbsp;&nbsp;&nbsp;</td><td bgcolor=\"$COLORSTABLE{NOBLOCK}\">&nbsp;&nbsp;&nbsp;Single it...
            } else {
              $responseTable .= "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><td width=\"400\">No response time warnings for this period!</td></tr></table>\n";
            }

            $sth->finish() or $rv = error_trap_DBI("", "Cannot sth->finish", $debug, '', "", '', "", -1, '', $sessionID);
          }

          # Problem Summary - - - - - - - - - - - - - - - - - - - - - - -
          $sqlQuery = create_sql_query_events_from_range_year_month ($inputType, $sqlStartDate, $sqlEndDate, $sqlErrors, $forceIndex, $sqlWhere, $sqlPeriode, "AND status ='CRITICAL'", "GROUP BY statusmessage", '', "order by aantal desc, statusmessage...

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

            } else {
              $errorList .= "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><td width=\"400\">No errors for this period!</td></tr></table>";
            }

            $sth->finish() or $rv = error_trap_DBI("", "Cannot sth->finish", $debug, '', "", '', "", -1, '', $sessionID);
          }
        }

        if ($topx eq 'on' and ! defined $errorMessage) {
          # Top X List  - - - - - - - - - - - - - - - - - - - - - - - - -
          my ($startDatetx, $durationtx, $startTimetx);
          $sqlQuery = create_sql_query_events_from_range_year_month ($inputType, $sqlStartDate, $sqlEndDate, "select SQL_NO_CACHE startDate, startTime, duration", $forceIndex, $sqlWhere, $sqlPeriode, "and status <> 'OFFLINE' and status <> 'CRITICAL' ...
          $sth = $dbh->prepare( $sqlQuery ) or $rv = error_trap_DBI("", "Cannot dbh->prepare: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID);
          $sth->execute() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;
          $sth->bind_columns( \$startDatetx, \$startTimetx,\$durationtx ) or $rv = error_trap_DBI("", "Cannot sth->bind_columns: $sqlQuery", $debug, '', "", '', "", -1, '', $sessionID) if $rv;

          if ( $rv ) {
            $topxTable .= "<H1>Top 20 Slow Tests </H1>\n";
            $topxTable .= "\n<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><th width=\"40\"> # </th><th>Time</th><th>Duration</th></tr>\n";

            my $teltopx = 1;
	
            while( $sth->fetch() ) {
              $seconden = int(substr($durationtx, 6, 2)) + int(substr($durationtx, 3, 2)*60) + int(substr($durationtx, 0, 2)*3600);
              $topxTable .= "<tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td width=\"30\">$teltopx</td><td width=\"200\" align=\"center\">$startDatetx \@ $startTimetx</td><td width=\"80\" align=\"right\"><b>$seconden sec</b></td></tr>\n";
              $teltopx++;
            }			

            $topxTable .= "<tr><td width=\"400\">No top 20 slow tests for this period!</td></tr>\n" if ($teltopx == 1);
            $topxTable .= "</table>";
            $sth->finish() or $rv = error_trap_DBI("", "Cannot sth->finish", $debug, '', "", '', "", -1, '', $sessionID);
          }
        }
      }

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

  }

  if ( $rv ) {
    # HTML  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if ($htmlToPdf) {
      my ($type, $range);
		
      if ($inputType eq "fromto") {
        if ($endDate ne '')	{
          $type  = '';
          $range = "Between $startDate and $endDate";
        } else {
          $type  = ' Daily';
          $range = "Date $startDate";
        }
      } elsif ($inputType eq "year") {
        $type  = ' Yearly';
        $range = "Year $selYear";
      } elsif ($inputType eq "quarter") {
        $type  = ' Quarterly';
        $range = "Year $selYear, Quarter $selQuarter";
      } elsif ($inputType eq "month") {
        $type  = ' Monthly';
        $range = "Year $selYear, Month " .$arrMonths[$selMonth -1];

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

      print <<HTML;
      </td></tr><tr align="left"><td>$fromto</td>
      <td><SCRIPT LANGUAGE="JavaScript" type="text/javascript" ID="jsCal1Calendar">
            var cal1Calendar = new CalendarPopup("CalendarDIV");
            cal1Calendar.offsetX = 1;
            cal1Calendar.showNavigationDropdowns();
            cal1Calendar.addDisabledDates(null, "$firstYear-$firstMonth-$firstDay");
            cal1Calendar.addDisabledDates("$lastYear-$lastMonth-$lastDay", null);
          </SCRIPT>
          <DIV ID="CalendarDIV" STYLE="position:absolute;visibility:hidden;background-color:black;layer-background-color:black;"></DIV>
	      <input type="text" name="startDate" value="$startDate" size="10" maxlength="10">&nbsp;
		  <a href="#" onclick="cal1Calendar.select(document.forms[1].startDate, 'startDateCalendar','yyyy-MM-dd'); return false;" name="startDateCalendar" id="startDateCalendar"><img src="$IMAGESURL/cal.gif" alt="Calendar" border="0"> </a>&nbsp;&nbsp;
		  To: <input type="text" name="endDate" value="$endDate" size="10" maxlength="10">&nbsp;
		  <a href="#" onclick="cal1Calendar.select(document.forms[1].endDate, 'endDateCalendar','yyyy-MM-dd'); return false;" name="endDateCalendar" id="endDateCalendar"><img src="$IMAGESURL/cal.gif" alt="Calendar" border="0"> </a>
      </td></tr><tr align="left"><td valign="top">$years
      </td></tr><tr align="left"><td valign="top">$quarters
      </td></tr><tr align="left"><td valign="top">$months
      </td></tr><tr align="left"><td valign="top">$weeks
      </td></tr><tr align="left"><td valign="top">SLA Window:</td><td>$slaWindows
      </td></tr><tr align="left"><td valign="top">Charts:</td><td>$checkbox
HTML

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub setBlockBGcolor {
  my ($oneblock, $status, $step, $startDateQ, $startTime, $nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $nstatus, $nrest) = @_;

  my $block;

  if ($step == 0) {
    $block = ($oneblock) ? " bgcolor=\"$COLORSTABLE{ENDBLOCK}\" " : " bgcolor=\"$COLORSTABLE{NOBLOCK}\" ";
    $oneblock = 0;
  } else {
    my ($year, $month, $day) = split(/-/, $startDateQ);
    my ($hours, $minuts, $seconds) = split(/:/, $startTime);

    my ($ddays, $dhours, $dminuts, $dseconds) = Delta_DHMS ($nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $year, $month, $day, $hours, $minuts, $seconds);
    my $dtotsec = $dseconds + ($dminuts * 60) + ($dhours * 3600) + ($ddays * 86400);

    if (($dtotsec < ($step * 2.2)) and ($nstatus eq $status)) {
      $block = ($oneblock) ? " bgcolor=\"$COLORSTABLE{ENDBLOCK}\" " : " bgcolor=\"$COLORSTABLE{STARTBLOCK}\" ";
      $oneblock = 1;
    } else {
      $block = ($oneblock) ? " bgcolor=\"$COLORSTABLE{ENDBLOCK}\" " : " bgcolor=\"$COLORSTABLE{NOBLOCK}\" ";
      $oneblock = 0;

applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl  view on Meta::CPAN

    $rrest = '';
  }

  $rrest =~ s/^ +//g; 
  return ($oneblock, $block, $rrest, '');
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub setPreviousValues {
  my ($startDateQ, $startTime, $endDateQ, $endTime, $seconden, $status, $rest) = @_;

  my ($nyear, $nmonth, $nday) = split(/-/, $startDateQ);
  my ($nhours, $nminuts, $nseconds) = split(/:/, $startTime);
  return ($nyear, $nmonth, $nday, $nhours, $nminuts, $nseconds, $startDateQ, $startTime, $endDateQ, $endTime, $seconden, $status, $rest);
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

applications/htmlroot/cgi-bin/generateChart.pl  view on Meta::CPAN

my $cgi = new CGI;
my $pagedir      = (defined $cgi->param('pagedir'))      ? $cgi->param('pagedir')      : 'index';    $pagedir =~ s/\+/ /g;
my $pageset      = (defined $cgi->param('pageset'))      ? $cgi->param('pageset')      : 'index-cv'; $pageset =~ s/\+/ /g;
my $debug        = (defined $cgi->param('debug'))        ? $cgi->param('debug')        : 'F';
my $sessionID    = (defined $cgi->param('CGISESSID'))    ? $cgi->param('CGISESSID')    : '';
my $selChart     = (defined $cgi->param('chart'))        ? $cgi->param('chart')        : 'ErrorDetails';
my $CcatalogID   = (defined $cgi->param('catalogID'))    ? $cgi->param('catalogID')    : $CATALOGID;
my $uKey1        = (defined $cgi->param('uKey1'))        ? $cgi->param('uKey1')        : 'none';
my $uKey2        = (defined $cgi->param('uKey2'))        ? $cgi->param('uKey2')        : 'none';
my $uKey3        = (defined $cgi->param('uKey3'))        ? $cgi->param('uKey3')        : 'none';
my $startDateIN  = (defined $cgi->param('startDate'))    ? $cgi->param('startDate')    : 'none';
my $inputType    = (defined $cgi->param('inputType'))    ? $cgi->param('inputType')    : 'none';
my $selQuarter   = (defined $cgi->param('quarter'))      ? $cgi->param('quarter')      : 0;
my $selMonth     = (defined $cgi->param('month'))        ? $cgi->param('month')        : 0;
my $selWeek      = (defined $cgi->param('week'))         ? $cgi->param('week')         : 0;
my $selYear      = (defined $cgi->param('year'))         ? $cgi->param('year')         : 0;
my $timeperiodID = (defined $cgi->param('timeperiodID')) ? $cgi->param('timeperiodID') : 1;
my $pf           = (defined $cgi->param('pf'))           ? $cgi->param('pf')           : 'off';

# set: endDate
$endDateIN = $cgi->param('endDate') if ( $cgi->param('endDate') ne '' );

# set: debug
if ( $debug eq 'T' ) {
  $debugMessage = "chart: $selChart, uKey1: $uKey1, uKey2: $uKey2, uKey3: $uKey3, startDate: $startDateIN, endDate: $endDateIN, inputType: $inputType, selMonth: $selMonth, selWeek: $selWeek, selYear: $selYear.";
  $AreaBOffset += 18;
}

# set: colors
if ($pf eq 'on') {
  $background = 0xF7F7F7;
  $forGround  = 0x000000;
  $axisColor  = 0x0C0C0C;
} else {
  $background = 0x000000;
  $forGround  = 0xF7F7F7;
  $axisColor  = 0x0000FF;
}

# set: forceIndex
my $forceIndex = "force index (key_startDate)"; $forceIndex = '';

# Init return value to true
$rv = 1;

# Chart specific settings
if ( $selChart eq "Status" ) {
  $yOffset     = 0;
  $AreaBOffset = 0;
} elsif ( $selChart eq "ErrorDetails" ) {
  $hight       = 500;
  $yOffset     = 0;
  $AreaBOffset = 0;
} elsif ( $selChart eq "HourlyAverage" ) {
  my ($tmpStartDate, $tmpEndDate);
  ($goodDate, $tmpStartDate, $tmpEndDate, $numberOfDays) = get_sql_startDate_sqlEndDate_numberOfDays_test ($STRICTDATE, $FIRSTSTARTDATE, $inputType, $selYear, $selQuarter, $selMonth, $selWeek, $startDateIN, $endDateIN, $currentYear, $currentMonth, $c...

  unless ( $goodDate ) {
    $rv = 0; $errorMessage = "Wrong Startdate and/or Enddate";
  } elsif ( $numberOfDays > 7 ) {
    $rv = 0; $errorMessage = "Hourly Average Not Available";
  } else {
    ($yearFrom, $monthFrom, $dayFrom) = split (/-/, $tmpStartDate) if (defined $tmpStartDate);
    ($yearTo, $monthTo, $dayTo) = split (/-/, $tmpEndDate) if (defined $tmpEndDate);
  }
}

applications/htmlroot/cgi-bin/generateChart.pl  view on Meta::CPAN

        $chartTitle .= " from $CcatalogID ";
      }

      if ( $rv ) {
        my $addAreaBOffset = 22;
        $addAreaBOffset = 8  if ( $selChart eq "HourlyAverage" );
        $addAreaBOffset = 36 if ( $selChart eq "DailyAverage" );

        if ($inputType eq "fromto") {
          if ( defined $endDateIN ) {
            $chartTitle  .= "from $startDateIN to $endDateIN";
          } else {
            $chartTitle  .= "on $startDateIN";	
          }
        } elsif ( $inputType eq "year" ) {
          $chartTitle  .= "for $selYear";
        } elsif ( $inputType eq "quarter" ) {
          $chartTitle .= "for $selYear quarter $selQuarter";
        } elsif ( $inputType eq "month" ) {
          $chartTitle  .= "for ". $arrMonths[$selMonth -1] .' '. $selYear;
        } elsif ( $inputType eq "week" ) {
          $chartTitle .= "for $selYear week $selWeek from $CcatalogID";
        } else {
          $rv = 0; $errorMessage = "Whoops - title error! ($inputType)";
        }

        my ($sqlStartDate, $sqlEndDate);

        if ( $rv ) {
          $AreaBOffset += $addAreaBOffset;
         ($goodDate, $sqlStartDate, $sqlEndDate, undef) = get_sql_startDate_sqlEndDate_numberOfDays_test ($STRICTDATE, $FIRSTSTARTDATE, $inputType, $selYear, $selQuarter, $selMonth, $selWeek, $startDateIN, $endDateIN, $currentYear, $currentMonth, $cu...

          if ( $goodDate ) {
            $sqlPeriode = "AND startDate between '$sqlStartDate' AND '$sqlEndDate' ";

            if ( $timeperiodID > 1 ) {
              $sql = "select timeperiodName, sunday, monday, tuesday, wednesday, thursday, friday, saturday from $SERVERTABLTIMEPERIODS where catalogID = '$CcatalogID' and timeperiodID = '$timeperiodID'";
              $sth = $dbh->prepare( $sql ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot dbh->prepare: $sql", $debug, '', "", '', "", 0, '', $sessionID);
              $sth->execute() or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->execute: $sql", $debug, '', "", '', "", 0, '', $sessionID) if $rv;

              if ( $rv ) {
                ($slaWindow, my ($sunday, $monday, $tuesday, $wednesday, $thursday, $friday, $saturday)) = $sth->fetchrow_array() or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->fetchrow_array: $sql", $debug,...
                $sth->finish() or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->finish", $debug, '', "", '', "", 0, '', $sessionID);
                my $slaPeriode = create_sql_query_from_range_SLA_window ($sunday, $monday, $tuesday, $wednesday, $thursday, $friday, $saturday);

applications/htmlroot/cgi-bin/generateChart.pl  view on Meta::CPAN

                  push (@data, $problemSummary{$rest});
                  push (@labels, substr($rest, 1, 38));
                }
              } else {
			          $hight = 380; $rv = 0; $errorMessage = "NO ERRORS FOR THIS PERIOD";
              }

              $sth->finish() or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->finish", $debug, '', "", '', "", 0, '', $sessionID);
            }
          } elsif ( $selChart eq "Bar" ) {
            my ($seconden, $duration, $startDate, $startTime, $status, $step);
            my ($dataOK, $dataWarning, $dataCritical, $dataUnknown, $dataNoTest, $dataOffline);
            $sql = create_sql_query_events_from_range_year_month ($inputType, $sqlStartDate, $sqlEndDate, "select SQL_NO_CACHE duration, startDate, startTime, status, step", $forceIndex, "WHERE catalogID = '$CcatalogID' and uKey = '$uKey1'", $sqlPeri...
            $sth = $dbh->prepare( $sql ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot dbh->prepare: $sql", $debug, '', "", '', "", 0, '', $sessionID);
            $sth->execute() or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->execute: $sql", $debug, '', "", '', "", 0, '', $sessionID) if $rv;
            $sth->bind_columns( \$duration, \$startDate, \$startTime, \$status, \$step ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->bind_columns: $sql", $debug, '', "", '', "", 0, '', $sessionID) if $rv;

		        if ( $rv ) {
  		        if ( $sth->rows ) {
                my $counter = 0;
                $numberOfLabels = ($sth->rows < 25) ? $sth->rows : 25;
                my $labelCounter = int($sth->rows / $numberOfLabels);
                my $limitTrendvalue = ($trendvalue) ? $trendvalue * 2.5 : 9000;
                my $moreDays = (defined $endDateIN or $inputType eq "year" or $inputType eq "quarter" or $inputType eq "month" or $inputType eq "week") ? 1 : 0;

                while( $sth->fetch() ) {

applications/htmlroot/cgi-bin/generateChart.pl  view on Meta::CPAN

				
                  push (@dataOK,       $dataOK);
                  push (@dataWarning,  $dataWarning);
                  push (@dataCritical, $dataCritical);
                  push (@dataUnknown,  $dataUnknown);
                  push (@dataNoTest,   $dataNoTest);
                  push (@dataOffline,  $dataOffline);

                  if ($labelCounter == 1 or $labelCounter == $counter or ($counter == 0 and $labelCounter >= 2)) {
                    if ($moreDays) {
                      push (@labels, $startDate . " ~ " . substr($startTime, 0, 5));
                    } else {
                      push (@labels, substr($startTime, 0, 5));
                    }

                    $counter = 1;
                  } else {
                    push (@labels, "");
                    $counter++;
                  }
                }

                $AreaBOffset += 36 if ($moreDays);

applications/htmlroot/cgi-bin/generateChart.pl  view on Meta::CPAN

    }

    # Use the side label layout method
    $c->setLabelLayout($perlchartdir::SideLayout);
    $c->setLabelStyle("tahoma.ttf", 8, $forGround)->setBackground($perlchartdir::Transparent, $perlchartdir::Transparent, 0);
    $c->setLabelFormat("<*block,valign=absmiddle*><*img={field0}*> {label} (#{value} - {percent}%)");

    # Set the border color of the sector the same color as the fill color. Set the line color of the join line to forgroundcolor
    $c->setLineColor($perlchartdir::SameAsMainColor, $forGround);

    # Set the start angle to 135 degrees
    $c->setStartAngle(135);

    # Set the pie data and the pie labels
    $c->setData(\@data, \@labels);
  } else {
    # Set the labels on the x & y axis
    my $fontAngel = ( $selChart eq "HourlyAverage" ) ? 0 : 45;
    $c->xAxis()->setLabelStyle("Arial.ttf", 8, $forGround)->setFontAngle($fontAngel);
    $c->xAxis()->setLabels(\@labels);
    $c->yAxis()->setLabelStyle("Arial.ttf", 8, $forGround)->setFontAngle(0);
    $c->yAxis()->setLabelFormat("{value|2,.}");

    # Set the margins at the two ends of the axis during auto-scaling, and whether to start the axis from zero.
    $c->yAxis()->setAutoScale(5, 10, 0);

    # Add a mark line ore zone to the chart and add the first two data sets to the chart as a stacked bar group
    if ( $uKey2 eq 'none' and $uKey3 eq 'none' ) {
      $trendvalue = 3600 if ($trendvalue == 0);
      $trendvalue += 0.05;
      $c->yAxis()->addZone($trendvalue, 3600, $trendZone) if ($trendvalue != 0);
    }

    $c->yAxis()->addZone(0, -6, $trendZone);

applications/htmlroot/cgi-bin/generateChart.pl  view on Meta::CPAN

# Output the chart
binmode(STDOUT);
print "Content-type: image/png\n\n";
print $c->makeChart2($perlchartdir::PNG);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sub getAverage {
  my ($number, $dbh, $rv, $uKey, $sqlStartDate, $sqlEndDate, $sqlPeriode, $selChart, $debug) = @_;

  my ($sql, $sth, $errorMessage, $dbiErrorCode, $dbiErrorString, $startDate, $hour, $average, @avg, @labels);

  if ( $selChart eq "HourlyAverage" ) {
    $sql = create_sql_query_events_from_range_year_month ($inputType, $sqlStartDate, $sqlEndDate, "select SQL_NO_CACHE startDate, hour(startTime) as hour, round(avg(time_to_sec(duration)), 2)", $forceIndex, "WHERE catalogID = '$CcatalogID' and uKey =...
  } else {
    $sql = create_sql_query_events_from_range_year_month ($inputType, $sqlStartDate, $sqlEndDate, "select SQL_NO_CACHE startDate, round(avg(time_to_sec(duration)), 2)", $forceIndex, "WHERE catalogID = '$CcatalogID' and uKey = '$uKey'", $sqlPeriode, "...
  }

  $sth = $dbh->prepare( $sql ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot dbh->prepare: $sql", $debug, '', "", '', "", 0, '', $sessionID);
  $sth->execute() or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->execute: $sql", $debug, '', "", '', "", 0, '', $sessionID) if $rv;

  if ( $selChart eq "HourlyAverage" ) {
    $sth->bind_columns( \$startDate, \$hour, \$average ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->bind_columns: $sql", $debug, '', "", '', "", 0, '', $sessionID) if $rv;
  } else {
    $sth->bind_columns( \$startDate, \$average ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->bind_columns: $sql", $debug, '', "", '', "", 0, '', $sessionID) if $rv;
  }

  if ( $rv ) {
    if ( $sth->rows ) {
      while( $sth->fetch() ) {
        push (@avg, $average);

        if ( $selChart eq "HourlyAverage" ) {
          push (@labels, $startDate .":". $hour);
        } else {
          push (@labels, $startDate);
        }
      }
    } else {
      $hight = 380; $rv = 0; $errorMessage = "NO DATA FOR THIS PERIOD (3)";
    }

    $sth->finish() or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->finish", $debug, '', "", '', "", 0, '', $sessionID);
  }

  if ( $number == 1 ) {

applications/htmlroot/cgi-bin/htmlToPdf.pl  view on Meta::CPAN

my $scriptname   = (defined $cgi->param('scriptname'))   ? $cgi->param('scriptname')   : undef;
my $pagedir      = (defined $cgi->param('pagedir'))      ? $cgi->param('pagedir')      : ''; $pagedir =~ s/\+/ /g;
my $pageset      = (defined $cgi->param('pageset'))      ? $cgi->param('pageset')      : ''; $pageset =~ s/\+/ /g;
my $sessionID    = (defined $cgi->param('CGISESSID'))    ? $cgi->param('CGISESSID')    : undef;
my $debug        = (defined $cgi->param('debug'))        ? $cgi->param('debug')        : 'F';
my $selDetailed  = (defined $cgi->param('detailed'))     ? $cgi->param('detailed')     : 'on';
my $CcatalogID   = (defined $cgi->param('catalogID'))    ? $cgi->param('catalogID')    : $CATALOGID;
my $uKey1        = (defined $cgi->param('uKey1'))        ? $cgi->param('uKey1')        : 'none';
my $uKey2        = (defined $cgi->param('uKey2'))        ? $cgi->param('uKey2')        : 'none';
my $uKey3        = (defined $cgi->param('uKey3'))        ? $cgi->param('uKey3')        : 'none';
my $startDate    = (defined $cgi->param('startDate'))    ? $cgi->param('startDate')    : "$year-$month-$day";
my $inputType    = (defined $cgi->param('inputType'))    ? $cgi->param('inputType')    : 'fromto';
my $selYear      = (defined $cgi->param('year'))         ? $cgi->param('year')         : 0;
my $selWeek      = (defined $cgi->param('week'))         ? $cgi->param('week')         : 0;
my $selMonth     = (defined $cgi->param('month'))        ? $cgi->param('month')        : 0;
my $selQuarter   = (defined $cgi->param('quarter'))      ? $cgi->param('quarter')      : 0;
my $timeperiodID = (defined $cgi->param('timeperiodID')) ? $cgi->param('timeperiodID') : 1;
my $statuspie    = (defined $cgi->param('statuspie'))    ? $cgi->param('statuspie')    : 'off';
my $errorpie     = (defined $cgi->param('errorpie'))     ? $cgi->param('errorpie')     : 'off';
my $bar          = (defined $cgi->param('bar'))          ? $cgi->param('bar')          : 'off';
my $hourlyAvg    = (defined $cgi->param('hourlyAvg'))    ? $cgi->param('hourlyAvg')    : 'off';

applications/htmlroot/cgi-bin/htmlToPdf.pl  view on Meta::CPAN

if ( defined $cgi->param('endDate') and $cgi->param('endDate') ) { $endDate = $cgi->param('endDate'); } else { $endDate = ''; }

my $htmlTitle = "Convert HTML to PDF";
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&amp;pageset=$pageset&amp;debug=$debug&amp;CGISESSID=$sessionID&amp;detailed=$selDetailed&amp;catalogID=$CcatalogID&amp;uKey1=$uKey1&amp;uKey2=$uKey2&amp;uKey3=$uKey3&amp;startDate=$startDate&amp;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;

applications/htmlroot/cgi-bin/moderator/generateCollectorCrontabSchedulingReport.pl  view on Meta::CPAN


    $rv = 1;
  } else {
    $hight = $hightMin; $rv = 0; $errorMessage = "NO DATA FOR THIS PERIOD";
  }

  # open connection to database and query data
  $dbh = DBI->connect("DBI:mysql:$DATABASE:$SERVERNAMEREADONLY:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY" ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("Cannot connect to the database", $debug, '',...

  if ( $dbh and $rv ) {
    my ($startDate, $startTime, $endDate, $endTime, $status, $timeslot);

    my $uKeySQL = ( $CuKey ) ? "$SERVERTABLCRONTABS.uKey = '$CuKey'" : '';
    my $collectorDaemonSQL = ( $CcollectorDaemon ) ? "$SERVERTABLCRONTABS.collectorDaemon = '$CcollectorDaemon'" : '';
    my $sqlWhere = ( $uKeySQL and $collectorDaemonSQL ) ? "( $uKeySQL or $collectorDaemonSQL )" : (($uKeySQL) ? $uKeySQL : $collectorDaemonSQL);
    $sql = "select $SERVERTABLCRONTABS.collectorDaemon, $SERVERTABLCRONTABS.uKey, $SERVERTABLCRONTABS.lineNumber, $SERVERTABLCRONTABS.minute, $SERVERTABLCRONTABS.hour, $SERVERTABLCRONTABS.dayOfTheMonth, $SERVERTABLCRONTABS.monthOfTheYear, $SERVERTABL...
	($rv, $errorMessage, $dbiErrorCode, $dbiErrorString, $hight, $numberOfLabels) = get_sql_crontab_scheduling_report_data ($dbh, $sql, $rv, $errorMessage, $dbiErrorCode, $dbiErrorString, $sessionID, $hight, $hightMin, \%uKeys, \@labels, \@stepValue, $C...
    $dbh->disconnect or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("Sorry, the database was unable to disconnect", $debug, '', "", '', "", '', 0, '', $sessionID) if (defined $dbh) ;
  }

  if ( $rv ) {

applications/htmlroot/cgi-bin/moderator/generateCollectorCrontabSchedulingReport.pl  view on Meta::CPAN


              # the color for each timeslot bar
              push (@colorsTimeslot,     $COLORSRRD{'IN PROGRESS'});

              # the data points for each test result matching the corresponding label
              push (@dataPoints,         $uKeys{$uKey}->{numberOfLabel});

              my $endpointCurrentTimeslot = $currentDate + ($stepValue[$uKeys{$uKey}->{numberOfLabel}] * 60);
              my $restCurrentTimeslot = ($currentTimeslot eq 'off' and $endpointCurrentTimeslot > $sqlEndDate) ? $sqlEndDate : $endpointCurrentTimeslot;

              # the timeslot start dates and end dates for the tasks
              push (@crontabStartDate,   perlchartdir::chartTime2($currentDate));
              push (@crontabEndDate,     perlchartdir::chartTime2($currentDate + $step));
              push (@crontabEndTimeslot, perlchartdir::chartTime2($restCurrentTimeslot));
            }
          }
        }
      }
    }
  }
} else {

applications/htmlroot/cgi-bin/moderator/generateCollectorDaemonSchedulingReport.pl  view on Meta::CPAN

  $forGround  = 0x000000;
  $axisColor  = 0x0C0C0C;
} else {
  $background = 0x000000;
  $forGround  = 0xF7F7F7;
  $axisColor  = 0x0000FF;
}

$chartTitle = "$prgtext for '$CcollectorDaemon' from '$CcatalogID'";

my (%uKeys, @stepValue, @labels, @colors, @colorsCrontab, @colorsTimeslot, @dataPoints, @startDate, @endDate, @actualStartDate, @actualEndDate, @crontabStartDate, @crontabEndDate, @crontabEndTimeslot);

my $masterOrSlave = '<NIHIL>';
$masterOrSlave = 'master' if (-s "$APPLICATIONPATH/master/asnmtap-collector.sh");
$masterOrSlave = 'slave'  if (-s "$APPLICATIONPATH/slave/asnmtap-collector.sh");
$rv = ($masterOrSlave eq '<NIHIL>') ? 0 : 1;

if ( $rv ) {
  # open connection to database and query data
  $dbh = DBI->connect("DBI:mysql:$DATABASE:$SERVERNAMEREADONLY:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY" ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("Cannot connect to the database", $debug, '',...

  if ( $dbh and $rv ) {
    my $uKeysSqlWhere = '';
    $sql = "select SQL_NO_CACHE $SERVERTABLCRONTABS.collectorDaemon, $SERVERTABLCRONTABS.uKey, $SERVERTABLCRONTABS.lineNumber, $SERVERTABLCRONTABS.minute, $SERVERTABLCRONTABS.hour, $SERVERTABLCRONTABS.dayOfTheMonth, $SERVERTABLCRONTABS.monthOfTheYear...
    ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString, $hight, $numberOfLabels) = get_sql_crontab_scheduling_report_data ($dbh, $sql, $rv, $errorMessage, $dbiErrorCode, $dbiErrorString, $sessionID, $hight, $hightMin, \%uKeys, \@labels, \@stepValue,...

    if ( $rv ) {
      my ($uKey, $startDate, $startTime, $endDate, $endTime, $status, $timeslot, $step);
      $uKeysSqlWhere = "AND ($uKeysSqlWhere)" if ($uKeysSqlWhere);
      $sql = "SELECT SQL_NO_CACHE $SERVERTABLEVENTS.uKey, $SERVERTABLEVENTS.startDate, $SERVERTABLEVENTS.startTime, $SERVERTABLEVENTS.endDate, $SERVERTABLEVENTS.endTime, $SERVERTABLEVENTS.status, $SERVERTABLEVENTS.timeslot, $SERVERTABLEVENTS.step FRO...
      $sth = $dbh->prepare( $sql ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot dbh->prepare: $sql", $debug, '', "", '', "", 0, '', $sessionID);
      $sth->execute() or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->execute: $sql", $debug, '', "", '', "", 0, '', $sessionID) if $rv;
      $sth->bind_columns( \$uKey, \$startDate, \$startTime, \$endDate, \$endTime, \$status, \$timeslot, \$step ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("", "Cannot sth->bind_columns: $sql", $debug, '', "", '', "", 0,...

      if ( $rv ) {
        if ( $sth->rows ) {
          while( $sth->fetch() ) { 
            # the color for each bar
            push (@colors, (($status eq 'NO TEST') ? $noTestColor : (($status eq 'OFFLINE') ? $offlineColor : $timeslotColor)));

            # the data points for each test result matching the corresponding label
            push (@dataPoints,         $uKeys{$uKey}->{numberOfLabel});

            # the timeslot start dates and end dates for the tasks
            push (@startDate,          perlchartdir::chartTime2((($timeslot >= $sqlStartDate) ? $timeslot : $sqlStartDate)));
            push (@endDate,            perlchartdir::chartTime2((($timeslot + $step >= $sqlEndDate) ? $sqlEndDate : $timeslot + $step)));

            # the actual start dates and end dates for the tasks up to now
            my ($startYear, $startMonth, $startDay) = split (/-/, $startDate);
            my ($startHour, $startMin, $startSec) = split (/:/, $startTime);
            push (@actualStartDate,    perlchartdir::chartTime($startYear, $startMonth, $startDay, $startHour, $startMin, $startSec));

            my ($endYear, $endMonth, $endDay) = split (/-/, $endDate);
            my ($endHour, $endMin, $endSec) = split (/:/, $endTime);
            push (@actualEndDate,      perlchartdir::chartTime($endYear, $endMonth, $endDay, $endHour, $endMin, $endSec));

            # set initial values
            push (@colorsCrontab,      $timeslotColor);
            push (@colorsTimeslot,     $timeslotColor);
            push (@crontabStartDate,   perlchartdir::chartTime2($sqlEndDate));
            push (@crontabEndDate,     perlchartdir::chartTime2($sqlEndDate));

applications/htmlroot/cgi-bin/moderator/generateCollectorDaemonSchedulingReport.pl  view on Meta::CPAN

                  } else {
                    $insertStatus = $ERRORS{OFFLINE} unless ( defined $insertStatus );
                  }
                }
              }
            }

            if (defined $insertStatus) {
              # set initial values
              push (@colors,             $timeslotColor);
              push (@startDate,          perlchartdir::chartTime2($sqlEndDate));
              push (@endDate,            perlchartdir::chartTime2($sqlEndDate));
              push (@actualStartDate,    perlchartdir::chartTime2($sqlEndDate));
              push (@actualEndDate,      perlchartdir::chartTime2($sqlEndDate));

              # the color for each crontab bar
              push (@colorsCrontab,      $COLORSRRD{$STATE{$insertStatus}});

              # the color for each timeslot bar
              push (@colorsTimeslot,     $COLORSRRD{'IN PROGRESS'});

              # the data points for each test result matching the corresponding label
              push (@dataPoints,         $uKeys{$uKey}->{numberOfLabel});

              my $endpointCurrentTimeslot = $currentDate + ($stepValue[$uKeys{$uKey}->{numberOfLabel}] * 60);
              my $restCurrentTimeslot = ($currentTimeslot eq 'off' and $endpointCurrentTimeslot > $sqlEndDate) ? $sqlEndDate : $endpointCurrentTimeslot;

              # the timeslot start dates and end dates for the tasks
              push (@crontabStartDate,   perlchartdir::chartTime2($currentDate));
              push (@crontabEndDate,     perlchartdir::chartTime2($currentDate + $step));
              push (@crontabEndTimeslot, perlchartdir::chartTime2($restCurrentTimeslot));
            }
          }
        }
      }
    }
  }
} else {

applications/htmlroot/cgi-bin/moderator/generateCollectorDaemonSchedulingReport.pl  view on Meta::CPAN

  # Add a box whisker layer to represent the actual dates. We add the actual dates layer first, so it will be the top layer.
  my $actualLayer = $c->addBoxLayer(\@actualStartDate, \@actualEndDate, $actualColor, "Actual");
  $actualLayer->setXData(\@dataPoints);

  # Set the bar height to 16 pixels so they will not block the bottom bar
  $actualLayer->setDataWidth(16);

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  
  # Add a box-whisker layer to represent the timeslot schedule date
  my $scheduledLayer = $c->addBoxWhiskerLayer2(\@startDate, \@endDate, undef, undef, undef, \@colors, 0);
# $scheduledLayer->setBorderColor($perlchartdir::Transparent);
  $scheduledLayer->setXData(\@dataPoints);

  # Set the bar height to 4 pixels so they will not block the bottom bar
  $scheduledLayer->setDataWidth(4);

  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  # Add a box-whisker layer to represent the crontab schedule date
  my $crontabLayer = $c->addBoxWhiskerLayer2(\@crontabStartDate, \@crontabEndDate, undef, undef, undef, \@colorsCrontab, 0);

applications/htmlroot/cgi-bin/moderator/generatePluginCrontabSchedulingReport.pl  view on Meta::CPAN

  if ( $CuKey ) {
    $rv = 1;
  } else {
    $hight = $hightMin; $rv = 0; $errorMessage = "NO DATA FOR THIS PERIOD";
  }

  # open connection to database and query data
  $dbh = DBI->connect("DBI:mysql:$DATABASE:$SERVERNAMEREADONLY:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY" ) or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("Cannot connect to the database", $debug, '',...

  if ( $dbh and $rv ) {
    my ($startDate, $startTime, $endDate, $endTime, $status, $timeslot);
    $sql = "select $SERVERTABLCRONTABS.collectorDaemon, $SERVERTABLCRONTABS.uKey, $SERVERTABLCRONTABS.lineNumber, $SERVERTABLCRONTABS.minute, $SERVERTABLCRONTABS.hour, $SERVERTABLCRONTABS.dayOfTheMonth, $SERVERTABLCRONTABS.monthOfTheYear, $SERVERTABL...
    ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString, $hight, $numberOfLabels) = get_sql_crontab_scheduling_report_data ($dbh, $sql, $rv, $errorMessage, $dbiErrorCode, $dbiErrorString, $sessionID, $hight, $hightMin, \%uKeys, \@labels, \@stepValue,...
    $dbh->disconnect or ($rv, $errorMessage, $dbiErrorCode, $dbiErrorString) = error_trap_DBI("Sorry, the database was unable to disconnect", $debug, '', "", '', "", '', 0, '', $sessionID) if (defined $dbh) ;
  }
  
  if ( $rv ) {
    my $restPreviousTimeslot = 0;
    my $stepValue = $stepValue[0] * 60;
    my $restCurrentTimeslot = $stepValue;
    my $applicationTitle = $labels[0];

applications/htmlroot/cgi-bin/moderator/generatePluginCrontabSchedulingReport.pl  view on Meta::CPAN


                  # the color for each crontab bar
                  push (@colorsCrontab,      $COLORSRRD{$STATE{$insertStatus}});

                  # the color for each timeslot bar
                  push (@colorsTimeslot,     $COLORSRRD{'IN PROGRESS'});

                  # the data points for each test result matching the corresponding label
                  push (@dataPoints,         $dataPoint);

                  # the timeslot start dates and end dates for the tasks
                  push (@crontabStartDate,   perlchartdir::chartTime2($currentDate));
                  push (@crontabEndDate,     perlchartdir::chartTime2($currentDate + 60));
                  push (@crontabEndTimeslot, perlchartdir::chartTime2($currentDate + $restCurrentTimeslot));
                }
              }
            }
          }
        }
      }
    }

applications/htmlroot/cgi-bin/moderator/runStatusOnDemand.pl  view on Meta::CPAN

    <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';

applications/htmlroot/cgi-bin/moderator/runStatusOnDemand.pl  view on Meta::CPAN


      if (defined $daemonCaptureHeader) {
        # pass 1 for the Parents
        foreach my $process ( @{$tProcessTable->table} ) {
          if ($process->ppid == $_ppid and $process->cmndline =~ /\.\/$daemonCaptureStatus(?:-test)?\.pl/) {
            $daemonProcessTableParent   {$process->pid} = (defined $daemonCaptureArrayParent {$process->pid}) ? 1 : 0;
            $daemonProcessTablePctmem   {$process->pid} = $process->pctmem;
            $daemonProcessTableSize     {$process->pid} = $process->size;
            $daemonProcessTableTtydev   {$process->pid} = $process->ttydev;
            $daemonProcessTableState    {$process->pid} = $process->state;
            $daemonProcessTableStart    {$process->pid} = $process->start;
            $daemonProcessTableCmndline {$process->pid} = $process->cmndline;
            delete $daemonCaptureArrayParent {$process->pid} if ($daemonProcessTableParent {$process->pid});
          }
        }

        # pass 2 for the Childs
        foreach my $process ( @{$tProcessTable->table} ) {
          if ($process->ppid != 1 and defined $daemonProcessTableParent {$process->ppid}) {
            $daemonProcessTableChild    {$process->pid} = $process->ppid;
            $daemonProcessTablePctmem   {$process->pid} = $process->pctmem;
            $daemonProcessTableSize     {$process->pid} = $process->size;
            $daemonProcessTableTtydev   {$process->pid} = $process->ttydev;
            $daemonProcessTableState    {$process->pid} = $process->state;
            $daemonProcessTableStart    {$process->pid} = $process->start;
            $daemonProcessTableCmndline {$process->pid} = $process->cmndline;
          }
        }

        # pass 3 for the SubChilds
        foreach my $process ( @{$tProcessTable->table} ) {
          if ($process->ppid != 1 and defined $daemonProcessTableChild {$process->ppid}) {
            $daemonProcessTableSubChild {$process->pid} = $process->ppid;
            $daemonProcessTablePctmem   {$process->pid} = $process->pctmem;
            $daemonProcessTableSize     {$process->pid} = $process->size;
            $daemonProcessTableTtydev   {$process->pid} = $process->ttydev;
            $daemonProcessTableState    {$process->pid} = $process->state;
            $daemonProcessTableStart    {$process->pid} = $process->start;
            $daemonProcessTableCmndline {$process->pid} = $process->cmndline;
          }
        }

        print "<tr><th colspan=\"2\" class=\"RunStatusOnDemandCaptureHeader\">$daemonCaptureHeader</th></tr>\n";

        while ( my ($daemon, $state) = each(%daemonCaptureArrayName) ) {
          if ($state == -1) {
            print "<tr><td colspan=\"2\" class=\"RunStatusOnDemandCaptureNotRunning\"><b>Daemon: '$daemonPidStatus ASNMTAP $daemon' not running but pid exists</b></td></tr>\n";
          } elsif ($state == 0) {

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&amp;pid=$pidParent&amp;ppid=1&amp;command=$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh&amp;action=reload\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{daemon...
                $urlAction .= "<A HREF=\"$urlWithAccessParameters&amp;pid=$pidParent&amp;ppid=1&amp;command=$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh&amp;action=restart\"><IMG SRC=\"$IMAGESURL/$ICONSSYSTEM{daemo...
                $urlAction .= "<A HREF=\"$urlWithAccessParameters&amp;pid=$pidParent&amp;ppid=1&amp;command=$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh&amp;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};

applications/htmlroot/cgi-bin/moderator/runStatusOnDemand.pl  view on Meta::CPAN

          } else {
            if ($state == -1 or $state == 1) {
              if ($iconDelete) {
                my $urlAction = "<A HREF=\"$urlWithAccessParameters&amp;pid=<NIHIL>&amp;ppid=<NIHIL>&amp;command=$PIDPATH/${daemonPidStatus}$urlDaemon.pid&amp;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&amp;pid=<NIHIL>&amp;ppid=<NIHIL>&amp;command=$APPLICATIONPATH/$binMasterOrSlave/${urlPrefix}${daemonPidStatus}${urlDaemon}.sh&amp;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};
          }
        }

        print "</table><br><table width=\"100%\" bgcolor=\"#333344\" border=0><tr><th colspan=\"2\" class=\"RunStatusOnDemandCaptureHeader\">ERROR's regarding 'All ASNMTAP $status'</th></tr>\n";

applications/htmlroot/cgi-bin/moderator/trendlineCorrectionReports.pl  view on Meta::CPAN

  if ($action eq 'listView') {
    $htmlTitle = "Trendline Correction Reports";

    my ($rv, $dbh, $sth, $sql);
    $rv = 1;

    # open connection to database and query data
    $dbh = DBI->connect("DBI:mysql:$DATABASE:$SERVERNAMEREADONLY:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTitle...

    if ( $dbh and $rv ) {
      my $startDateEpoch = get_epoch ('-14 days');
      my $startDate = sprintf ( "%04d-%02d-%02d", (localtime($startDateEpoch))[5]+1900, (localtime($startDateEpoch))[4]+1, (localtime($startDateEpoch))[3] );

      my $yesterdayEpoch = get_epoch ('yesterday');
      my $yesterday = sprintf ( "%04d-%02d-%02d", (localtime($yesterdayEpoch))[5]+1900, (localtime($yesterdayEpoch))[4]+1, (localtime($yesterdayEpoch))[3] );

      my $actionPressend = ($iconDetails or $iconEdit) ? 1 : 0;
      my $actionHeader = ($actionPressend) ? "<th>Action</th>" : '';
      my $colspan = 10 + $actionPressend;
      my $header = "<tr><th> Catalog ID </th><th> Title </th><th> uKey </th><th> Trendline </th><th> - </th><th> Average </th><th> % </th><th> + </th><th> % </th><th> Proposal </th>$actionHeader</tr>\n";

      my $hostname = '';
      (undef, undef, $hostname, undef) = split ( /\//, $ENV{HTTP_REFERER} ) if ( $ENV{HTTP_REFERER} );

      $sql = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
      ($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sql, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);

      my ($catalogID, $uKey, $title, $test, $resultsdir, $trendline, $percentage, $tolerance, $hour, $calculated);
      $sql = "select SQL_NO_CACHE $SERVERTABLPLUGINS.catalogID, $SERVERTABLPLUGINS.uKey, concat( LTRIM(SUBSTRING_INDEX($SERVERTABLPLUGINS.title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as Title, $SERVERTABLPLUGINS.test, $SERVERTABLPLUGIN...
      $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
      $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
      $sth->bind_columns( \$catalogID, \$uKey, \$title, \$test, \$resultsdir, \$trendline, \$percentage, \$tolerance, \$hour, \$calculated ) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $s...

      $matchingTrendlineCorrections .= '<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="'. $COLORSTABLE{TABLE} .'"><tr><th align="center" colspan="'. $colspan .'"> Trendline > 0 </th></tr>'. $header;

      if ( $rv ) {
        sub matchingTrendlineCorrections {
          my ($catalogID, $uKey, $title, $test, $resultsdir, $trendline, $percentage, $tolerance, $calculated) = @_;

applications/htmlroot/cgi-bin/moderator/trendlineCorrectionReports.pl  view on Meta::CPAN

            $calculatedMIN = $calculatedMAX = $calculatedNEW = '';
          }

          $ActionItem = ( $actionPressend and $calculatedNEW ) ? 1 : '';

          if ( $ActionItem or ! $shortlist ) {
            $test =~ s/\.pl//g;
            my $catalogID_uKey = ( ( $catalogID eq 'CID' ) ? '' : $catalogID .'_' ) . $uKey;
            $ActionItem  = "&nbsp";
            $ActionItem .= "<A HREF=\"#\" onclick=\"openPngImage('/results/$resultsdir/$test-$catalogID_uKey-sql.html',912,576,null,null,'Trendline',10,false,'Trendline');\"><img src=\"$IMAGESURL/$ICONSRECORD{table}\" title=\"Trendline MRTG Chart\" a...
            $ActionItem .= "<A HREF=\"#\" onclick=\"openPngImage('$HTTPSURL/cgi-bin/generateChart.pl?$urlAccessParameters&detailed=on&catalogID=$CcatalogID&uKey1=$uKey&uKey2=none&uKey3=none&startDate=$startDate&endDate=$yesterday&inputType=fromto&cha...

            my $actionSkip = ( ( $catalogID eq $CATALOGID ) ? 0 : 1 );

            unless ( $actionSkip ) {
              if ( $userType >= 2 ) {
                $ActionItem .= "&nbsp;<A HREF=\"#\" onclick=\"openPngImage('$HTTPSURL/cgi-bin/". ( ( $userType == 2 ) ? 'moderator' : 'admin' ) ."/plugins.pl?$urlAccessParameters&action=editView&catalogID=$CcatalogID&uKey=$uKey&orderBy=uKey',1016,760...

                if ( $calculatedNEW ) {
                  $ActionItem .= "<A HREF=\"#\">";
                  $ActionItem .= ( $calculatedNEW > $trendline ? "<IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" title=\"Update Trendline\" ALT=\"Update Trendline\" BORDER=0>" : "<IMG SRC=\"$IMAGESURL/$ICONSRECORD{down}\" title=\"Update Trendline\" ALT=\"U...

applications/htmlroot/overlib.js  view on Meta::CPAN

						fN[i] = fN[i].substring(l+2);
						if (olre.test(fn)) eval(fn);
					}
				}
			}
		}
	}
}

// Wraps strings in Layer Generation Functions with the correct tags
//    endWrap true(if end tag) or false if start tag
//    fontSizeStr - font size string such as '1' or '10px'
//    whichString is being wrapped -- 'text', 'caption', or 'close'
function wrapStr(endWrap,fontSizeStr,whichString) {
	var fontStr, fontColor, isClose=((whichString=='close') ? 1 : 0), hasDims=/[%\-a-z]+$/.test(fontSizeStr);
	fontSizeStr = (olNs4) ? (!hasDims ? fontSizeStr : '1') : fontSizeStr;
	if (endWrap) return (hasDims&&!olNs4) ? (isClose ? '</span>' : '</div>') : '</font>';
	else {
		fontStr='o3_'+whichString+'font';
		fontColor='o3_'+((whichString=='caption')? 'cap' : whichString)+'color';
		return (hasDims&&!olNs4) ? (isClose ? '<span style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">' : '<div style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fo...

applications/htmlroot/snmptraps/include/classes/class.main.php  view on Meta::CPAN

       
       foreach ($vals as $xml_elem) {
          if ($xml_elem['type'] == 'open') {
             if (array_key_exists('attributes',$xml_elem)) {
                list($level[$xml_elem['level']],$extra) = array_values($xml_elem['attributes']);
             } else {
                $level[$xml_elem['level']] = $xml_elem['tag'];
             }
          }
          if ($xml_elem['type'] == 'complete') {
             $start_level = 1;
             $php_stmt = '$params';
             while($start_level < $xml_elem['level']) {
                $php_stmt .= '[$level['.$start_level.']]';
                $start_level++;
             }
             $xml_elem['value'] = $this->replaceCharacters($xml_elem['value']);
             $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
             eval($php_stmt);
          }
       }
       return($params);
    }
	
	/**

applications/htmlroot/snmptraps/include/js/overlib.js  view on Meta::CPAN

						fN[i] = fN[i].substring(l+2);
						if (olre.test(fn)) eval(fn);
					}
				}
			}
		}
	}
}

// Wraps strings in Layer Generation Functions with the correct tags
//    endWrap true(if end tag) or false if start tag
//    fontSizeStr - font size string such as '1' or '10px'
//    whichString is being wrapped -- 'text', 'caption', or 'close'
function wrapStr(endWrap,fontSizeStr,whichString) {
	var fontStr, fontColor, isClose=((whichString=='close') ? 1 : 0), hasDims=/[%\-a-z]+$/.test(fontSizeStr);
	fontSizeStr = (olNs4) ? (!hasDims ? fontSizeStr : '1') : fontSizeStr;
	if (endWrap) return (hasDims&&!olNs4) ? (isClose ? '</span>' : '</div>') : '</font>';
	else {
		fontStr='o3_'+whichString+'font';
		fontColor='o3_'+((whichString=='caption')? 'cap' : whichString)+'color';
		return (hasDims&&!olNs4) ? (isClose ? '<span style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">' : '<div style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fo...

applications/log4perl.cnf  view on Meta::CPAN

#   %H Hostname (if Sys::Hostname is available)
#   %l Fully qualified name of the calling method followed by the callers source 
#      the file name and line number between parentheses.
#   %L Line number within the file where the log statement was issued
#   %m The message to be logged
#   %m{chomp} The message to be logged, stripped off a trailing newline
#   %M Method or function where the logging request was issued
#   %n Newline (OS-independent)
#   %p Priority of the logging event
#   %P pid of the current process
#   %r Number of milliseconds elapsed from program start to logging event
#   %R Number of milliseconds elapsed from last logging event to current logging 
#      event 
#   %T A stack trace of functions called
#   %x The topmost NDC (see below)
#   %X{key} The entry 'key' of the MDC (see below)
#   %% A literal percent (%) sign
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# log4perl.appender.<category>.layout = PatternLayout

applications/sbin/bash_stop_root.sh  view on Meta::CPAN


uid=`echo $UID`
user=`echo $USER`

if [ "$uid" -eq 0 -a "$STOP_ROOT" = "TRUE" ]; then
  echo "*** NOTICE: ASNMPTAP has been configured not to run as root ! ***"
  exit 1
elif [ "$uid" -eq 0 -a "$STOP_ROOT" != "TRUE" ]; then
  echo "*** WARNING: Running ASNMPTAP as root is not recommended ! ***"
elif [ $uid != "$ASNMPTAP_UID" -a "$user" != "$ASNMPTAP_USER" -a $uid != "$HTTPD_UID" ]; then
  echo "*** NOTICE: ASNMPTAP must be started with shell uid(user) $ASNMPTAP_UID($ASNMPTAP_USER) or with httpd uid $HTTPD_UID"
  exit 1
fi



( run in 0.791 second using v1.01-cache-2.11-cpan-0d8aa00de5b )