ASNMTAP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

                               - add ASNMTAPUSER=asnmtap
                               generateCollectorCrontabSchedulingReport.pl & generateCollectorDaemonSchedulingReport.pl
                               - FIX when ! defined $numberOfLabels
                               generateConfig.pl
                               - FIX removed '/etc' from 'servername:/asnmtap-3.000.xxx/applications/master/etc/CollectorCT-...sh reload'
                               holidayBundleSetDowntimes.pl
                               - add Administrator to email message
                               Makefile.PL
                               - add Proc::ProcessTable to CGI perl prerequisites list
                               plugins.pl
                               - add fields percentage and tolerance

							   ASNMTAP::Asnmtap::Plugins
                               - replaced 'Mozilla/5.0 (compatible; MSIE 6.0;' with 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;'

                                 De XP-versie als                     'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'
                                 De plusversie kan worden herkend als 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)'

                               asnmtap-3.000.010.sql
                                 CREATE TABLE `plugins` (
                                   ...
                                   `trendline` smallint(6) NOT NULL default '0',
                                 + `percentage` tinyint(1) NOT NULL default '25',
                                 + `tolerance` tinyint(1) NOT NULL default '5',
                                   `step` smallint(6) NOT NULL default '0',
                                   ...


Version 3.000.009, 2006/06/01, ASNMTAP::Asnmtap::Plugins::WebTransact
                               - RFC 1738 optimalisations
                               - add '500 SSL negotiation failed'
                               - add Perfdata_Label => 'IMAGE URL' to _download_images()
                               ASNMTAP::Asnmtap::Applications

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

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

my $CcatalogID          = (defined $cgi->param('catalogID'))          ? $cgi->param('catalogID')          : $CATALOGID;
my $CcatalogIDreload    = (defined $cgi->param('catalogIDreload'))    ? $cgi->param('catalogIDreload')    : 0;
my $CuKey               = (defined $cgi->param('uKey'))               ? $cgi->param('uKey')               : '';
my $Ctest               = (defined $cgi->param('test'))               ? $cgi->param('test')               : '';
my $CshortDescription   = (defined $cgi->param('shortDescription'))   ? $cgi->param('shortDescription')   : '';
my $Cenvironment        = (defined $cgi->param('environment'))        ? $cgi->param('environment')        : 'L';
my $Carguments          = (defined $cgi->param('arguments'))          ? $cgi->param('arguments')          : '';
my $CargumentsOndemand  = (defined $cgi->param('argumentsOndemand'))  ? $cgi->param('argumentsOndemand')  : '';
my $Ctitle              = (defined $cgi->param('title'))              ? $cgi->param('title')              : '';
my $Ctrendline          = (defined $cgi->param('trendline'))          ? $cgi->param('trendline')          : 0;
my $Cpercentage         = (defined $cgi->param('percentage'))         ? $cgi->param('percentage')         : 25;
my $Ctolerance          = (defined $cgi->param('tolerance'))          ? $cgi->param('tolerance')          : 5;
my $Cstep               = (defined $cgi->param('step'))               ? $cgi->param('step')               : 0;
my $Condemand           = (defined $cgi->param('ondemand'))           ? $cgi->param('ondemand')           : 'off';
my $Cproduction         = (defined $cgi->param('production'))         ? $cgi->param('production')         : 'off';
my @Cpagedir            =          $cgi->param('pagedirs');
my $Cresultsdir         = (defined $cgi->param('resultsdir'))         ? $cgi->param('resultsdir')         : 'none';
my $ChelpPluginTextname = (defined $cgi->param('helpPluginTextname')) ? $cgi->param('helpPluginTextname') : '<NIHIL>';
my $ChelpPluginFilename = (defined $cgi->param('helpPluginFilename')) ? $cgi->param('helpPluginFilename') : '<NIHIL>';
my $CholidayBundleID    = (defined $cgi->param('holidayBundleID'))    ? $cgi->param('holidayBundleID')    : 1;
my $Cactivated          = (defined $cgi->param('activated'))          ? $cgi->param('activated')          : 'off';

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


my $htmlTitle = $APPLICATION;

# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledUniqueKey, $submitButton);

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

# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&filter=$filter&orderBy=$orderBy&action=$action&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&uKey=$CuKey&te...

# Debug information
print "<pre>pagedir           : $pagedir<br>pageset           : $pageset<br>debug             : $debug<br>CGISESSID         : $sessionID<br>page no           : $pageNo<br>page offset       : $pageOffset<br>filter            : $filter<br>order by     ...

if ( defined $sessionID and ! defined $errorUserAccessControl ) {
  if ( $ChelpPluginFilename eq '' or $ChelpPluginFilename eq '<NIHIL>' ) {
    $ChelpPluginFilename = ( $ChelpPluginTextname eq '' ? '<NIHIL>' : $ChelpPluginTextname );
    $ChelpPluginTextname = '';
  } else {
    if ( $cgi->param('helpPluginFilename') eq '' ) {
      $ChelpPluginFilename = $ChelpPluginTextname;
      $ChelpPluginTextname = '';
    } else {

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

      ($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);

   if ( $numberRecordsIntoQuery ) {
        $htmlTitle  = "Plugin $CuKey from $CcatalogID exist already";
        $nextAction = "insertView";
      } else {
        $htmlTitle  = "Plugin $CuKey inserted from $CcatalogID";
        my $dummyOndemand   = ($Condemand eq 'on') ? 1 : 0;
        my $dummyProduction = ($Cproduction eq 'on') ? 1 : 0;
        my $dummyActivated  = ($Cactivated eq 'on') ? 1 : 0;
        $sql = 'INSERT INTO ' .$SERVERTABLPLUGINS. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", test="' .$Ctest. '", environment="' .$Cenvironment. '", arguments="' .$Carguments. '", argumentsOndemand="' .$CargumentsOndemand. '", title="...
        $dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
        $nextAction   = "listView" if ($rv);
      }
    } elsif ($action eq 'deleteView') {
      $formDisabledUniqueKey = $formDisabledAll = 'disabled';
      $htmlTitle    = "Delete plugin $CuKey from $CcatalogID";
      $submitButton = "Delete";
      $nextAction   = "delete" if ($rv);
    } elsif ($action eq 'delete') {
      $sql = "select uKey, title from $SERVERTABLCOMMENTS where catalogID = '$CcatalogID' and uKey = '$CuKey' order by title, uKey";

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

    } elsif ($action eq 'editView') {
      $formDisabledUniqueKey = 'disabled';
      $htmlTitle    = "Edit plugin $CuKey from $CcatalogID";
      $submitButton = "Edit";
      $nextAction   = "edit" if ($rv);
    } elsif ($action eq 'edit') {
      $htmlTitle    = "Plugin $CuKey updated from $CcatalogID";
      my $dummyOndemand   = ($Condemand eq 'on') ? 1 : 0;
      my $dummyProduction = ($Cproduction eq 'on') ? 1 : 0;
      my $dummyActivated  = ($Cactivated eq 'on') ? 1 : 0;
      $sql = 'UPDATE ' .$SERVERTABLPLUGINS. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", test="' .$Ctest. '", environment="' .$Cenvironment. '", arguments="' .$Carguments. '", argumentsOndemand="' .$CargumentsOndemand. '", title="' .$Cti...
      $dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
      $nextAction   = "listView" if ($rv);
    } elsif ($action eq 'listView') {
      my $doFilter  = ( ( defined $filter and $filter ne '' ) ? 1 : 0 );
      $htmlTitle    = ( $doFilter ) ? "All plugins matching filter: $filter" : "All plugins listed";

      if ( $CcatalogIDreload ) {
        $pageNo = 1;
        $pageOffset = 0;
      }

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


      $navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLPLUGINS, 'title', "catalogID = '$CcatalogID' $andFilter", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&amp;pageset=$pageset&amp;debug=$debug...

      $sql = "select catalogID, uKey, title, environment, ondemand, production, pagedir, resultsdir, activated from $SERVERTABLPLUGINS where catalogID = '$CcatalogID' $andFilter order by $orderBy limit $pageOffset, $RECORDSONPAGE";
      $header  = "<th><a href=\"$urlWithAccessParameters&amp;action=listView&amp;orderBy=catalogID desc, uKey asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog ID <a href=\"$urlWithAccessParameters&amp;action=listView&am...
      $header .= "<th><a href=\"$urlWithAccessParameters&amp;action=listView&amp;orderBy=production desc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Production <a href=\"$urlWithAccessParameters&amp;action=listView&amp;orderBy...
      ($rv, $matchingPlugins, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Plugin', 'catalogID|uKey', '0|1', '', '', "&amp;catalogID=$CcatalogID&amp;filter=$filter", $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails,...
    }

    if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView') {
      $sql = "select catalogID, uKey, test, environment, arguments, argumentsOndemand, title, shortDescription, trendline, percentage, tolerance, step, ondemand, production, pagedir, resultsdir, helpPluginFilename, holidayBundleID, activated from $SE...
      $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
      $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;

      if ( $rv ) {
        ($CcatalogID, $CuKey, $Ctest, $Cenvironment, $Carguments, $CargumentsOndemand, $Ctitle, $CshortDescription, $Ctrendline, $Cpercentage, $Ctolerance, $Cstep, $Condemand, $Cproduction, $Cpagedir, $Cresultsdir, $ChelpPluginFilename, $CholidayBund...
        $CcatalogID  = $CATALOGID if ($action eq 'duplicateView');
        $Condemand   = ($Condemand == 1) ? 'on' : 'off';
        $Cproduction = ($Cproduction == 1) ? 'on' : 'off';
        $Cactivated  = ($Cactivated == 1) ? 'on' : 'off';
        $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
      }
    }

    if ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView' or $action eq 'insertView') {
      $environmentSelect = create_combobox_from_keys_and_values_pairs ('P=>Production|A=>Acceptation|S=>Simulation|T=>Test|D=>Development|L=>Local', 'V', 0, $Cenvironment, 'environment', '', '', $formDisabledAll, '', $debug);

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

    alert('Please enter a plugin name!');
    return false;
  }

  if ( document.plugins.trendline.value == null || document.plugins.trendline.value == '' ) {
    document.plugins.trendline.focus();
    alert('Please enter a trendline!');
    return false;
  }

  if ( document.plugins.percentage.value == null || document.plugins.percentage.value == '' ) {
    document.plugins.percentage.focus();
    alert('Please enter a percentage!');
    return false;
  }

  if ( document.plugins.tolerance.value == null || document.plugins.tolerance.value == '' ) {
    document.plugins.tolerance.focus();
    alert('Please enter a tolerance!');
    return false;
  }

  if ( document.plugins.step.value == null || document.plugins.step.value == '' || document.plugins.step.value == '0' ) {

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

          <input type="text" name="test" value="$Ctest" size="100" maxlength="100" $formDisabledAll>
        <tr><td><b>Environment: </b></td><td>
       $environmentSelect
        <tr><td>Common Arguments: </td><td>
          <input type="text" name="arguments" value="$Carguments" size="100" maxlength="1024" $formDisabledAll>
        <tr><td>On Demand Arguments: </td><td>
          <input type="text" name="argumentsOndemand" value="$CargumentsOndemand" size="100" maxlength="1024" $formDisabledAll>
        <tr><td><b>Trendline: </b></td><td>
          <input type="text" name="trendline" value="$Ctrendline" size="6" maxlength="6" $formDisabledAll>
        <tr><td><b>Percentage: </b></td><td>
          <input type="text" name="percentage" value="$Cpercentage" size="2" maxlength="2" $formDisabledAll>&nbsp;&nbsp;Proposal = MAX ( week ( hour ( AVG ( Duration ), 9-17 ), 1-5 ) ) * 1.percentage
        <tr><td><b>Tolerance: </b></td><td>
          <input type="text" name="tolerance" value="$Ctolerance" size="2" maxlength="2" $formDisabledAll>&nbsp;&nbsp;Proposal * 0.tolerance < Trendline < Proposal * 1.tolerance where Tolerance=0 means FIXED Trendline
        <tr><td><b>Step: </b></td><td>
          <input type="text" name="step" value="$Cstep" size="6" maxlength="6" $formDisabledAll>
        <tr><td><b>Run On Demand: </b></td><td>
          <input type="checkbox" name="ondemand" $ondemandChecked $formDisabledAll>
        <tr><td><b>Into Production: </b></td><td>
          <input type="checkbox" name="production" $productionChecked $formDisabledAll>
        <tr><td valign="top"><b>View Pagedirs: </b></td><td>
       $pagedirsSelect

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

my $pageNo                 = (defined $cgi->param('pageNo'))                ? $cgi->param('pageNo')                : 1;
my $pageOffset             = (defined $cgi->param('pageOffset'))            ? $cgi->param('pageOffset')            : 0;
my $orderBy                = (defined $cgi->param('orderBy'))               ? $cgi->param('orderBy')               : 'uKey';
my $action                 = (defined $cgi->param('action'))                ? $cgi->param('action')                : 'listView';
my $CuKeyReload            = (defined $cgi->param('uKeyReload'))            ? $cgi->param('uKeyReload')            : 0;
my $CcatalogID             = (defined $cgi->param('catalogID'))             ? $cgi->param('catalogID')             : $CATALOGID;
my $CcatalogIDreload       = (defined $cgi->param('catalogIDreload'))       ? $cgi->param('catalogIDreload')       : 0;
my $CuKey                  = (defined $cgi->param('uKey'))                  ? $cgi->param('uKey')                  : 'none';
my $Cmetric_id             = (defined $cgi->param('metric_id'))             ? $cgi->param('metric_id')             : 'none';
my $Ctimes                 = (defined $cgi->param('times'))                 ? $cgi->param('times')                 : '';
my $Cpercentiles           = (defined $cgi->param('percentiles'))           ? $cgi->param('percentiles')           : '';
my $Cunit                  = (defined $cgi->param('unit'))                  ? $cgi->param('unit')                  : 's';
my $Cactivated             = (defined $cgi->param('activated'))             ? $cgi->param('activated')             : 'off';

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

my $htmlTitle = $APPLICATION;

# Init parameters
my ($rv, $dbh, $sth, $sql, $header, $numberRecordsIntoQuery, $nextAction, $formDisabledAll, $formDisabledNoMetricID, $formDisabledPrimaryKey, $submitButton, $uKeySelect, $metric_idSelect);

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

# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&pageNo=$pageNo&pageOffset=$pageOffset&orderBy=$orderBy&action=$action&uKeyReload=$CuKeyReload&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&uKey=...

# Debug information
print "<pre>pagedir       : $pagedir<br>pageset       : $pageset<br>debug         : $debug<br>CGISESSID     : $sessionID<br>page no       : $pageNo<br>page offset   : $pageOffset<br>order by      : $orderBy<br>action        : $action<br>uKey Reload  ...

if ( defined $sessionID and ! defined $errorUserAccessControl ) {
  my ($catalogIDSelect, $matchingReportsPerfdata, $navigationBar);

  my $urlWithAccessParameters = $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&amp;pageset=$pageset&amp;debug=$debug&amp;CGISESSID=$sessionID&amp;pageNo=$pageNo&amp;pageOffset=$pageOffset&amp;catalogID=$CcatalogID";

  # open connection to database and query data
  $rv  = 1;

  $dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADWRITE:$SERVERPORTREADWRITE", "$SERVERUSERREADWRITE", "$SERVERPASSREADWRITE" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTit...

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


      $sql = "select catalogID, uKey, metric_id from $SERVERTABLREPORTSPRFDT WHERE catalogID='$CcatalogID' and uKey='$CuKey' and metric_id='$Cmetric_id'";
      ($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);

	  if ( $numberRecordsIntoQuery ) {
        $htmlTitle    = "Report Perfdata $CuKey, $Cmetric_id from $CcatalogID exist already";
        $nextAction   = "insertView";
      } else {
        $htmlTitle    = "Report Perfdata $CuKey, $Cmetric_id from $CcatalogID inserted";
        my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
        $sql = 'INSERT INTO ' .$SERVERTABLREPORTSPRFDT. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", metric_id="' .$Cmetric_id. '", times="' .$Ctimes. '", percentiles="' .$Cpercentiles. '", unit="' .$Cunit. '", activated="' .$dummyActiva...
        $dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
        $nextAction   = "listView" if ($rv);
      }
    } elsif ($action eq 'deleteView') {
      $formDisabledPrimaryKey = $formDisabledAll = 'disabled';
      $htmlTitle    = "Delete Report Perfdata $CuKey, $Cmetric_id from $CcatalogID";
      $submitButton = "Delete";
      $nextAction   = "delete" if ($rv);
    } elsif ($action eq 'delete') {
      $sql = 'DELETE FROM ' .$SERVERTABLREPORTSPRFDT. ' WHERE catalogID="' .$CcatalogID. '" and uKey="' .$CuKey. '" and metric_id="' .$Cmetric_id. '"';

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

      $htmlTitle    = "Display Report Perfdata $CuKey, $Cmetric_id from $CcatalogID";
      $nextAction   = "listView" if ($rv);
    } elsif ($action eq 'editView') {
      $formDisabledPrimaryKey = 'disabled';
      $htmlTitle    = "Edit Report Perfdata $CuKey, $Cmetric_id from $CcatalogID";
      $submitButton = "Edit";
      $nextAction   = "edit" if ($rv);
    } elsif ($action eq 'edit') {
      $htmlTitle    = "Report Perfdata $CuKey, $Cmetric_id from $CcatalogID updated";
      my $dummyActivated = ($Cactivated eq 'on') ? 1 : 0;
      $sql = 'UPDATE ' .$SERVERTABLREPORTSPRFDT. ' SET catalogID="' .$CcatalogID. '", uKey="' .$CuKey. '", metric_id="' .$Cmetric_id. '", times="' .$Ctimes. '", percentiles="' .$Cpercentiles. '", unit="' .$Cunit. '", activated="' .$dummyActivated. '"...
      $dbh->do ( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->do: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
      $nextAction   = "listView" if ($rv);
    } elsif ($action eq 'listView') {
      $htmlTitle    = "All reports perfdata listed";

      if ( $CcatalogIDreload ) {
        $pageNo = 1;
        $pageOffset = 0;
      }

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

      $sql = "select SQL_NO_CACHE count(uKey) from $SERVERTABLREPORTSPRFDT where catalogID = '$CcatalogID'";
      ($rv, $numberRecordsIntoQuery) = do_action_DBI ($rv, $dbh, $sql, $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
      $navigationBar = record_navigation_bar ($pageNo, $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&amp;pageset=$pageset&amp;debug=$debug&amp;CGISESSID=$sessionID&amp;action=listView&amp;catalogID=$CcatalogID&amp;or...

      $navigationBar .= record_navigation_bar_alpha ($rv, $dbh, $SERVERTABLREPORTSPRFDT, 'uKey', "catalogID = '$CcatalogID'", $numberRecordsIntoQuery, $RECORDSONPAGE, $ENV{SCRIPT_NAME} . "?pagedir=$pagedir&amp;pageset=$pageset&amp;debug=$debug&amp;CG...

      $sql = "select $DATABASE.$SERVERTABLREPORTSPRFDT.catalogID, $DATABASE.$SERVERTABLREPORTSPRFDT.uKey, $DATABASE.$SERVERTABLREPORTSPRFDT.metric_id, concat( LTRIM(SUBSTRING_INDEX($DATABASE.$SERVERTABLPLUGINS.title, ']', -1)), ' (', $DATABASE.$SERVE...

      $header = "<th><a href=\"$urlWithAccessParameters&amp;action=listView&amp;orderBy=catalog desc, title desc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Catalog <a href=\"$urlWithAccessParameters&amp;action=listView&amp;or...
      $header .= "<th><a href=\"$urlWithAccessParameters&amp;action=listView&amp;orderBy=metric_id desc, title asc\"><IMG SRC=\"$IMAGESURL/$ICONSRECORD{up}\" ALT=\"Up\" BORDER=0></a> Metric <a href=\"$urlWithAccessParameters&amp;action=listView&amp;o...
      ($rv, $matchingReportsPerfdata, $nextAction) = record_navigation_table ($rv, $dbh, $sql, 'Report Perfdata', 'catalogID|uKey|metric_id', '0|1|2', '2', '', '', $orderBy, $header, $navigationBar, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $ne...
    }

    if (!$CuKeyReload and ($action eq 'deleteView' or $action eq 'displayView' or $action eq 'duplicateView' or $action eq 'editView')) {
      $sql = "select catalogID, uKey, metric_id, times, percentiles, unit, activated from $SERVERTABLREPORTSPRFDT WHERE catalogID='$CcatalogID' and uKey='$CuKey' and metric_id='$Cmetric_id'";
      $sth = $dbh->prepare( $sql ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
      $sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;

      if ( $rv ) {
        ($CcatalogID, $CuKey, $Cmetric_id, $Ctimes, $Cpercentiles, $Cunit, $Cactivated) = $sth->fetchrow_array() or $rv = error_trap_DBI(*STDOUT, "Cannot $sth->fetchrow_array: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessi...
        $CcatalogID = $CATALOGID if ($action eq 'duplicateView');
        $Cactivated = ($Cactivated == 1) ? 'on' : 'off';
        $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
      }
    }

    if ($action eq 'insertView' or $action eq 'deleteView' or $action eq 'duplicateView' or $action eq 'displayView' or $action eq 'editView') {
      if ($CuKey eq 'none' or $action eq 'insertView' or $action eq 'duplicateView' or $action eq 'editView') {
        $sql = "select uKey, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as optionValueTitle from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where $SERVERTABLPLUGINS.catalogID = '$CcatalogID' and $SERVERT...
      } else {

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

  var objectRegularExpressionTimesValue = /\^([0-9]+)(,([0-9]+))*\$/;

  if ( ! ( document.reports_perfdata.times.value == null || document.reports_perfdata.times.value == '' ) ) {
    if ( ! objectRegularExpressionTimesValue.test(document.reports_perfdata.times.value) ) {
      document.reports_perfdata.times.focus();
      alert('Please re-enter times: Bad times format!');
      return false;
    }
  }

  // percentiles n[,n] and 0 < n < 100
  var objectRegularExpressionPercentilesValue = /\^([1-9]|[1-9][0-9])(,([1-9]|[1-9][0-9]))*\$/;

  if ( ! ( document.reports_perfdata.percentiles.value == null || document.reports_perfdata.percentiles.value == '' ) ) {
    if ( ! objectRegularExpressionPercentilesValue.test(document.reports_perfdata.percentiles.value) ) {
      document.reports_perfdata.percentiles.focus();
      alert('Please re-enter percentiles: Bad percentile format!');
      return false;
    }
  }

  return true;
}
</script>

<form action="$ENV{SCRIPT_NAME}" method="post" name="reports_perfdata" onSubmit="return validateForm();">
HTML

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

		<tr><td><b>Application: </b></td><td>
          $uKeySelect
        </td></tr>
        <tr><td><b>Metric: </b></td><td>
          $metric_idSelect
        </td></tr>
        <tr><td><b>Times: </b></td><td>
          <input type="text" name="times" value="$Ctimes" size="64" maxlength="64" $formDisabledAll>&nbsp;&nbsp;format: n[,n]&nbsp;&nbsp;value: >= 0
        </td></tr>
        <tr><td><b>Percentiles: </b></td><td>
          <input type="text" name="percentiles" value="$Cpercentiles" size="64" maxlength="64" $formDisabledAll>&nbsp;&nbsp;format: n[,n]&nbsp;&nbsp; 0 < value < 100
        </td></tr>
        <tr><td><b>Unit: </b></td><td>
          $unitSelect
        </td></tr>
		<tr><td><b>Activated: </b></td><td>
          <input type="checkbox" name="activated" $activatedChecked $formDisabledAll>
        </td></tr>
HTML

      print "        <tr><td>&nbsp;</td><td><br>Please enter all required information before committing the required information. Required fields are marked in bold.</td></tr>\n" if ($action eq 'duplicateView' or $action eq 'editView' or $action eq '...

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

          }
        }

        if ($perfdata eq 'on' and ! defined $errorMessage) {
          # Performance Data Detail - - - - - - - - - - - - - - - - - - -
          $perfdataDetailList = "<H1>Performance Data Details</H1>\n";

          unless ( $PERFPARSEENABLED ) {
            $perfdataDetailList .= "<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"$COLORSTABLE{TABLE}\"><tr><td width=\"400\">Performance Data not enabled!</td></tr></table>";
          } else {
            my ($sthPERFPARSE, $metric_id, $metric, $times, $percentiles, $unit, $Unit, $periodePERFPARSE, $countPERFPARSE, $valuePERFPARSE) = ( $dbh );

            my $toggle = 0;
            my $sqlWherePERFDATA;

            if ( $PERFPARSEVERSION eq '20' ) {
              my $catalogID_uKey = ( ( $CcatalogID eq 'CID' ) ? '' : $CcatalogID .'_' ) . $uKey1;
              $sqlQuery = "select service_id from $PERFPARSEDATABASE.perfdata_service where service_description = '$catalogID_uKey'";
              $sqlWherePERFDATA = "where $DATABASE.$SERVERTABLREPORTSPRFDT.metric_id = $PERFPARSEDATABASE.perfdata_service_metric.metric_id and $PERFPARSEDATABASE.perfdata_service_metric.service_id in ($sqlQuery)";
            } else {
              $sqlWherePERFDATA = "where $DATABASE.$SERVERTABLREPORTSPRFDT.catalogID='$CcatalogID' and $DATABASE.$SERVERTABLREPORTSPRFDT.uKey='$uKey1' and $DATABASE.$SERVERTABLREPORTSPRFDT.activated='1' and $DATABASE.$SERVERTABLREPORTSPRFDT.metric_id...
            }

            $sqlQuery = "select $DATABASE.$SERVERTABLREPORTSPRFDT.metric_id, $PERFPARSEDATABASE.perfdata_service_metric.metric, $DATABASE.$SERVERTABLREPORTSPRFDT.times, $DATABASE.$SERVERTABLREPORTSPRFDT.percentiles, $DATABASE.$SERVERTABLREPORTSPRFDT....

            $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


                      my $bgcolor = ( $toggle ) ? $COLORSTABLE{ENDBLOCK} : $COLORSTABLE{STARTBLOCK};
                      $perfdataDetailList .= "<tr bgcolor=\"$bgcolor\"><td colspan=\"2\">&nbsp;$sqlPERFDATA&nbsp;</td><td>&nbsp;<=&nbsp;$time&nbsp;$unit&nbsp;$expresionPERFPARSE</td></tr>\n" if ( $debug eq 'T' );

                      if ( $rv ) {
                        if ($sthPERFPARSE->rows) {
                          while( $sthPERFPARSE->fetch() ) {
                            unless ( $value ) {
                              $countRows = $countPERFPARSE;
                            } else {
                              if ( $percentagePERFDATA ) {
                                my $percentage = sprintf "%.2f", ( ( $countPERFPARSE / $countRows ) * 100 );
                                $percentage = "( $countPERFPARSE / $countRows ) * 100 = $percentage" if ( $debug eq 'T' );
                                $perfdataDetailList .= "<tr bgcolor=\"$bgcolor\"><td align=\"right\">&nbsp;$periodePERFPARSE&nbsp;</td><td align=\"right\">&nbsp;$percentage %&nbsp;</td><td>&nbsp;<=&nbsp;$time&nbsp;$unit&nbsp;$expresionPERFPARSE</td><...
                              } else {
                                $perfdataDetailList .= "<tr bgcolor=\"$bgcolor\"><td align=\"right\">&nbsp;$periodePERFPARSE&nbsp;</td><td align=\"right\">&nbsp;$countPERFPARSE #&nbsp;</td><td>&nbsp;<=&nbsp;$time&nbsp;$unit&nbsp;$expresionPERFPARSE</...
                              }
                            }
                          }
                        } elsif ( $debug eq 'T' ) {
                          $perfdataDetailList .= "<tr bgcolor=\"$bgcolor\"><td align=\"right\">&nbsp;</td><td align=\"right\">&nbsp;0 ". ( $percentagePERFDATA ? '%' : '#' ) ."&nbsp;</td><td>&nbsp;<=&nbsp;$time&nbsp;$unit&nbsp;$expresionPERFPARSE</td>...
                        }

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

                    if ( $percentagePERFDATA ) {
                      foreach my $percentile (split (/,/, $percentiles)) {
                        $toggle = ( $toggle ) ? 0 : 1;

                        my ($IR, $FR) = split (/\./, sprintf "%.2f", ( ( $percentile / 100 ) * ( $countRows + 1 ) ) );
                        my $limit = ( $FR eq '00' ) ? 1 : 2;
                        my $offset = $IR - 1;
                        $FR = sprintf "0.%d", $FR;

                        my $sqlWherePERFDATA;

                        if ( $PERFPARSEVERSION eq '20' ) {
                          $sqlWherePERFDATA = "WHERE metric_id = '$metric_id'";
                        } else {
                          my $catalogID_uKey1 = ( ( $CcatalogID eq 'CID' ) ? '' : $CcatalogID .'_' ) . $uKey1;

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


                        my $sqlPERFDATA = "SELECT ";
                        $sqlPERFDATA .= ( $PERFPARSEVERSION eq '20' ) ? "$groupPERFDATA(FROM_UNIXTIME(ctime))" : "$groupPERFDATA(ctime)";
                        $sqlPERFDATA .= ", value FROM $PERFPARSEDATABASE.perfdata_service_bin $sqlWherePERFDATA $sqlPeriodePERFDATA order by value limit $offset, $limit";

                        $sthPERFPARSE = $dbh->prepare( $sqlPERFDATA ) or $rv = error_trap_DBI("", "Cannot dbh->prepare: $sqlPERFDATA", $debug, '', "", '', "", -1, '', $sessionID);
                        $sthPERFPARSE->execute() or $rv = error_trap_DBI("", "Cannot sth->execute: $sqlPERFDATA", $debug, '', "", '', "", -1, '', $sessionID) if $rv;
                        $sthPERFPARSE->bind_columns( \$periodePERFPARSE, \$valuePERFPARSE ) or $rv = error_trap_DBI("", "Cannot sth->bind_columns: $sqlPERFDATA", $debug, '', "", '', "", -1, '', $sessionID) if $rv;

                        my $bgcolor = ( $toggle ) ? $COLORSTABLE{ENDBLOCK} : $COLORSTABLE{STARTBLOCK};
                        $perfdataDetailList .= "<tr bgcolor=\"$bgcolor\"><td colspan=\"2\">&nbsp;( ( $percentile / 100 ) * ( $countRows + 1 ) ), IR: $IR, FR: $FR, offset: $offset, limit: $limit & # $countRows&nbsp;<br>&nbsp;$sqlPERFDATA&nbsp;</td><td...

                        if ( $rv ) {
                          if ($sthPERFPARSE->rows) {
                            my ($value1, $value2);

                            while( $sthPERFPARSE->fetch() ) {
                              $value1 = $valuePERFPARSE unless (defined $value1);
                              $value2 = $valuePERFPARSE if (defined $value1);
                            }

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

                            if ( $unit ne $Unit ) {
                              if ( $Unit eq 'ms' ) {
                                $value1 /= 1000;
                                $value2 /= 1000;
                              }  elsif ( $Unit eq 's' ) {
                                $value1 *= 1000;
                                $value2 *= 1000;
                              }
                            }

                            my $percentilePERFPARSE = sprintf "%.2f $unit", ( "$FR" * ( $value2 - $value1 ) + $value1 );
                            $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>";
              }

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

      # Add icons to the chart as a custom field
      $c->addExtraField(\@icons);
    } elsif ( $selChart eq "ErrorDetails" ) {
      my $colors = [0xb8bc9c, 0xecf0b9, 0x999966, 0x333366, 0xc3c3e6, 0x594330,0xa0bdc4];
      $c->setColors2($perlchartdir::DataColor, $colors);
    }

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

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

      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) = @_;

          use POSIX qw(ceil floor);

          my ($calculatedMIN, $calculatedMAX, $calculatedNEW, $ActionItem);
          $calculated = sprintf("%.2f", $calculated * ( 100 + $percentage ) / 100 );

          if ( $tolerance ) {
            $calculatedMIN = sprintf("%.2f", $calculated * ( 100 - $tolerance  ) / 100 );
            $calculatedMAX = sprintf("%.2f", $calculated * ( 100 + $tolerance  ) / 100 );

            $calculatedNEW = $trendline >= $calculatedMIN && $trendline <= $calculatedMAX ? 0 : ( $calculatedMAX > $trendline ? ceil( $calculatedMAX ) : ( floor( ($calculatedMAX + $trendline) / 2 ) < $calculatedMAX ? ceil( ($calculatedMAX + $trendlin...
            $calculatedNEW = '' if ( $calculatedNEW == 0 or $calculatedNEW == $trendline );
          } else {
            $calculatedMIN = $calculatedMAX = $calculatedNEW = '';
          }

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


                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...
                  $ActionItem .= "<img src=\"$IMAGESURL/$ICONSRECORD{query}\" title=\"Update Trendline\" alt=\"Update Trendline\" border=\"0\">" if ( $userType >= 4 );
                  $ActionItem .= "</A>&nbsp;" if ( $userType >= 4 );
                }
              }
            }

            $matchingTrendlineCorrections .= "<tr bgcolor=\"$COLORSTABLE{STARTBLOCK}\"><td>$catalogID</td><td>$title</td><td>$uKey</td><td align=\"right\" bgcolor=\"#0F0F0F\">&nbsp;$trendline&nbsp;</td><td align=\"right\" bgcolor=\"#335566\">&nbsp;$c...
          }
        }

        my ($groupEND, $groupMAX, $catalogIDPREV, $uKeyPREV, $titlePREV, $testPREV, $resultsdirPREV, $trendlinePREV, $percentagePREV, $tolerancePREV) = (0, 0, 0, 0, 0, 25, 5);

        if ( $sth->rows ) {
		  while( $sth->fetch() ) {
            $groupEND = ( $uKeyPREV ne '0' and $uKeyPREV ne $uKey ) ? 1 : 0;

            if ( $groupEND ) {
              matchingTrendlineCorrections ($catalogIDPREV, $uKeyPREV, $titlePREV, $testPREV, $resultsdirPREV, $trendlinePREV, $percentagePREV, $tolerancePREV, $groupMAX);
              $groupMAX = $calculated;
            } else {
              $groupMAX = $calculated > $groupMAX ? $calculated : $groupMAX;
            }

            $catalogIDPREV  = $catalogID;
            $uKeyPREV       = $uKey;
            $titlePREV      = $title;
            $testPREV       = $test;
            $resultsdirPREV = $resultsdir;
            $trendlinePREV  = $trendline;
            $percentagePREV = $percentage;
		    $tolerancePREV  = $tolerance;
          }

          matchingTrendlineCorrections ($catalogIDPREV, $uKeyPREV, $titlePREV, $testPREV, $resultsdirPREV, $trendlinePREV, $percentagePREV, $tolerancePREV, $groupMAX);
        }

        $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
      }

      unless ( $shortlist ) {
        $sql = "select $SERVERTABLPLUGINS.catalogID, $SERVERTABLPLUGINS.uKey, concat( LTRIM(SUBSTRING_INDEX($SERVERTABLPLUGINS.title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as Title, $SERVERTABLPLUGINS.test, $SERVERTABLPLUGINS.resultsdi...
        $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, \$calculated ) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sql", $debug, $pagedir, $pageset, $htmlTitle, $subTitl...

        $matchingTrendlineCorrections .= '<tr><td '. $colspan .'">&nbsp</th></tr><tr><th align="center" colspan="'. $colspan .'"> Trendline = 0 </th></tr>'. $header;

        if ( $rv ) {
          if ( $sth->rows ) {
            while( $sth->fetch() ) {
              matchingTrendlineCorrections ($catalogID, $uKey, $title, $test, $resultsdir, $trendline, $percentage, $tolerance, $calculated);
            }
          }

          $sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
        }
      }

      $matchingTrendlineCorrections .= '</table>';
      $dbh->disconnect or $rv = error_trap_DBI(*STDOUT, "Sorry, the database was unable to add your entry.", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
    }

applications/log4perl.cnf  view on Meta::CPAN

#   %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
# log4perl.appender.<category>.layout.ConversionPattern = [%d] %H | %p | %P | %C | %c | %l - %m%n  %T%n
#
# [%r   ] %H              | %p    | %P    | %C                             | %c            | %l                                                                                                           - %m
#  %T%n
# [11723] crinaeatst01-sz | DEBUG | 19472 | ASNMTAP::Asnmtap::Applications | DBIx.Log4perl | ASNMTAP::Asnmtap::Applications::DBI_execute /opt/monitoring/lib/perl5/ASNMTAP/Asnmtap/Applications.pm (1951) - DBI_EXECUTE_ALARM_OFF: sth->execute timed out
#   ASNMTAP::Asnmtap::Applications::DBI_execute(1, 'REF(0x9fdff8)', 5, 'CODE(0xa0cd64)', 'ARRAY(0xb1521c)', 'REF(0x8fb6bc)', 'F') called at ./collector.pl line 1115, main::graphEntryDBI('SML', 'DUMMY-T5', 'Condenced View test', 'T', '/opt/monitoring/...

applications/tools/mysql/asnmtap-3.002.003-distributed_mysql-v5.0.x.sql  view on Meta::CPAN


CREATE TABLE `plugins` (
  `catalogID` varchar(5) NOT NULL default 'CID',
  `uKey` varchar(11) NOT NULL default '',
  `test` varchar(100) NOT NULL default '',
  `arguments` varchar(1024) default '',
  `argumentsOndemand` varchar(1024) default '',
  `title` varchar(75) NOT NULL default '',
  `trendline` smallint(6) NOT NULL default '0',
  `shortDescription` text,
  `percentage` tinyint(1) NOT NULL default '25',
  `tolerance` tinyint(1) NOT NULL default '5',
  `step` smallint(6) NOT NULL default '0',
  `ondemand` char(1) NOT NULL default '0',
  `production` char(1) NOT NULL default '0',
  `environment` char(1) NOT NULL default 'L',
  `pagedir` varchar(254) NOT NULL default '',
  `resultsdir` varchar(64) NOT NULL default '',
  `helpPluginFilename` varchar(100) default '<NIHIL>',
  `holidayBundleID` int(11) default '1',
  `activated` tinyint(1) NOT NULL default '0',

applications/tools/mysql/asnmtap-3.002.003-distributed_mysql-v5.0.x.sql  view on Meta::CPAN

  KEY `test` (`test`),
  KEY `title` (`title`),
  KEY `plugins_ibfk_1` (`catalogID`,`resultsdir`),
  KEY `plugins_ibfk_2` (`catalogID`,`holidayBundleID`),
  CONSTRAINT `plugins_ibfk_1` FOREIGN KEY (`catalogID`, `resultsdir`) REFERENCES `resultsdir` (`catalogID`, `resultsdir`),
  CONSTRAINT `plugins_ibfk_2` FOREIGN KEY (`catalogID`,`holidayBundleID`) REFERENCES `holidaysBundle` (`catalogID`,`holidayBundleID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*Data for the table `plugins` */

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

/*Table structure for table `reports` */

DROP TABLE IF EXISTS `reports`;

CREATE TABLE `reports` (
  `catalogID` varchar(5) NOT NULL default 'CID',
  `id` int(11) NOT NULL auto_increment,
  `uKey` varchar(11) NOT NULL default '',
  `reportTitle` varchar(100) NOT NULL default '',

applications/tools/mysql/asnmtap-3.002.003-distributed_mysql-v5.0.x.sql  view on Meta::CPAN

# Table structure for table reports_perfdata
#

DROP TABLE IF EXISTS `reports_perfdata`;

CREATE TABLE `reports_perfdata` (
  `catalogID` varchar(5) NOT NULL default 'CID',
  `uKey` varchar(11) NOT NULL,
  `metric_id` int(11) NOT NULL default '0',
  `times` varchar(64) NOT NULL,
  `percentiles` varchar(64) NOT NULL,
  `unit` enum('ms','s') NOT NULL default 's',
  `activated` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`catalogID`,`uKey`,`metric_id`),
  KEY `catalogID` (`catalogID`),
  KEY `uKey` (`uKey`),
  CONSTRAINT `reports_perfdata_ibfk_1` FOREIGN KEY (`catalogID`, `uKey`) REFERENCES `plugins` (`catalogID`, `uKey`)
) ENGINE=InnoDB;

/*Table structure for table `resultsdir` */

applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x.sql  view on Meta::CPAN


CREATE TABLE `plugins` (
  `catalogID` varchar(5) NOT NULL default 'CID',
  `uKey` varchar(11) NOT NULL default '',
  `test` varchar(100) NOT NULL default '',
  `arguments` varchar(1024) default '',
  `argumentsOndemand` varchar(1024) default '',
  `title` varchar(75) NOT NULL default '',
  `trendline` smallint(6) NOT NULL default '0',
  `shortDescription` text,
  `percentage` tinyint(1) NOT NULL default '25',
  `tolerance` tinyint(1) NOT NULL default '5',
  `step` smallint(6) NOT NULL default '0',
  `ondemand` char(1) NOT NULL default '0',
  `production` char(1) NOT NULL default '0',
  `environment` char(1) NOT NULL default 'L',
  `pagedir` varchar(254) NOT NULL default '',
  `resultsdir` varchar(64) NOT NULL default '',
  `helpPluginFilename` varchar(100) default '<NIHIL>',
  `holidayBundleID` int(11) default '1',
  `activated` tinyint(1) NOT NULL default '0',

applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x.sql  view on Meta::CPAN

  KEY `plugins_ibfk_1` (`catalogID`,`resultsdir`),
  KEY `plugins_ibfk_2` (`catalogID`,`holidayBundleID`),
  CONSTRAINT `plugins_ibfk_1` FOREIGN KEY (`catalogID`, `resultsdir`) REFERENCES `resultsdir` (`catalogID`, `resultsdir`),
  CONSTRAINT `plugins_ibfk_2` FOREIGN KEY (`catalogID`,`holidayBundleID`) REFERENCES `holidaysBundle` (`catalogID`,`holidayBundleID`)
) ENGINE=InnoDB;

#
# Data for the table plugins
#

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...
insert into `plugins` (`catalogID`,`uKey`,`test`,`arguments`,`argumentsOndemand`,`title`,`shortDescription`,`trendline`,`percentage`,`tolerance`,`step`,`ondemand`,`production`,`environment`,`pagedir`,`resultsdir`,`helpPluginFilename`,`holidayBundleID...

#
# Table structure for table reports
#

DROP TABLE IF EXISTS `reports`;

CREATE TABLE `reports` (
  `catalogID` varchar(5) NOT NULL default 'CID',
  `id` int(11) NOT NULL auto_increment,

applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x.sql  view on Meta::CPAN

# Table structure for table reports_perfdata
#

DROP TABLE IF EXISTS `reports_perfdata`;

CREATE TABLE `reports_perfdata` (
  `catalogID` varchar(5) NOT NULL default 'CID',
  `uKey` varchar(11) NOT NULL,
  `metric_id` int(11) NOT NULL default '0',
  `times` varchar(64) NOT NULL,
  `percentiles` varchar(64) NOT NULL,
  `unit` enum('ms','s') NOT NULL default 's',
  `activated` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`catalogID`,`uKey`,`metric_id`),
  KEY `catalogID` (`catalogID`),
  KEY `uKey` (`uKey`),
  CONSTRAINT `reports_perfdata_ibfk_1` FOREIGN KEY (`catalogID`, `uKey`) REFERENCES `plugins` (`catalogID`, `uKey`)
) ENGINE=InnoDB;

#
# Table structure for table resultsdir

lib/ASNMTAP/Asnmtap/Plugins.pod  view on Meta::CPAN

=item a.

no unit specified - assume a number (int or float) of things (eg, users, processes, load averages)

=item b.

s - seconds (also us, ms)

=item c.

% - percentage

=item d.

B - bytes (also KB, MB, TB)

=item e.

c - a continous counter (such as bytes transmitted on an interface)

=back

plugins/nagios/check_iowait.pl  view on Meta::CPAN


use ASNMTAP::Asnmtap::Plugins::Nagios v3.002.003;
use ASNMTAP::Asnmtap::Plugins::Nagios qw(:NAGIOS);

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

my $objectNagios = ASNMTAP::Asnmtap::Plugins::Nagios->new (
  _programName        => 'check_iowait.pl',
  _programDescription => 'IOWAIT',
  _programVersion     => '3.002.003',
  _programUsagePrefix => '-w|--warning <percent> -c|--critical <percent> -n|--numberStates <number of states> -i|--interval [cpu|size|res|time]',
  _programHelpPrefix  => "-w, --warning=<percent>
    PERCENT: Percent allocated when to warn
-c, --critical=<percent>
    PERCENT: Percent allocated when critical
-n, --numberStates=<number of states>
-i, --interval=<number in second between two states>",
  _programGetOptions  => ['warning|w=s', 'critical|c=s', 'numberStates|n=f', 'interval|i=s'],
  _timeout            => 10,
  _debug              => 0);

my $warning   = $objectNagios->getOptionsArgv ('warning');
my $critical  = $objectNagios->getOptionsArgv ('critical');

plugins/nagios/check_memory-free.pl  view on Meta::CPAN


use ASNMTAP::Asnmtap::Plugins::Nagios v3.002.003;
use ASNMTAP::Asnmtap::Plugins::Nagios qw(:NAGIOS);

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

my $objectNagios = ASNMTAP::Asnmtap::Plugins::Nagios->new (
  _programName        => 'check_memory-free.pl',
  _programDescription => 'MEMORY',
  _programVersion     => '3.002.003',
  _programUsagePrefix => '-w|--warning <percent> -c|--critical <percent>',
  _programHelpPrefix  => "-w, --warning=<percent>
    PERCENT: Percent allocated when to warn
-c, --critical=<percent>
    PERCENT: Percent allocated when critical",
  _programGetOptions  => ['warning|w=s', 'critical|c=s'],
  _timeout            => 10,
  _debug              => 0);

my $warning   = $objectNagios->getOptionsArgv ('warning');
my $critical  = $objectNagios->getOptionsArgv ('critical');
my $tOstype   = $objectNagios->getOptionsArgv ('ostype');
my $tMetric   = $objectNagios->getOptionsArgv ('metric');
$objectNagios->printUsage ('Missing command line argument metric') unless ( defined $tMetric);

plugins/nagios/check_memory-free.pl  view on Meta::CPAN


$objectNagios->printUsage ('Only ostype Linux is supported!') unless ( defined $osType and $osType =~ /^Linux$/ );
$objectNagios->printUsage ('You must define WARNING and CRITICAL levels!') unless ($warning != 0 and $critical != 0);
$objectNagios->printUsage ('WARNING level must not be greater than CRITICAL when checking memory!') if ($warning >= $critical);

my $warn_level = $warning;
my $crit_level = $critical;

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

my ($returnCode, $warn_level_perfdata, $crit_level_perfdata, $result, $total_mem, $free_mem, $used_mem, $percent, $fmt_pct);

$objectNagios->exit (5) if ( $objectNagios->call_system ( 'free' ) );
$result = $objectNagios->pluginValue ('result');

if ($result !~ /Mem:\s+(\d+)\s+(\d+)\s+(\d+)/) {
  $objectNagios->pluginValue ( stateValue => $ERRORS{UNKNOWN} );
  $objectNagios->exit (5);
}

# Define the calculating scalars

plugins/nagios/check_memory-free.pl  view on Meta::CPAN

$free_mem  = int(convert_from_KB_to_metric($metric, $free_mem));

$warn_level_perfdata = ($total_mem / 100) * $warn_level;
$warn_level_perfdata = sprintf("%.2f", $warn_level_perfdata) if ($metric ne 'kB');

$crit_level_perfdata = ($total_mem / 100) * $crit_level;
$crit_level_perfdata = sprintf("%.2f", $crit_level_perfdata) if ($metric ne 'kB');

$objectNagios->appendPerformanceData ( "'Used mem'=$used_mem$metric;$warn_level_perfdata;$crit_level_perfdata;0;$total_mem" );

$percent = ($used_mem / $total_mem) * 100;
$fmt_pct = sprintf "%.2f", $percent;

$returnCode = ( $percent >= $crit_level ? $ERRORS{CRITICAL} : ( $percent >= $warn_level ? $ERRORS{WARNING} : $ERRORS{OK} ) );
$objectNagios->pluginValues ( { stateValue => $returnCode, alert => "$fmt_pct% ($total_mem $metric) used" }, $TYPE{APPEND} );
$objectNagios->exit (5);

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

plugins/nagios/check_memory-top.pl  view on Meta::CPAN


use ASNMTAP::Asnmtap::Plugins::Nagios v3.002.003;
use ASNMTAP::Asnmtap::Plugins::Nagios qw(:NAGIOS);

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

my $objectNagios = ASNMTAP::Asnmtap::Plugins::Nagios->new (
  _programName        => 'check_memory-free.pl',
  _programDescription => 'MEMORY',
  _programVersion     => '3.002.003',
  _programUsagePrefix => '-w|--warning <percent> -c|--critical <percent> -n|--numberProcesses <number of processes> -s|--sortingOrder [cpu|size|res|time] -M|--memory [F|U]',
  _programHelpPrefix  => "-w, --warning=<percent>
    PERCENT: Percent allocated when to warn
-c, --critical=<percent>
    PERCENT: Percent allocated when critical
-n, --numberProcesses=<number of processes>
-s, --sortingOrder=[cpu|size|res|time]
-M, --memory=[F|U]
    Check F(ree)/U(sed) memory",
  _programGetOptions  => ['warning|w=s', 'critical|c=s', 'numberProcesses|n=f', 'sortingOrder|s=s', 'memory|M=s'],
  _timeout            => 10,
  _debug              => 0);

my $warning   = $objectNagios->getOptionsArgv ('warning');

plugins/nagios/check_memory-top.pl  view on Meta::CPAN

$objectNagios->printUsage ('Only ostype Solaris, Solaris10 and True64 is supported!') unless ( defined $osType and $osType =~ /^(?:Solaris|Solaris10|True64)$/ );
$objectNagios->printUsage ('You must define WARNING and CRITICAL levels!') unless ($warning != 0 and $critical != 0);
$objectNagios->printUsage ('WARNING level must not be greater than CRITICAL when checking memory!') if ($memory eq 'U' and $warning >= $critical);
$objectNagios->printUsage ('CRITICAL level must not be greater than WARNING when checking memory!') if ($memory eq 'F' and $critical >= $warning);

my $warn_level = $warning;
my $crit_level = $critical;

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

my ($returnCode, $result, $topHeader, $topDetail, $memory_line, $free_memory, $used_memory, $total_memory, $percent, $fmt_pct, $warn_level_perfdata, $crit_level_perfdata);

if ($osType eq 'TRU64') {
  $topHeader = '\\s+PID\\s+USERNAME\\s+PRI\\s+NICE\\s+SIZE\\s+RES\\s+STATE\\s+TIME\\s+CPU\\s+COMMAND';
  $topDetail = '\\s*\\d+\\s+\\w+\\s+\\d+\\s+-?\\d+\\s+([0-9.]+)([kMG])\\s+([0-9.]+)([kMG])\\s+[\\w|\\d|/]+\\s+([0-9:.H]+)\\s+([0-9.]+)%\\s+(\\w+)';
} else {
  $topHeader = '\\s+PID\\s+USERNAME\\s+\\w+\\s+PRI\\s+NICE\\s+SIZE\\s+RES\\s+STATE\\s+TIME\\s+CPU\\s+COMMAND';
  $topDetail = '\\s*\\d+\\s+\\w+\\s+\\d+\\s+\\d+\\s+-?\\d+\\s+([0-9.]+)([kKMG])\\s+([0-9.]+)([kKMG])\\s+[\\w|\\d|/]+\\s+([0-9:.H]+)\\s+([0-9.]+)%\\s+(\\w+)';
}

$objectNagios->exit (5) if ( $objectNagios->call_system ( "top -b $numberProcesses -S -o $sortingOrder | grep -v sleep" ) );

plugins/nagios/check_memory-top.pl  view on Meta::CPAN

  if ($memory eq 'F') {
    $warn_level_perfdata = $total_memory - $warn_level_perfdata;
    $crit_level_perfdata = $total_memory - $crit_level_perfdata;
  }

  $objectNagios->appendPerformanceData ( "'Memory usage'=$used_memory$metric;$warn_level_perfdata;$crit_level_perfdata;0;$total_memory" );
  $objectNagios->appendPerformanceData ( "Size=$totalSizeValue$metric;0;0;0;$total_memory" );
  $objectNagios->appendPerformanceData ( "Res=$totalResValue$metric;0;0;0;$total_memory" );

  if ($memory eq 'F') {
    $percent = ($free_memory / $total_memory) * 100;
    $fmt_pct = sprintf "%.1f", $percent;
    $returnCode = ( $percent <= $crit_level ? $ERRORS{CRITICAL} : ( $percent <= $warn_level ? $ERRORS{WARNING} : $ERRORS{OK} ) );
    $objectNagios->pluginValues ( { stateValue => $returnCode, alert => "$fmt_pct% ($free_memory $metric) free" }, $TYPE{APPEND} );
  } else {
    $percent = ($used_memory / $total_memory) * 100;
    $fmt_pct = sprintf "%.1f", $percent;
    $returnCode = ( $percent >= $crit_level ? $ERRORS{CRITICAL} : ( $percent >= $warn_level ? $ERRORS{WARNING} : $ERRORS{OK} ) );
    $objectNagios->pluginValues ( { stateValue => $returnCode, alert => "$fmt_pct% ($used_memory $metric) used" }, $TYPE{APPEND} );
  }
} else {
  $objectNagios->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, alert => 'Memory information not found' }, $TYPE{APPEND} );
}

$objectNagios->pluginValues ( { alert => "Size: $totalSizeValue $metric - Res: $totalResValue $metric" }, $TYPE{APPEND} );
$objectNagios->exit (5);

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

plugins/nagios/check_swap-allocated.pl  view on Meta::CPAN


use ASNMTAP::Asnmtap::Plugins::Nagios v3.002.003;
use ASNMTAP::Asnmtap::Plugins::Nagios qw(:NAGIOS);

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

my $objectNagios = ASNMTAP::Asnmtap::Plugins::Nagios->new (
  _programName        => 'check_swap-allocated.pl',
  _programDescription => 'SWAP allocated',
  _programVersion     => '3.002.003',
  _programUsagePrefix => '-w|--warning <percent> -c|--critical <percent>',
  _programHelpPrefix  => "-w, --warning=<percent>
    PERCENT: Percent allocated when to warn
-c, --critical=<percent>
    PERCENT: Percent allocated when critical",
  _programGetOptions  => ['warning|w=s', 'critical|c=s'],
  _timeout            => 10,
  _debug              => 0);

my $warning   = $objectNagios->getOptionsArgv ('warning');
my $critical  = $objectNagios->getOptionsArgv ('critical');
my $tOstype   = $objectNagios->getOptionsArgv ('ostype');
my $tMetric   = $objectNagios->getOptionsArgv ('metric');
$objectNagios->printUsage ('Missing command line argument metric') unless ( defined $tMetric);

plugins/nagios/check_swap-allocated.pl  view on Meta::CPAN


$objectNagios->printUsage ('Only ostype Solaris is supported!') unless ( defined $osType and $osType =~ /^Solaris$/ );
$objectNagios->printUsage ('You must define WARNING and CRITICAL levels!') unless ($warning != 0 and $critical != 0);
$objectNagios->printUsage ('WARNING level must not be greater than CRITICAL when checking allocated swap!') if ($warning >= $critical);

my $warn_level = $warning;
my $crit_level = $critical;

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

my ($returnCode, $warn_level_perfdata, $crit_level_perfdata, $result, $total_swap, $free_swap, $used_swap, $allocated_swap, $reserved_swap, $percent, $fmt_pct);

$objectNagios->exit (5) if ( $objectNagios->call_system ( 'swap -s' ) );
$result = $objectNagios->pluginValue ('result');

$result =~ s/^total: ([0-9.]+)([kMG]) bytes allocated \+ ([0-9.]+)([kMG]) reserved \= ([0-9.]+)([kMG]) used, ([0-9.]+)([kMG]) available$/$1 $2 $3 $4 $5 $6 $7 $8/gi;

my @top = split (/ /, $result);

unless ( @top ) {
  $objectNagios->pluginValue ( stateValue => $ERRORS{UNKNOWN} );

plugins/nagios/check_swap-allocated.pl  view on Meta::CPAN

$warn_level_perfdata = ($total_swap / 100) * $warn_level;
$warn_level_perfdata = sprintf("%.2f", $warn_level_perfdata) if ($metric ne 'kB');

$crit_level_perfdata = ($total_swap / 100) * $crit_level;
$crit_level_perfdata = sprintf("%.2f", $crit_level_perfdata) if ($metric ne 'kB');

$objectNagios->appendPerformanceData ( "'Allocated usage'=$allocated_swap$metric;$warn_level_perfdata;$crit_level_perfdata;0;$total_swap" );
$objectNagios->appendPerformanceData ( "'Reserved usage'=$reserved_swap$metric;;;0;$total_swap" );
$objectNagios->appendPerformanceData ( "'Used usage'=$used_swap$metric;;;0;$total_swap" );

$percent = ($allocated_swap / $total_swap) * 100;
$fmt_pct = sprintf "%.1f", $percent;

$returnCode = ( $percent >= $crit_level ? $ERRORS{CRITICAL} : ( $percent >= $warn_level ? $ERRORS{WARNING} : $ERRORS{OK} ) );
$objectNagios->pluginValues ( { stateValue => $returnCode, alert => "$fmt_pct% ($allocated_swap $metric) allocated" }, $TYPE{APPEND} );
$objectNagios->exit (5);

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

plugins/nagios/check_swap.pl  view on Meta::CPAN


use ASNMTAP::Asnmtap::Plugins::Nagios v3.002.003;
use ASNMTAP::Asnmtap::Plugins::Nagios qw(:NAGIOS);

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

my $objectNagios = ASNMTAP::Asnmtap::Plugins::Nagios->new (
  _programName        => 'check_swap.pl',
  _programDescription => 'SWAP',
  _programVersion     => '3.002.003',
  _programUsagePrefix => '-w|--warning <percent> -c|--critical <percent>',
  _programHelpPrefix  => "-w, --warning=<percent>
    PERCENT: Percent allocated when to warn
-c, --critical=<percent>
    PERCENT: Percent allocated when critical",
  _programGetOptions  => ['warning|w=s', 'critical|c=s'],
  _timeout            => 10,
  _debug              => 0);

my $warning   = $objectNagios->getOptionsArgv ('warning');
my $critical  = $objectNagios->getOptionsArgv ('critical');
my $tOstype   = $objectNagios->getOptionsArgv ('ostype');
my $tMetric   = $objectNagios->getOptionsArgv ('metric');
$objectNagios->printUsage ('Missing command line argument metric') unless ( defined $tMetric);

plugins/nagios/check_swap.pl  view on Meta::CPAN


$objectNagios->printUsage ('Only ostype Linux is supported!') unless ( defined $osType and $osType =~ /^Linux$/ );
$objectNagios->printUsage ('You must define WARNING and CRITICAL levels!') unless ($warning != 0 and $critical != 0);
$objectNagios->printUsage ('WARNING level must not be greater than CRITICAL when checking swap!') if ($warning >= $critical);

my $warn_level = $warning;
my $crit_level = $critical;

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

my ($returnCode, $warn_level_perfdata, $crit_level_perfdata, $result, $total_swap, $free_swap, $used_swap, $percent, $fmt_pct);

$objectNagios->exit (5) if ( $objectNagios->call_system ( 'free | tail -n1' ) );
$result = $objectNagios->pluginValue ('result');

if ($result !~ /^Swap:\s+(\d+)\s+(\d+)\s+(\d+)/) {
  $objectNagios->pluginValue ( stateValue => $ERRORS{UNKNOWN} );
  $objectNagios->exit (5);
}

# Define the calculating scalars

plugins/nagios/check_swap.pl  view on Meta::CPAN

$free_swap  = int(convert_from_KB_to_metric($metric, $free_swap));

$warn_level_perfdata = ($total_swap / 100) * $warn_level;
$warn_level_perfdata = sprintf("%.2f", $warn_level_perfdata) if ($metric ne 'kB');

$crit_level_perfdata = ($total_swap / 100) * $crit_level;
$crit_level_perfdata = sprintf("%.2f", $crit_level_perfdata) if ($metric ne 'kB');

$objectNagios->appendPerformanceData ( "'Used swap'=$used_swap$metric;$warn_level_perfdata;$crit_level_perfdata;0;$total_swap" );

$percent = ($used_swap / $total_swap) * 100;
$fmt_pct = sprintf "%.2f", $percent;

$returnCode = ( $percent >= $crit_level ? $ERRORS{CRITICAL} : ( $percent >= $warn_level ? $ERRORS{WARNING} : $ERRORS{OK} ) );
$objectNagios->pluginValues ( { stateValue => $returnCode, alert => "$fmt_pct% ($total_swap $metric) used" }, $TYPE{APPEND} );
$objectNagios->exit (5);

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

plugins/templates/check_template-cluster.pl  view on Meta::CPAN


use DBI;
use Time::Local;

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

my $objectPlugins = ASNMTAP::Asnmtap::Plugins->new (
  _programName        => 'check_template-cluster.pl',
  _programDescription => "Cluster plugin for testing the '$APPLICATION'",
  _programVersion     => '3.002.003',
  _programUsagePrefix => '--message=<message> --uKeys|-K=<uKey[%weight][:uKey[%weight]]> --method=[highest-status|non-OK|percentage|weight] --outOfDate=<THRESHOLD> -w|--warning=<VALUE> -c|--critical=<VALUE> [--downgradingStatus=[F|T]] [--ignoreDepend...
  _programHelpPrefix  => '--message=<message>
   --message=message
-K, --uKeys=<uKey[%weight][:uKey[%weight]]>
   highest-status: specifies the range of uKey in the cluster
   non-OK        : specifies the range of uKey in the cluster
   percentage    : specifies the range of uKey in the cluster
   weight        : specifies the range of uKey with weight in the cluster
-m, --method=[highest-status|non-OK|percentage|weight]
   highest-status: highest-status cluster monitoring
   non-OK        : non-OK cluster monitoring with WARNING and CRITICAL thresholds
   percentage    : percentage cluster monitoring with WARNING and CRITICAL percentages
   weight        : weight cluster monitoring with WARNING and CRITICAL percentages
--outOfDate==<THRESHOLD>
  specifies the out of date threshold in minutes for a single test
-w, --warning=<VALUE>
   highest-status: not applicable
   non-OK        : specifies the clusters threshold that must be in a non-OK state in order to return a WARNING status level
   percentage    : specifies the clusters percentage that must be in a WARNING state to return a WARNING status level
   weight        : specifies the clusters weight that must be in a WARNING state to return a WARNING status level
-c, --critical=<VALUE>
   highest-status: not applicable
   non-OK        : specifies the clusters threshold that must be in a non-OK state in order to return a CRITICAL status level
   percentage    : specifies the clusters percentage that must be in a CRITICAL or higher state to return a CRITICAL status level
   weight        : specifies the clusters weight that must be in a CRITICAL or higher state to return a CRITICAL status level
--downgradingStatus=[F|T]
   highest-status: not applicable
   non-OK        : if (highest event status = warning) and (calculated status = critical) then alarm status downgrated to warning level, default: true
   percentage    : not applicable
   weight        : not applicable
--ignoreDependent=[F|T]
   do ignore tests in scheduled dependent, default: false
--ignoreOffline=[F|T]
   do ignore tests in scheduled offline, default: false
--ignoreNoTest=[F|T]
   do ignore tests in scheduled no-test, default: false
-s, --server=<hostname> (default: localhost)
--database=<database> (default: asnmtap)',
  _programGetOptions  => ['message=s', 'uKeys|K=s', 'method=s', 'outOfDate=i', 'warning|w:i', 'critical|c:i', 'downgradingStatus:s', 'ignoreDependent:s', 'ignoreOffline:s', 'ignoreNoTest:s', 'server|s:s', 'port|P:i', 'database:s', 'username|u|loginna...

plugins/templates/check_template-cluster.pl  view on Meta::CPAN


my $message         = $objectPlugins->getOptionsArgv ('message');
$objectPlugins->printUsage ( 'Missing command line argument message' ) unless (defined $message);
$objectPlugins->pluginValue ( message => $message );

my $uKeys             = $objectPlugins->getOptionsArgv ('uKeys');
$objectPlugins->printUsage ( 'Missing command line argument uKeys' ) unless ( defined $uKeys );

my $method            = $objectPlugins->getOptionsArgv ('method');
$objectPlugins->printUsage ( 'Missing command line argument method' ) unless ( defined $method );
$objectPlugins->printUsage ( 'Unsupported method' ) unless ( $method =~ /^(?:highest-status|non-OK|percentage|weight)$/ );

my ( %uKeys, @uKeys, $_uKey, $uKeyCount, %status, $_status, %cluster, %weight );
$uKeyCount = ( @uKeys = split ( /:/, $uKeys ) );
$objectPlugins->printUsage ( 'Cluster plugin need at least two uKey') unless ( $uKeyCount > 1 );

if ( $method eq 'weight' ) {
  my ( @_uKeys, $totalWeight );

  foreach $_uKey ( @uKeys ) {
    my ($uKey, $weight) = split ( /%/, $_uKey );

plugins/templates/check_template-cluster.pl  view on Meta::CPAN

    $totalWeight += $weight;
    $uKeys{$uKey}{weight} = $weight;
  }

  $objectPlugins->printUsage ( 'Clusters total weight must equals 100%') unless ( $totalWeight == 100 );
  @uKeys = @_uKeys;
}

my ( $warning, $critical, $downgradingStatus );

if ( $method =~ /^(?:non-OK|percentage|weight)$/ ) {
  $warning            = $objectPlugins->getOptionsArgv ('warning');
  $critical           = $objectPlugins->getOptionsArgv ('critical');

  if ( $method eq 'non-OK' ) {
    $objectPlugins->printUsage ( 'Critical threshold ' .$critical. ' should be larger than warning threshold ' .$warning ) unless ( $critical > $warning );
    $objectPlugins->printUsage ( 'Warning threshold should be less than count uKey' ) unless ( $warning < $uKeyCount );
    $objectPlugins->printUsage ( 'Critical threshold should be less or equal than count uKey' ) unless ( $critical <= $uKeyCount );

    $downgradingStatus  =  $objectPlugins->getOptionsArgv ('downgradingStatus') ? $objectPlugins->getOptionsArgv ('downgradingStatus') : 'T';
    $objectPlugins->printUsage ( 'Command line parameters for downgradingStatus: F(alse) or T(rue)' ) unless ( $downgradingStatus =~ /^[FT]$/ );
  } elsif ( $method eq 'percentage' ) {
    $objectPlugins->printUsage ( 'Warning percentage should be less or equal than 100' ) unless ( $warning <= 100 );
    $objectPlugins->printUsage ( 'Critical percentage should be less or equal than 100' ) unless ( $critical <= 100 );
  } elsif ( $method eq 'weight' ) {
    $objectPlugins->printUsage ( 'Critical weight ' .$critical. ' should be larger than warning weight ' .$warning ) unless ( $critical > $warning );
  }
}

my $outOfDate         =  $objectPlugins->getOptionsArgv ('outOfDate');
$objectPlugins->printUsage ( 'Missing command line argument out of date' ) unless ( defined $outOfDate );
$outOfDate *= 60; # convert to seconds

my $ignoreDependent   =  $objectPlugins->getOptionsArgv ('ignoreDependent')   ? $objectPlugins->getOptionsArgv ('ignoreDependent')   : 'F';

plugins/templates/check_template-cluster.pl  view on Meta::CPAN

        }
      } elsif ( $warning and $cluster{non_OK} >= $warning ) {
        $objectPlugins->pluginValues ( { stateValue => $ERRORS{WARNING}, alert => $clusterStatus . 'WARNING - Performance degraded' }, $TYPE{APPEND} );
      } else {
        $objectPlugins->pluginValues ( { stateValue => $ERRORS{OK}, alert => $clusterStatus . 'OK' }, $TYPE{APPEND} );
      }
    }

    last;
  };
  /^percentage$/ && do {
    my $clusterCRITICAL    = $uKeyCount - $cluster{OK} - $cluster{WARNING};
    my $percentageCRITICAL = ( $clusterCRITICAL / $uKeyCount ) * 100;
    my $percentageWARNING  = ( $cluster{WARNING} / $uKeyCount ) * 100;
    my $percentageStatus   = ( ( $percentageCRITICAL >= $critical ) ? $STATE{$ERRORS{CRITICAL}} : ( ( $percentageCRITICAL + $percentageWARNING >= $warning ) ? $STATE{$ERRORS{WARNING}} : $STATE{$ERRORS{OK}} ) );

    $clusterStatus .= 'WARNING ' .$percentageWARNING. '% - CRITICAL ' .$percentageCRITICAL. '% : ';
    $objectPlugins->pluginValues ( { stateValue => $ERRORS{$percentageStatus}, alert => $clusterStatus . $percentageStatus }, $TYPE{APPEND} );
    $objectPlugins->appendPerformanceData ( 'WARNING=' .$percentageWARNING. '"%;' .$warning. ';;; CRITICAL=' .$percentageCRITICAL. '%;' .$critical. ';;;' );
    last;
  };
  /^weight$/ && do {
    my $weightStatus = ( ( $weight{CRITICAL} >= $critical ) ? $STATE{$ERRORS{CRITICAL}} : ( ( $weight{CRITICAL} + $weight{WARNING} >= $warning ) ? $STATE{$ERRORS{WARNING}} : $STATE{$ERRORS{OK}} ) );

    $clusterStatus .= 'WARNING ' .$weight{WARNING}. '% - CRITICAL ' .$weight{CRITICAL}. '% : ';
    $objectPlugins->pluginValues ( { stateValue => $ERRORS{$weightStatus}, alert => $clusterStatus . $weightStatus }, $TYPE{APPEND} );
    $objectPlugins->appendPerformanceData ( 'WARNING=' .$weight{WARNING}. '"%;' .$warning. ';;; CRITICAL=' .$weight{CRITICAL}. '%;' .$critical. ';;;' );
    last;
  };



( run in 0.413 second using v1.01-cache-2.11-cpan-05162d3a2b1 )