function monitoring_monitoring_test_monitoring_sensor_info in Monitoring 7
Implements monitoring_MODULE_monitoring_sensor_info().
See also
File
- test/
monitoring_test.module, line 43 - Monitoring test bootstrap file.
Code
function monitoring_monitoring_test_monitoring_sensor_info() {
$info = array(
'test_sensor_integration' => array(
'label' => 'Test from integration hook',
'description' => 'To test correct sensor info hook implementation precedence.',
'sensor_class' => 'Drupal\\monitoring_test\\Sensor\\Sensors\\TestSensor',
'settings' => array(
'result_logging' => FALSE,
'category' => 'Test',
),
),
'watchdog_aggregate_test' => array(
'label' => 'Watchdog aggregate test',
'description' => 'Test sensor for watchdog aggregate.',
'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorDatabaseAggregator',
'settings' => array(
'result_logging' => FALSE,
'category' => 'Test',
'thresholds' => array(
'warning' => 1,
'critical' => 2,
),
'table' => 'watchdog',
),
),
'db_aggregate_test' => array(
'label' => 'DB Aggregate test',
'description' => 'Tests the generic DB aggregate sensor.',
'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorDatabaseAggregator',
'value_label' => 'Druplicons',
'result_logging' => TRUE,
'settings' => array(
'category' => 'Test',
'caching_time' => 3600,
'table' => 'node',
'conditions' => array(
'test' => array(
'field' => 'promote',
'value' => '1',
),
),
'time_interval_field' => 'created',
'time_interval_value' => 24 * 60 * 60,
'thresholds' => array(
'type' => 'falls',
'warning' => 2,
'critical' => 1,
),
),
),
'test_sensor' => array(
'label' => 'Test sensor',
'description' => 'Test sensor status',
'sensor_class' => 'Drupal\\monitoring_test\\Sensor\\Sensors\\TestSensor',
'settings' => array(
'result_logging' => TRUE,
'category' => 'Test',
'caching_time' => 3600,
),
),
'test_sensor_inner' => array(
'label' => 'Test sensor inner',
'description' => 'Test sensor that sets inner error intervals',
'sensor_class' => 'Drupal\\monitoring_test\\Sensor\\Sensors\\TestSensor',
'settings' => array(
'result_logging' => TRUE,
'category' => 'Test',
'thresholds' => array(
'type' => 'inner_interval',
'warning_low' => 1,
'critical_low' => 4,
'critical_high' => 6,
'warning_high' => 9,
),
),
),
'test_sensor_outer' => array(
'label' => 'Test sensor outer',
'description' => 'Test sensor that sets outer error intervals',
'sensor_class' => 'Drupal\\monitoring_test\\Sensor\\Sensors\\TestSensor',
'settings' => array(
'result_logging' => TRUE,
'category' => 'Test',
'thresholds' => array(
'type' => 'outer_interval',
'critical_low' => 60,
'warning_low' => 70,
'warning_high' => 80,
'critical_high' => 90,
),
),
),
'test_sensor_exceeds' => array(
'label' => 'Test sensor exceeds',
'description' => 'Test sensor that sets error interval above give value',
'sensor_class' => 'Drupal\\monitoring_test\\Sensor\\Sensors\\TestSensor',
'settings' => array(
'result_logging' => TRUE,
'category' => 'Test',
'thresholds' => array(
'type' => 'exceeds',
'warning' => 5,
'critical' => 10,
),
),
),
'test_sensor_falls' => array(
'label' => 'Test sensor falls',
'description' => 'Test sensor that sets error interval below give value',
'sensor_class' => 'Drupal\\monitoring_test\\Sensor\\Sensors\\TestSensor',
'settings' => array(
'result_logging' => TRUE,
'category' => 'Test',
'thresholds' => array(
'type' => 'falls',
'warning' => 10,
'critical' => 5,
),
),
),
'test_sensor_cat_watchdog' => array(
'label' => 'Test sensor category Watchdog',
'description' => 'Test sensor with Watchdog category to test the watchdog logging',
'sensor_class' => 'Drupal\\monitoring_test\\Sensor\\Sensors\\TestSensor',
'settings' => array(
'category' => 'Watchdog',
),
),
);
// In case we have testing_sensor_info data we add it as a new sensor.
// @see \MonitoringApiTest::testAPI()
$testing_sensor_info = variable_get('monitoring_test_sensor_info');
if (!empty($testing_sensor_info)) {
$info['test_sensor_info'] = $testing_sensor_info;
}
return $info;
}