more module updates

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-20 18:13:58 +02:00
parent 55b23a2cec
commit 2121a356b3
51 changed files with 1638 additions and 851 deletions

View File

@@ -232,11 +232,14 @@ Cron is NOT used to do this, since we want to keep the transfer to a minimum.
Hidden link
===========
Production check adds a 'hidden link' to the site where you can check the APC
status of your site. This page can be found on /admin/reports/status/apc.
This is in analogy with the system module that adds these 'hidden pages':
Production check adds some 'hidden links' to the site where you can check the
APC, Memcache and DB status of your site. These pages can be found on:
/admin/reports/status/apc
/admin/reports/status/memcache
/admin/reports/status/database
This is in analogy with the system module that adds this 'hidden page':
/admin/reports/status/php
/admin/reports/status/sql
Truely unmissable when setting up your site on a production server to check if
all is well!

View File

@@ -1,5 +1,5 @@
/* Prod monitor settings page styling */
/* Prod check settings page styling */
.prod-check-settings{float:left;padding:0 5px;}
.prod-check-settings.odd{background-color:#f8f8f8;}

View File

@@ -395,9 +395,9 @@ function prod_check_settings_form_validate($form, &$form_state) {
// seem logical...
$base = drupal_get_path('module', 'prod_check');
drupal_add_css($base . '/css/prod-check.css');
drupal_add_js($base . '/js/jquery.equalheights.js', 'module', 'header');
drupal_add_js($base . '/js/jquery.maskedinput.min.js', 'module', 'header');
drupal_add_js($base . '/js/prod-check.js', 'module', 'header');
drupal_add_js($base . '/js/jquery.equalheights.js');
drupal_add_js($base . '/js/jquery.maskedinput.min.js');
drupal_add_js($base . '/js/prod-check.js');
if (module_exists('dblog')) {
if (!is_numeric($form_state['values']['prod_check_dblog_php_threshold'])) {
@@ -737,6 +737,297 @@ function prod_check_prod_mode_modules($options) {
return $modules;
}
/**
* Generate default key if none is present.
*/
function prod_check_generate_key($length = 25) {
$chars = 'abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ+-*#&@!?';
$size = strlen($chars);
$key = '';
for ($i = 0; $i < $length; $i++) {
$key .= $chars[rand(0, $size - 1)];
}
return $key;
}
/**
* Database status page.
*/
function prod_check_dbstatus() {
// Get active connection.
$pdo = Database::getConnection();
// Get database driver.
$db_type = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
$details = array(
'status' => array(),
'tables' => array(),
'databases' => array(),
);
$add_js = FALSE;
$title = '';
$db = $db_type;
switch($db_type) {
case 'pgsql':
// Set title & version.
$server = db_query('SELECT version()')->fetchField();
$title = t('Running @version', array('@version' => $server));
// Get detailed status.
$details = _prod_check_dbstatus_pgsql($details);
break;
case 'mysql':
$db = 'MySQL';
// Get detailed status.
$details = _prod_check_dbstatus_mysql($details);
// NO break here!
default:
// Set title & version.
$server = $pdo->getAttribute(PDO::ATTR_SERVER_VERSION);
$title = t('Running @db @version', array('@db' => $db, '@version' => $server));
break;
}
// Get basic status.
$status = '';
try {
$status = $pdo->getAttribute(PDO::ATTR_SERVER_INFO);
if (is_array($status)) {
$status = implode("<br />\n", $status);
}
else {
$status = str_replace(' ', "<br />\n", $status);
}
} catch(Exception $e) {}
// Get additional status.
$additional = '';
$attributes = array(
'AUTOCOMMIT' => 'Auto commit',
'PREFETCH' => 'Prefetch',
'TIMEOUT' => 'Timeout',
'ERRMODE' => 'Error mode',
'CLIENT_VERSION' => 'Client version',
'CONNECTION_STATUS' => 'Connection status',
'CASE' => 'Case',
'CURSOR_NAME' => 'Cursor name',
'CURSOR' => 'Cursor',
'ORACLE_NULLS' => 'Oracle nulls',
'PERSISTENT' => 'Persistent',
'STATEMENT_CLASS' => 'Statement class',
'FETCH_CATALOG_NAMES' => 'Fatch catalog names',
'FETCH_TABLE_NAMES' => 'Fetch table names',
'STRINGIFY_FETCHES' => 'Stringify fetches',
'MAX_COLUMN_LEN' => 'Max column length',
'DEFAULT_FETCH_MODE' => 'Default fetch mode',
'EMULATE_PREPARES' => 'Emulate prepares',
);
foreach ($attributes as $constant => $name) {
try {
$result = $pdo->getAttribute(constant("PDO::ATTR_$constant"));
if (is_bool($result)) {
$result = $result ? 'TRUE' : 'FALSE';
}
elseif (is_array($result) || is_object($result)) {
$add_js = TRUE;
include_once DRUPAL_ROOT . '/includes/utility.inc';
$class = strtolower(str_replace('_', '-', $constant));
$link = l(
t('Show details'),
'admin/reports/status/database',
array(
'attributes' => array(
'class' => array('show-more'),
'data-details' => $class
)
)
);
// Seemed a bit overkill to create a css file only for this display:none
// thingy.
$result = $link . '<pre class="' . $class . '" style="display:none;">' . drupal_var_export($result) . '</pre>';
}
$additional .= $name . ': ' . $result . "<br />\n";
} catch (Exception $e) {}
}
$status = "$additional<br />\n$status";
if ($add_js) {
$base = drupal_get_path('module', 'prod_check');
drupal_add_js($base . '/js/prod-check-database.js');
}
return theme('prod_check_dbstatus', array('title' => $title, 'status' => $status, 'details' => $details));
}
/**
* Helper function to return MySQL detailed status info.
*/
function _prod_check_dbstatus_mysql($details) {
$db_name = '';
// Feels like there should be a better way of getting the current database
// name.
$db_setting = Database::getConnectionInfo();
foreach($db_setting as $params) {
if(isset($params['database'])) {
// We get the first name we find.
$db_name = $params['database'];
break;
}
}
// Get detailed status.
$rows = array();
try {
$result = db_query('SHOW STATUS');
foreach ($result as $row) {
$rows[] = array($row->Variable_name, $row->Value);
}
} catch (Exception $e) {}
if ($rows) {
$details['status'] = array(
'title' => t('Detailed status'),
'header' => array(
t('Variable'),
t('Value'),
),
'rows' => $rows,
);
}
// Get all tables.
$rows = array();
try {
// We cannot use the standard db_query with arguments here as the argument
// should NOT be enclosed in quotes.
$result = db_query(sprintf('SHOW TABLES FROM %s', $db_name));
$property = 'Tables_in_' . $db_name;
foreach ($result as $row) {
$rows[] = array($row->$property);
}
} catch (Exception $e) {}
if ($rows) {
$details['tables'] = array(
'title' => t('Tables for active database %name', array('%name' => $db_name)),
'header' => array(
t('Table'),
),
'rows' => $rows,
);
}
// Get all databases.
$rows = array();
try {
$result = db_query('SHOW DATABASES');
foreach ($result as $row) {
$rows[] = array($row->Database);
}
} catch (Exception $e) {}
if ($rows) {
$details['databases'] = array(
'title' => t('Available databases'),
'header' => array(
t('Database'),
),
'rows' => $rows,
);
}
return $details;
}
/**
* Helper function to return PostgreSQL status info.
*
* Useful links for possible expansion:
* http://www.php.net/manual/en/book.pgsql.php
* http://www.alberton.info/postgresql_meta_info.html#.UbXmAFQW3eU
* http://www.postgresql.org/docs/devel/static/catalog-pg-statistic.html
* http://www.postgresql.org/docs/9.0/static/functions-info.html
* http://www.postgresql.org/docs/9.0/static/functions-admin.html
*/
function _prod_check_dbstatus_pgsql($db_name, $details) {
// Get detailed status.
$rows = array();
try {
// See http://www.postgresql.org/docs/9.0/static/view-pg-settings.html
$result = db_query('SELECT * FROM pg_settings');
foreach ($result as $row) {
/* TODO: add some more detail here? This is available:
Column | Type | Modifiers | Storage | Description
------------+------+-----------+----------+-------------
name | text | | extended |
setting | text | | extended |
unit | text | | extended |
category | text | | extended |
short_desc | text | | extended |
extra_desc | text | | extended |
context | text | | extended |
vartype | text | | extended |
source | text | | extended |
min_val | text | | extended |
max_val | text | | extended | */
$rows[] = array($row->name, $row->setting);
}
} catch (Exception $e) {}
if ($rows) {
$details['status'] = array(
'title' => t('Detailed status'),
'header' => array(
t('Name'),
t('Setting'),
),
'rows' => $rows,
);
}
// Get all tables.
$rows = array();
try {
// See http://www.postgresql.org/docs/9.0/static/catalog-pg-class.html
// relclass: r = ordinary table, i = index, S = sequence, v = view, c = composite type, t = TOAST table
$result = db_query("SELECT relname FROM pg_class WHERE relname !~ '^(pg_|sql_)' AND relkind = 'r'");
foreach ($result as $row) {
$rows[] = array($row->relname);
}
} catch (Exception $e) {}
if ($rows) {
$details['tables'] = array(
'title' => t('Tables for active database %name', array('%name' => $db_name)),
'header' => array(
t('Table'),
),
'rows' => $rows,
);
}
// Get all databases.
$rows = array();
try {
$result = db_query('SELECT datname FROM pg_database');
foreach ($result as $row) {
$rows[] = array($row->datname);
}
} catch (Exception $e) {}
if ($rows) {
$details['databases'] = array(
'title' => t('Available databases'),
'header' => array(
t('Database'),
),
'rows' => $rows,
);
}
return $details;
}
/**
* Integration of the APC status page.
*/
@@ -751,29 +1042,12 @@ function prod_check_apc() {
* Integration of the Memcache status page.
*/
function prod_check_memcache() {
global $conf;
// Memcache module defaults to 127.0.0.1:11211
$memcache_servers = variable_get('memcache_servers', array('127.0.0.1:11211' => 'default'));
global $MEMCACHE_SERVERS;
$MEMCACHE_SERVERS = array_keys($memcache_servers);
include(drupal_get_path('module', 'prod_check') . '/includes/prod_check.memcache.inc');
if (isset($conf['memcache_servers'])) {
global $MEMCACHE_SERVERS;
$MEMCACHE_SERVERS = array_keys($conf['memcache_servers']);
include(drupal_get_path('module', 'prod_check') . '/includes/prod_check.memcache.inc');
}
else {
print 'No memcache servers found in settings.php.';
}
exit;
}
/**
* Generate default key if none is present.
*/
function prod_check_generate_key($length = 25) {
$chars = 'abcdefghijklmnopqrstuxyvwzABCDEFGHIJKLMNOPQRSTUXYVWZ+-*#&@!?';
$size = strlen($chars);
$key = '';
for ($i = 0; $i < $length; $i++) {
$key .= $chars[rand(0, $size - 1)];
}
return $key;
}

View File

@@ -1,10 +1,9 @@
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2008 The PHP Group |
| Copyright (c) 2006-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -23,7 +22,7 @@
*/
$VERSION='$Id$';
$VERSION='$Id: apc.php 325483 2012-05-01 00:34:04Z rasmus $';
////////// READ OPTIONAL CONFIGURATION FILE ////////////
if (file_exists("apc.conf.php")) include("apc.conf.php");
@@ -31,18 +30,19 @@ if (file_exists("apc.conf.php")) include("apc.conf.php");
////////// BEGIN OF DEFAULT CONFIG AREA ///////////////////////////////////////////////////////////
defaults('USE_AUTHENTICATION',1); // Use (internal) authentication - best choice if
defaults('USE_AUTHENTICATION',1); // Use (internal) authentication - best choice if
// no other authentication is available
// If set to 0:
// There will be no further authentication. You
// There will be no further authentication. You
// will have to handle this by yourself!
// If set to 1:
// You need to change ADMIN_PASSWORD to make
// this work!
// Removed these lines for prod_check compatibility
//defaults('ADMIN_USERNAME','apc'); // Admin Username
//defaults('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!!
// (beckerr) I'm using a clear text password here, because I've no good idea how to let
// (beckerr) I'm using a clear text password here, because I've no good idea how to let
// users generate a md5 or crypt password in a easy way to fill it in above
//defaults('DATE_FORMAT', "d.m.Y H:i:s"); // German
@@ -50,6 +50,8 @@ defaults('DATE_FORMAT', 'Y/m/d H:i:s'); // US
defaults('GRAPH_SIZE',200); // Image size
//defaults('PROXY', 'tcp://127.0.0.1:8080');
////////// END OF DEFAULT CONFIG AREA /////////////////////////////////////////////////////////////
@@ -60,12 +62,15 @@ function defaults($d,$v) {
// rewrite $PHP_SELF to block XSS attacks
//
//$PHP_SELF= isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'],''), ENT_QUOTES) : '';
//Line above modified to make this work for the Drupal 'Prod check' module
$PHP_SELF= isset($_GET['q']) ? base_path() . htmlentities(strip_tags($_GET['q'],''), ENT_QUOTES) : '';
$time = REQUEST_TIME;
$host = getenv('HOSTNAME');
//$PHP_SELF= isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'],''), ENT_QUOTES, 'UTF-8') : '';
//Line above modified to make this work for the prod_check module
$PHP_SELF= isset($_GET['q']) ? base_path() . htmlentities(strip_tags($_GET['q'],''), ENT_QUOTES, 'UTF-8') : '';
$time = time();
$host = php_uname('n');
if($host) { $host = '('.$host.')'; }
if (isset($_SERVER['SERVER_ADDR'])) {
$host .= ' ('.$_SERVER['SERVER_ADDR'].')';
}
// operation constants
define('OB_HOST_STATS',1);
@@ -89,7 +94,7 @@ $vardom=array(
'SORT1' => '/^[AHSMCDTZ]$/', // first sort key
'SORT2' => '/^[DA]$/', // second sort key
'AGGR' => '/^\d+$/', // aggregation by dir level
'SEARCH' => '~^[a-zA-Z0-1/_.-]*$~' // aggregation by dir level
'SEARCH' => '~^[a-zA-Z0-9/_.-]*$~' // aggregation by dir level
);
// default cache mode
@@ -132,6 +137,7 @@ if (empty($MYREQUEST['SORT2'])) $MYREQUEST['SORT2']="D";
if (empty($MYREQUEST['OB'])) $MYREQUEST['OB']=OB_HOST_STATS;
if (!isset($MYREQUEST['COUNT'])) $MYREQUEST['COUNT']=20;
if (!isset($scope_list[$MYREQUEST['SCOPE']])) $MYREQUEST['SCOPE']='A';
// added for prod_check support
global $MY_SELF;
// end prod_check
@@ -172,13 +178,13 @@ if (!USE_AUTHENTICATION) {
</body></html>
EOB;
exit;
} else {
$AUTHENTICATED=1;
}
}
}
// select cache mode
if ($AUTHENTICATED && $MYREQUEST['OB'] == OB_USER_CACHE) {
$cache_mode='user';
@@ -197,7 +203,7 @@ if(!function_exists('apc_cache_info') || !($cache=@apc_cache_info($cache_mode)))
exit;
}
$cache_user = apc_cache_info('user', 1);
$cache_user = apc_cache_info('user', 1);
$mem=apc_sma_info();
if(!$cache['num_hits']) { $cache['num_hits']=1; $time++; } // Avoid division by 0 errors on a cache clear
@@ -244,7 +250,7 @@ if (isset($MYREQUEST['IMG']))
$r=$diameter/2;
$w=deg2rad((360+$start+($end-$start)/2)%360);
if (function_exists("imagefilledarc")) {
// exists only if GD 2.0.1 is avaliable
imagefilledarc($im, $centerX+1, $centerY+1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE);
@@ -261,13 +267,13 @@ if (isset($MYREQUEST['IMG']))
if ($text) {
if ($placeindex>0) {
imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1);
imagestring($im,4,$diameter, $placeindex*12,$text,$color1);
imagestring($im,4,$diameter, $placeindex*12,$text,$color1);
} else {
imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1);
}
}
}
}
function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$text,$placeindex=0) {
$r=$diameter/2;
@@ -275,13 +281,13 @@ if (isset($MYREQUEST['IMG']))
if ($placeindex>0) {
imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1);
imagestring($im,4,$diameter, $placeindex*12,$text,$color1);
imagestring($im,4,$diameter, $placeindex*12,$text,$color1);
} else {
imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1);
}
}
}
function fill_box($im, $x, $y, $w, $h, $color1, $color2,$text='',$placeindex='') {
global $col_black;
$x1=$x+$w-1;
@@ -293,15 +299,15 @@ if (isset($MYREQUEST['IMG']))
imagerectangle($im, $x, $y1, $x1, $y, $color1);
if ($text) {
if ($placeindex>0) {
if ($placeindex<16)
{
$px=5;
$py=$placeindex*12+6;
imagefilledrectangle($im, $px+90, $py+3, $px+90-4, $py-3, $color2);
imageline($im,$x,$y+$h/2,$px+90,$py,$color2);
imagestring($im,2,$px,$py-6,$text,$color1);
imagestring($im,2,$px,$py-6,$text,$color1);
} else {
if ($placeindex<31) {
$px=$x+40*2;
@@ -312,7 +318,7 @@ if (isset($MYREQUEST['IMG']))
}
imagefilledrectangle($im, $px, $py+3, $px-4, $py-3, $color2);
imageline($im,$x+$w,$y+$h/2,$px,$py,$color2);
imagestring($im,2,$px+2,$py-6,$text,$color1);
imagestring($im,2,$px+2,$py-6,$text,$color1);
}
} else {
imagestring($im,4,$x+5,$y1-16,$text,$color1);
@@ -334,7 +340,7 @@ if (isset($MYREQUEST['IMG']))
imagecolortransparent($image,$col_white);
switch ($MYREQUEST['IMG']) {
case 1:
$s=$mem['num_seg']*$mem['seg_size'];
$a=$mem['avail_mem'];
@@ -345,9 +351,10 @@ if (isset($MYREQUEST['IMG']))
// would expect because we try to visualize any memory fragmentation as well.
$angle_from = 0;
$string_placement=array();
for($i=0; $i<$mem['num_seg']; $i++) {
for($i=0; $i<$mem['num_seg']; $i++) {
$ptr = 0;
$free = $mem['block_lists'][$i];
uasort($free, 'block_sort');
foreach($free as $block) {
if($block['offset']!=$ptr) { // Used block
$angle_to = $angle_from+($block['offset']-$ptr)/$s;
@@ -371,7 +378,7 @@ if (isset($MYREQUEST['IMG']))
$angle_from = $angle_to;
$ptr = $block['offset']+$block['size'];
}
if ($ptr < $mem['seg_size']) { // memory at the end
if ($ptr < $mem['seg_size']) { // memory at the end
$angle_to = $angle_from + ($mem['seg_size'] - $ptr)/$s;
if(($angle_to+$fuzz)>1) $angle_to = 1;
fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red);
@@ -384,15 +391,15 @@ if (isset($MYREQUEST['IMG']))
text_arc($image,$x,$y,$size,$angle[0]*360,$angle[1]*360,$col_black,bsize($s*($angle[1]-$angle[0])));
}
break;
case 2:
case 2:
$s=$cache['num_hits']+$cache['num_misses'];
$a=$cache['num_hits'];
fill_box($image, 30,$size,50,-$a*($size-21)/$s,$col_black,$col_green,sprintf("%.1f%%",$cache['num_hits']*100/$s));
fill_box($image,130,$size,50,-max(4,($s-$a)*($size-21)/$s),$col_black,$col_red,sprintf("%.1f%%",$cache['num_misses']*100/$s));
break;
case 3:
$s=$mem['num_seg']*$mem['seg_size'];
$a=$mem['avail_mem'];
@@ -402,9 +409,10 @@ if (isset($MYREQUEST['IMG']))
// This block of code creates the bar chart. It is a lot more complex than you
// would expect because we try to visualize any memory fragmentation as well.
for($i=0; $i<$mem['num_seg']; $i++) {
for($i=0; $i<$mem['num_seg']; $i++) {
$ptr = 0;
$free = $mem['block_lists'][$i];
uasort($free, 'block_sort');
foreach($free as $block) {
if($block['offset']!=$ptr) { // Used block
$h=(GRAPH_SIZE-5)*($block['offset']-$ptr)/$s;
@@ -424,7 +432,7 @@ if (isset($MYREQUEST['IMG']))
$y+=$h;
$ptr = $block['offset']+$block['size'];
}
if ($ptr < $mem['seg_size']) { // memory at the end
if ($ptr < $mem['seg_size']) { // memory at the end
$h = (GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s;
if ($h > 0) {
fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($mem['seg_size']-$ptr),$j++);
@@ -432,14 +440,14 @@ if (isset($MYREQUEST['IMG']))
}
}
break;
case 4:
case 4:
$s=$cache['num_hits']+$cache['num_misses'];
$a=$cache['num_hits'];
fill_box($image, 30,$size,50,-$a*($size-21)/$s,$col_black,$col_green,sprintf("%.1f%%",$cache['num_hits']*100/$s));
fill_box($image,130,$size,50,-max(4,($s-$a)*($size-21)/$s),$col_black,$col_red,sprintf("%.1f%%",$cache['num_misses']*100/$s));
break;
}
header("Content-type: image/png");
imagepng($image);
@@ -459,7 +467,7 @@ function bsize($s) {
// sortable table header in "scripts for this host" view
function sortheader($key,$name,$extra='') {
global $MYREQUEST, $MY_SELF_WO_SORT;
if ($MYREQUEST['SORT1']==$key) {
$MYREQUEST['SORT2'] = $MYREQUEST['SORT2']=='A' ? 'D' : 'A';
}
@@ -467,7 +475,7 @@ function sortheader($key,$name,$extra='') {
}
// create menu entry
// create menu entry
function menu_entry($ob,$title) {
global $MYREQUEST,$MY_SELF;
if ($MYREQUEST['OB']!=$ob) {
@@ -475,7 +483,7 @@ function menu_entry($ob,$title) {
} else if (empty($MYREQUEST['SH'])) {
return "<li><span class=active>$title</span></li>";
} else {
return "<li><a class=\"child_active\" href=\"$MY_SELF&OB=$ob\">$title</a></li>";
return "<li><a class=\"child_active\" href=\"$MY_SELF&OB=$ob\">$title</a></li>";
}
}
@@ -488,8 +496,11 @@ function put_login_link($s="Login")
return;
} else if (ADMIN_PASSWORD=='password')
{
// Message below changed to avoid prod_check integration confusion. It used
// to be:
// You need to set a password at the top of apc.php before this will work!
print <<<EOB
<a href="#" onClick="javascript:alert('You need to set a password at the top of apc.php before this will work!');return false";>$s</a>
<a href="#" onClick="javascript:alert('You need to set a password in the Production Check settings before this will work!');return false";>$s</a>
EOB;
} else if ($AUTHENTICATED) {
print <<<EOB
@@ -502,6 +513,15 @@ EOB;
}
}
function block_sort($array1, $array2)
{
if ($array1['offset'] > $array2['offset']) {
return 1;
} else {
return -1;
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@@ -618,8 +638,8 @@ ol.menu a:hover {
background:rgb(193,193,244);
text-decoration:none;
}
div.info {
background:rgb(204,204,204);
border:solid rgb(204,204,204) 1px;
@@ -692,7 +712,7 @@ div.authneeded {
padding:2em;
text-align:center;
}
input {
background:rgb(153,153,204);
border:solid rgb(102,102,153) 2px;
@@ -732,10 +752,10 @@ if ($AUTHENTICATED) {
echo
menu_entry(3,'User Cache Entries'),
menu_entry(9,'Version Check');
if ($AUTHENTICATED) {
echo <<<EOB
<li><a class="aright" href="$MY_SELF&CC=1&OB={$MYREQUEST['OB']}" onClick="javascipt:return confirm('Are you sure?');">Clear $cache_mode Cache</a></li>
<li><a class="aright" href="$MY_SELF&CC=1&OB={$MYREQUEST['OB']}" onClick="javascript:return confirm('Are you sure?');">Clear $cache_mode Cache</a></li>
EOB;
}
echo <<<EOB
@@ -748,7 +768,7 @@ echo <<<EOB
<div class=content>
EOB;
// MAIN SWITCH STATEMENT
// MAIN SWITCH STATEMENT
switch ($MYREQUEST['OB']) {
@@ -774,7 +794,7 @@ case OB_HOST_STATS:
$insert_rate_user = sprintf("%.2f",($cache_user['num_inserts'])/($time-$cache_user['start_time']));
$apcversion = phpversion('apc');
$phpversion = phpversion();
$number_files = $cache['num_entries'];
$number_files = $cache['num_entries'];
$size_files = bsize($cache['mem_size']);
$number_vars = $cache_user['num_entries'];
$size_vars = bsize($cache_user['mem_size']);
@@ -792,7 +812,7 @@ EOB;
echo "<tr class=tr-1><td class=td-0>Server Software</td><td>{$_SERVER['SERVER_SOFTWARE']}</td></tr>\n";
echo <<<EOB
<tr class=tr-0><td class=td-0>Shared Memory</td><td>{$mem['num_seg']} Segment(s) with $seg_size
<tr class=tr-0><td class=td-0>Shared Memory</td><td>{$mem['num_seg']} Segment(s) with $seg_size
<br/> ({$cache['memory_type']} memory, {$cache['locking_type']} locking)
</td></tr>
EOB;
@@ -860,7 +880,7 @@ EOB;
EOB;
echo
graphics_avail() ?
graphics_avail() ?
'<tr>'.
"<td class=td-0><img alt=\"\" $size src=\"$PHP_SELF?IMG=1&$time\"></td>".
"<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF?IMG=2&$time\"></td></tr>\n"
@@ -898,7 +918,7 @@ EOB;
}
$freeseg += count($mem['block_lists'][$i]);
}
if ($freeseg > 1) {
$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize/$freetotal)*100,bsize($fragsize),bsize($freetotal),$freeseg);
} else {
@@ -928,7 +948,7 @@ EOB;
</tbody></table>
</div>
EOB;
break;
@@ -947,15 +967,15 @@ case OB_USER_CACHE:
$fieldkey='info';
// -----------------------------------------------
// System Cache Entries
// System Cache Entries
// -----------------------------------------------
case OB_SYS_CACHE:
case OB_SYS_CACHE:
if (!isset($fieldname))
{
$fieldname='filename';
$fieldheading='Script Filename';
if(ini_get("apc.stat")) $fieldkey='inode';
else $fieldkey='filename';
else $fieldkey='filename';
}
if (!empty($MYREQUEST['SH']))
{
@@ -983,14 +1003,14 @@ EOB;
echo
"<tr class=tr-$m>",
"<td class=td-0>",ucwords(preg_replace("/_/"," ",$k)),"</td>",
"<td class=td-last>",(preg_match("/time/",$k) && $value!='None') ? date(DATE_FORMAT,$value) : $value,"</td>",
"<td class=td-last>",(preg_match("/time/",$k) && $value!='None') ? date(DATE_FORMAT,$value) : htmlspecialchars($value, ENT_QUOTES, 'UTF-8'),"</td>",
"</tr>";
$m=1-$m;
}
if($fieldkey=='info') {
echo "<tr class=tr-$m><td class=td-0>Stored Value</td><td class=td-last><pre>";
$output = var_export(apc_fetch($entry[$fieldkey]),true);
echo htmlspecialchars($output);
echo htmlspecialchars($output, ENT_QUOTES, 'UTF-8');
echo "</pre></td></tr>\n";
}
break;
@@ -1010,7 +1030,7 @@ EOB;
<input type=hidden name=OB value={$MYREQUEST['OB']}>
<select name=SCOPE>
EOB;
echo
echo
"<option value=A",$MYREQUEST['SCOPE']=='A' ? " selected":"",">Active</option>",
"<option value=D",$MYREQUEST['SCOPE']=='D' ? " selected":"",">Deleted</option>",
"</select>",
@@ -1024,7 +1044,7 @@ EOB;
"<option value=D",$MYREQUEST['SORT1']=='D' ? " selected":"",">Deleted at</option>";
if($fieldname=='info') echo
"<option value=D",$MYREQUEST['SORT1']=='T' ? " selected":"",">Timeout</option>";
echo
echo
'</select>',
'<select name=SORT2>',
'<option value=D',$MYREQUEST['SORT2']=='D' ? ' selected':'','>DESC</option>',
@@ -1086,28 +1106,29 @@ EOB;
}
if (!$AUTHENTICATED) {
// hide all path entries if not logged in
$list[$k.$entry[$fieldname]]=preg_replace('/^.*(\\/|\\\\)/','<i>&lt;hidden&gt;</i>/',$entry);
$list[$k.$entry[$fieldname]]=preg_replace('/^.*(\\/|\\\\)/','*hidden*/',$entry);
} else {
$list[$k.$entry[$fieldname]]=$entry;
}
}
if ($list) {
// sort list
//
switch ($MYREQUEST['SORT2']) {
case "A": krsort($list); break;
case "D": ksort($list); break;
}
// output list
$i=0;
foreach($list as $k => $entry) {
if(!$MYREQUEST['SEARCH'] || preg_match($MYREQUEST['SEARCH'], $entry[$fieldname]) != 0) {
if(!$MYREQUEST['SEARCH'] || preg_match($MYREQUEST['SEARCH'], $entry[$fieldname]) != 0) {
$field_value = htmlentities(strip_tags($entry[$fieldname],''), ENT_QUOTES, 'UTF-8');
echo
'<tr class=tr-',$i%2,'>',
"<td class=td-0><a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&SH=",md5($entry[$fieldkey]),"\">",$entry[$fieldname],'</a></td>',
"<td class=td-0><a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&SH=",md5($entry[$fieldkey]),"\">",$field_value,'</a></td>',
'<td class="td-n center">',$entry['num_hits'],'</td>',
'<td class="td-n right">',$entry['mem_size'],'</td>',
'<td class="td-n center">',date(DATE_FORMAT,$entry['access_time']),'</td>',
@@ -1137,7 +1158,7 @@ EOB;
break;
}
}
} else {
echo '<tr class=tr-0><td class="center" colspan=',$cols,'><i>No data</i></td></tr>';
}
@@ -1158,7 +1179,7 @@ EOB;
// -----------------------------------------------
// Per-Directory System Cache Entries
// -----------------------------------------------
case OB_SYS_CACHE_DIR:
case OB_SYS_CACHE_DIR:
if (!$AUTHENTICATED) {
break;
}
@@ -1168,7 +1189,7 @@ case OB_SYS_CACHE_DIR:
<input type=hidden name=OB value={$MYREQUEST['OB']}>
<select name=SCOPE>
EOB;
echo
echo
"<option value=A",$MYREQUEST['SCOPE']=='A' ? " selected":"",">Active</option>",
"<option value=D",$MYREQUEST['SCOPE']=='D' ? " selected":"",">Deleted</option>",
"</select>",
@@ -1241,14 +1262,14 @@ EOB;
}
if ($list) {
// sort list
//
switch ($MYREQUEST['SORT2']) {
case "A": krsort($list); break;
case "D": ksort($list); break;
}
// output list
$i = 0;
foreach($list as $entry) {
@@ -1264,7 +1285,7 @@ EOB;
if (++$i == $MYREQUEST['COUNT']) break;
}
} else {
echo '<tr class=tr-0><td class="center" colspan=6><i>No data</i></td></tr>';
}
@@ -1292,8 +1313,12 @@ case OB_VERSION_CHECK:
<th></th>
</tr>
EOB;
$rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apc.rss");
if (defined('PROXY')) {
$ctxt = stream_context_create( array( 'http' => array( 'proxy' => PROXY, 'request_fulluri' => True ) ) );
$rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apc.rss", False, $ctxt);
} else {
$rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apc.rss");
}
if (!$rss) {
echo '<tr class="td-last center"><td>Unable to fetch version information.</td></tr>';
} else {
@@ -1305,7 +1330,7 @@ EOB;
echo '<div class="ok">You are running the latest version of APC ('.$apcversion.')</div>';
$i = 3;
} else {
echo '<div class="failed">You are running an older version of APC ('.$apcversion.'),
echo '<div class="failed">You are running an older version of APC ('.$apcversion.'),
newer version '.$match[1].' is available at <a href="http://pecl.php.net/package/APC/'.$match[1].'">
http://pecl.php.net/package/APC/'.$match[1].'</a>
</div>';
@@ -1324,8 +1349,8 @@ EOB;
} else if (!$i--) {
break;
}
echo "<b><a href=\"http://pecl.php.net/package/APC/$ver\">".htmlspecialchars($v)."</a></b><br><blockquote>";
echo nl2br(htmlspecialchars(current($match[2])))."</blockquote>";
echo "<b><a href=\"http://pecl.php.net/package/APC/$ver\">".htmlspecialchars($v, ENT_QUOTES, 'UTF-8')."</a></b><br><blockquote>";
echo nl2br(htmlspecialchars(current($match[2]), ENT_QUOTES, 'UTF-8'))."</blockquote>";
next($match[2]);
}
echo '</td></tr>';

View File

@@ -51,3 +51,38 @@ function theme_prod_check_status_report($variables) {
$output .= '</table>';
return $output;
}
/**
* Theme database status page.
*
* @param $variables
* An associative array containing:
* - title: title string to display.
* - status: string with status summary.
* - details: associative array of associative arrays containing detailed
* status info.
*
* @ingroup themeable
*/
function theme_prod_check_dbstatus($variables) {
$title = $variables['title'];
$status = $variables['status'];
$details = $variables['details'];
$output = '';
// DB system and version.
$output .= '<h2>' . $title . '</h2>';
// Basic status info.
$output .= '<div>' . $status . '</div><p>&nbsp;</p>';
// Add detailed statuses.
foreach ($details as $type) {
if ($type) {
$caption = '<h2>' . $type['title'] . '</h2>';
$output .= theme('table', array('header' => $type['header'], 'rows' => $type['rows'], 'caption' => $caption));
}
}
return $output;
}

View File

@@ -4,9 +4,9 @@ package = Monitoring
core = 7.x
configure = admin/config/system/prod-check
; Information added by drupal.org packaging script on 2013-10-01
version = "7.x-1.7+0-dev"
; Information added by packaging script on 2013-11-25
version = "7.x-1.8"
core = "7.x"
project = "prod_check"
datestamp = "1380623918"
datestamp = "1385405033"

View File

@@ -67,7 +67,6 @@ function prod_check_help($path, $arg) {
* Implementation of hook_permission()
*/
function prod_check_permission() {
return array(
'administer production check' => array(
'title' => t('Administer Production Check'),
@@ -90,6 +89,12 @@ function prod_check_permission() {
function prod_check_menu() {
$items = array();
$admin_defaults = array(
'access arguments' => array('access production check'),
'type' => MENU_CALLBACK,
'file' => 'includes/prod_check.admin.inc',
);
$items['admin/reports/prod-check'] = array(
'title' => 'Production check',
'description' => 'View the Production check report page.',
@@ -130,23 +135,22 @@ function prod_check_menu() {
'file' => 'includes/prod_check.admin.inc',
);
$items['admin/reports/status/database'] = array(
'title' => 'Database',
'page callback' => 'prod_check_dbstatus',
) + $admin_defaults;
$items['admin/reports/status/apc'] = array(
'title' => 'APC',
'page callback' => 'prod_check_apc',
'access callback' => 'user_access',
'access arguments' => array('access production check'),
'type' => MENU_CALLBACK,
'file' => 'includes/prod_check.admin.inc',
);
) + $admin_defaults;
$items['admin/reports/status/memcache'] = array(
'title' => 'Memcache',
'page callback' => 'prod_check_memcache',
'access callback' => 'user_access',
'access arguments' => array('access production check'),
'type' => MENU_CALLBACK,
'file' => 'includes/prod_check.admin.inc',
);
) + $admin_defaults;
return $items;
}
@@ -173,6 +177,10 @@ function prod_check_theme($existing, $type, $theme, $path) {
'variables' => array('requirements' => NULL),
'file' => 'includes/prod_check.theme.inc',
),
'prod_check_dbstatus' => array(
'variables' => array('title' => NULL, 'status' => NULL, 'details' => NULL),
'file' => 'includes/prod_check.theme.inc',
),
);
}
@@ -565,6 +573,7 @@ function _prod_check_functions() {
'_prod_check_error_reporting' => 'Error reporting',
'_prod_check_user_register' => 'User registration',
'_prod_check_site_mail' => 'Site e-mail',
'_prod_check_poormanscron' => 'Cron',
),
);
@@ -753,6 +762,52 @@ function _prod_check_site_mail($caller = 'internal') {
return prod_check_execute_check($check, $caller);
}
// Cron check
function _prod_check_poormanscron($caller = 'internal') {
$check = array();
$title = 'Cron';
$path = 'admin/config/system/cron';
if ($caller != 'internal') {
$path = PRODCHECK_BASEURL . $path;
}
$cron_interval = variable_get('cron_safe_threshold', DRUPAL_CRON_DEFAULT_THRESHOLD);
// TODO: add some form of cron interval checking here so we can check if the
// cron is running regularly AND the poormanscron is disabled?
// We could use the data from dblog, but this might not always be enabled so
// it will be similar to _prod_check_dblog_php...
/*$cron_interval_regularity = FALSE;
if (module_exists('dblog')) {
$result = db_query("SELECT timestamp FROM {watchdog} where type = 'cron' ORDER BY timestamp DESC LIMIT 10");
$prev = -1;
$diff = array();
foreach ($result as $row) {
if($prev == -1) {
$prev = $row->timestamp;
continue;
}
$diff[] = $prev - $row->timestamp;
}
}*/
$check['prod_check_poormanscron'] = array(
'#title' => t($title),
'#state' => $cron_interval == 0 /*&& $cron_interval_regularity*/,
'#severity' => ($caller == 'nagios') ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
'#value_ok' => t("Drupal's built in cron mechanism is disabled."),
'#value_nok' => t("Drupal's built in cron mechanism is set to run every %interval.", array('%interval' => format_interval($cron_interval))),
'#description_ok' => prod_check_ok_title($title, $path),
'#description_nok' => t('The !link interval should be disabled if you have also setup a crontab or scheduled task for this to avoid running the cron more often than you have planned to!', prod_check_link_array($title, $path)),
'#nagios_key' => 'CRON',
'#nagios_type' => 'state',
);
return prod_check_execute_check($check, $caller);
}
// --- SERVER ---
// APC check
@@ -999,16 +1054,19 @@ function _prod_check_boost($caller = 'internal') {
if (module_exists('boost')) {
$check = array();
$path = 'admin/config/development/performance/boost';
$path = 'admin/config/system/boost';
if ($caller != 'internal') {
$path = PRODCHECK_BASEURL . $path;
}
$path_htaccess = $path . '/htaccess';
$path_crawler = $path . '/crawler';
$path_expire = $path . '/expiration';
$title = 'Boost: ';
// Cache lifetime check
$subtitle = 'HTML max. cache lifetime ';
$var = variable_get('boost_cache_lifetime', 3600);
$subtitle = 'text/html - Maximum Cache Lifetime';
$var = variable_get('boost_lifetime_max_text/html', 3600);
$check['prod_check_boost_cache_lifetime'] = array(
'#title' => t($title.$subtitle),
'#state' => $var <= 3600,
@@ -1022,53 +1080,78 @@ function _prod_check_boost($caller = 'internal') {
);
// Clear pages check
$subtitle = 'Clear expired pages on cron runs';
$var = variable_get('boost_expire_cron', TRUE);
$subtitle = 'Remove old cache files on cron';
$var = variable_get('boost_expire_cron', BOOST_EXPIRE_CRON);
$check['prod_check_boost_expire_cron'] = array(
'#title' => t($title.$subtitle),
'#state' => $var,
'#severity' => ($caller == 'nagios') ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
'#value_ok' => t('Enabled'),
'#value_nok' => t('Disabled'),
'#description_ok' => prod_check_ok_title($subtitle, $path),
'#description_nok' => t('!link is disabled! You should enable this to ensure that expired pages get flushed when the cron runs. This is imperative if you wish to keep view blocks up to date!', prod_check_link_array($subtitle, $path)),
'#description_ok' => prod_check_ok_title($subtitle, $path_expire),
'#description_nok' => t('!link is disabled! You should enable this to ensure that expired pages get flushed when the cron runs. This is imperative if you wish to keep view blocks up to date!', prod_check_link_array($subtitle, $path_expire)),
'#nagios_key' => 'BCLPG',
'#nagios_type' => 'state',
);
/*
// Crawl on cron check
$subtitle = 'Crawl on cron';
$var = module_exists('boost_crawler') && variable_get('boost_crawl_on_cron', FALSE);
$check['prod_check_boost_crawl_on_cron'] = array(
'#title' => t($title.$subtitle),
'#state' => $var,
'#severity' => ($caller == 'nagios') ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
'#value_ok' => t('Enabled'),
'#value_nok' => t('Disabled'),
'#description_ok' => prod_check_ok_title($subtitle, $path_crawler),
'#description_nok' => t('!link is disabled! You should enable this to ensure that the users are served cached pages all the time. The crawler caches pages before anyone can access them.', prod_check_link_array($subtitle, $path_crawler)),
'#nagios_key' => 'BCRCR',
'#nagios_type' => 'state',
);
// The Boost module is in development atm, as soon as it is released we'll fix this.
// Boost nagios page check
if (module_exists('nagios')) {
$subtitle = 'Nagios page';
$subtitle = 'Crawl on cron';
$var = variable_get('boost_crawl_on_cron', FALSE);
$check['prod_check_boost_crawl_on_cron'] = array(
'#title' => t($title.$subtitle),
'#state' => $var,
'#severity' => ($caller == 'nagios') ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
'#value_ok' => t('Enabled'),
'#value_nok' => t('Disabled'),
'#description_ok' => prod_check_ok_title($subtitle, $path),
'#description_nok' => t('!link is disabled! You should enable this to ensure that the users are served cached pages all the time. The crawler caches pages before anyone can access them.', prod_check_link_array($subtitle, $path)),
'#nagios_key' => 'BCRCR',
'#nagios_type' => 'state',
);
*/
$visibility = variable_get('boost_cacheability_option', BOOST_VISIBILITY_NOTLISTED);
$pages_setting = variable_get('boost_cacheability_pages', BOOST_CACHEABILITY_PAGES);
$pages_array = explode("\n", str_replace(array("\n", "\r\n"), "\n", strtolower($pages_setting)));
$var = ($visibility && in_array('nagios', $pages_array)) || (!$visibility && !in_array('nagios', $pages_array));
if($visibility) {
$advise = "You should remove 'nagios' from the listed pages.";
}
else {
$advise = "You should add 'nagios' to the listed pages.";
}
$check['prod_check_boost_apache_nagios_page'] = array(
'#title' => t($title.$subtitle),
'#state' => !$var,
'#severity' => ($caller == 'nagios') ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
'#value_ok' => t('Enabled'),
'#value_nok' => t('Not properly configured.'),
'#description_ok' => prod_check_ok_title($subtitle, $path),
'#description_nok' => t('The !link is being cached by Boost. '.$advise, prod_check_link_array($subtitle, $path)),
'#nagios_key' => 'BNAPA',
'#nagios_type' => 'state',
);
}
// Apache etag check
$subtitle = 'ETag';
$var = variable_get('boost_apache_etag', 0);
$var = variable_get('boost_apache_etag', BOOST_APACHE_ETAG);
$check['prod_check_boost_apache_etag'] = array(
'#title' => t($title.$subtitle),
'#state' => $var >= 2,
'#severity' => ($caller == 'nagios') ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
'#value_ok' => t('Enabled'),
'#value_nok' => t('Not properly configured.'),
'#description_ok' => prod_check_ok_title($subtitle, $path),
'#description_ok' => prod_check_ok_title($subtitle, $path_htaccess),
'#description_nok' => t('Your !link settings are not ok! You should enable entity tags (!etag) in Boost so that user side caching and bandwith usage will be optimal! You do need to enable !mod for this to work.',
array(
'!link' => '<em>'.l(t($subtitle), $path, array('attributes' => array('title' => t($subtitle)), 'query' => drupal_get_destination())).'</em>',
'!link' => '<em>'.l(t($subtitle), $path_htaccess, array('attributes' => array('title' => t($subtitle)), 'query' => drupal_get_destination())).'</em>',
'!etag' => '<em>'.l(t('ETags'), 'http://en.wikipedia.org/wiki/HTTP_ETag', array('attributes' => array('title' => t('Etags')))).'</em>',
'!mod' => '<em>'.l(t('mod_headers'), 'http://httpd.apache.org/docs/2.0/mod/mod_headers.html', array('attributes' => array('title' => t('mod_headers')))).'</em>',
)
@@ -1076,6 +1159,7 @@ function _prod_check_boost($caller = 'internal') {
'#nagios_key' => 'BETAG',
'#nagios_type' => 'state',
);
$result = prod_check_execute_check($check, $caller);
}
return $result;
@@ -1769,6 +1853,10 @@ function _prod_check_redirect($caller = 'internal') {
// XML sitemap
function _prod_check_xmlsitemap($caller = 'internal') {
$check = array();
$error = FALSE;
$xml_base_url = variable_get('xmlsitemap_base_url', $GLOBALS['base_url']);
$value_nok = $msg_nok = '';
$title_ok = 'settings';
$text_ok = 'Check the !link to verify if they are as you expect.';
@@ -1778,14 +1866,25 @@ function _prod_check_xmlsitemap($caller = 'internal') {
$path = PRODCHECK_BASEURL . $path;
}
$check['prod_check_sitemap'] = array(
if(!module_exists('xmlsitemap')) {
$error = TRUE;
$value_nok = t('Disabled');
$msg_nok = t('You have not enabled the !link module. This module generates an XML sitemap which can be submitted to search engines, guaranteeing optimal indexation of all urls within the site.', prod_check_link_array($title, 'http://drupal.org/project/xmlsitemap'));
}
elseif (strtolower($xml_base_url) != strtolower($GLOBALS['base_url'])) {
$error = TRUE;
$value_nok = t('Not properly configured.');
$msg_nok = t('Your sitemap.xml !link is not the same as the current base URL you are viewing the site from.', prod_check_link_array('default base URL', $path));
}
$check['prod_check_xmlsitemap'] = array(
'#title' => t($title),
'#state' => module_exists('xmlsitemap'),
'#state' => !$error,
'#severity' => ($caller == 'nagios') ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
'#value_ok' => t('Enabled'),
'#value_nok' => t('Disabled'),
'#value_nok' => $value_nok,
'#description_ok' => prod_check_ok_title($title_ok, $path, $text_ok),
'#description_nok' => t('You have not enabled the !link module. This module generates an XML sitemap which can be submitted to search engines, guaranteeing optimal indexation of all urls within the site.', prod_check_link_array($title, 'http://drupal.org/project/xmlsitemap')),
'#description_nok' => $msg_nok,
'#nagios_key' => 'XMLS',
'#nagios_type' => 'state',
);

View File

@@ -4,7 +4,7 @@
Drupal.behaviors.prod_monitor_init = {
attach: function(context, settings) {
var script = document.createElement('script');
script.src = 'http://www.google.com/jsapi?callback=Drupal.behaviors.prod_monitor_performance.initGoogleDependencies';
script.src = document.location.protocol + '//www.google.com/jsapi?callback=Drupal.behaviors.prod_monitor_performance.initGoogleDependencies';
script.type = 'text/javascript';
$('head').append(script);
}
@@ -14,12 +14,12 @@
Drupal.behaviors.prod_monitor_performance = {
initGoogleDependencies: function() {
google.load('visualization', '1', {
'callback':Drupal.behaviors.prod_monitor_performance.initGraphs,
'callback':Drupal.behaviors.prod_monitor_performance.initGraphs,
'packages':['annotatedtimeline']
})
},
initGraphs: function() {
initGraphs: function() {
$('.performance-data').each(function() {
var callback = $(this).attr('id').replace('-', '_');
//console.log(Drupal.behaviors.prod_monitor_performance[callback]);

View File

@@ -4,9 +4,9 @@ package = Monitoring
core = 7.x
configure = admin/reports/prod-monitor
; Information added by drupal.org packaging script on 2013-10-01
version = "7.x-1.7+0-dev"
; Information added by packaging script on 2013-11-25
version = "7.x-1.8"
core = "7.x"
project = "prod_check"
datestamp = "1380623918"
datestamp = "1385405033"

View File

@@ -328,7 +328,7 @@ function prod_monitor_cron() {
$elapsed = $process = 0;
foreach ($sites as $id => $site_info) {
$elapsed = REQUEST_TIME - $cron_start;
$elapsed = time() - $cron_start;
if ($elapsed < $time_limit) {
//TODO: add module status update check here.
_prod_monitor_retrieve_data($id, $site_info);