function monitoring_system_monitoring_sensor_info in Monitoring 7
Implements monitoring_MODULE_monitoring_sensor_info().
Module: system
File
- ./
monitoring.monitoring_sensors.inc, line 452 - Define default sensors for core and contrib modules.
Code
function monitoring_system_monitoring_sensor_info() {
// === Variables === //
$info['core_theme_default'] = array(
'label' => 'Default theme',
'description' => 'Site default theme',
'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorVariable',
'numeric' => FALSE,
'settings' => array(
'enabled' => FALSE,
'variable_name' => 'theme_default',
'variable_value' => 'bartik',
'variable_default_value' => 'bartik',
),
);
$info['core_maintenance_mode'] = array(
'label' => 'Maintenance mode',
'description' => 'Site maintenance mode',
'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorVariable',
'numeric' => FALSE,
'value_type' => 'bool',
'settings' => array(
'variable_name' => 'maintenance_mode',
'variable_value' => FALSE,
'variable_default_value' => FALSE,
),
);
// === Cron === //
$info['core_cron_last_run_age'] = array(
'label' => 'Last cron run age',
'description' => 'Time since last cron run',
'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorCronLastRunAge',
'value_type' => 'time_interval',
'settings' => array(
'category' => 'Cron',
'thresholds' => array(
'type' => 'exceeds',
'warning' => 60 * 60 * 24,
'critical' => 60 * 60 * 24 * 3,
),
),
);
$info['core_cron_safe_threshold'] = array(
'label' => 'Cron safe threshold enabled',
'description' => 'Cron safe threshold (Poormanscron) is enabled',
'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorVariable',
'numeric' => FALSE,
'value_type' => 'bool',
'settings' => array(
'category' => 'Cron',
'variable_name' => 'cron_safe_threshold',
'variable_value' => '0',
'variable_default_value' => DRUPAL_CRON_DEFAULT_THRESHOLD,
),
);
// === Queue === //
$queues = array_keys(module_invoke_all('cron_queue_info'));
foreach ($queues as $queue) {
$info['core_queue_' . $queue] = array(
'label' => check_plain($queue),
'description' => format_string('Size of @queue queue', array(
'@queue' => $queue,
)),
'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorQueue',
'value_label' => 'Items',
'settings' => array(
'category' => 'Queue',
'queue' => $queue,
),
);
}
// === System === //
$info['monitoring_enabled_modules'] = array(
'label' => 'Enabled modules',
'description' => 'Enabled only expected modules',
'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorEnabledModules',
'value_label' => 'Modules delta',
'settings' => array(
'category' => 'System',
'enabled' => FALSE,
'allow_additional' => FALSE,
'modules' => array(),
),
);
// Load .install files
include_once DRUPAL_ROOT . '/includes/install.inc';
drupal_load_updates();
foreach (module_implements('requirements') as $module) {
// Skip update module as there is a separate sensors for core and contrib.
if ($module == 'update') {
continue;
}
$info['core_requirements_' . $module] = array(
'label' => format_string('Module @module', array(
'@module' => $module,
)),
'description' => format_string('Requirements of the @module module', array(
'@module' => $module,
)),
'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorCoreRequirements',
'numeric' => FALSE,
'settings' => array(
'category' => 'Requirements',
'caching_time' => 3600,
'module' => $module,
// List requirements keys which reports will be suppressed.
'exclude keys' => array(),
),
);
// Ignore the cron key for system requirements, as we have a separate
// sensor for this.
if ($module == 'system') {
$info['core_requirements_' . $module]['settings']['exclude keys'][] = 'cron';
}
}
return $info;
}