You are here

function monitoring_node_monitoring_sensor_info in Monitoring 7

Implements monitoring_MODULE_monitoring_sensor_info().

Module: node

File

./monitoring.monitoring_sensors.inc, line 61
Define default sensors for core and contrib modules.

Code

function monitoring_node_monitoring_sensor_info() {
  $info = array();
  $info['node_new_all'] = array(
    'label' => 'All new nodes',
    'description' => 'All new nodes',
    'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorDatabaseAggregator',
    'value_label' => 'Nodes',
    'settings' => array(
      'category' => 'Content',
      'enabled' => FALSE,
      // Cache for one hour.
      'caching_time' => 3600,
      'table' => 'node',
      'time_interval_field' => 'created',
      'time_interval_value' => 60 * 60 * 24,
    ),
  );
  foreach (node_type_get_types() as $node_type) {
    $info['node_new_' . $node_type->type] = array(
      'label' => format_string('New @type nodes', array(
        '@type' => $node_type->name,
      )),
      'description' => format_string('New nodes of type @type', array(
        '@type' => $node_type->name,
      )),
      'sensor_class' => 'Drupal\\monitoring\\Sensor\\Sensors\\SensorDatabaseAggregator',
      'value_label' => format_string('@type nodes', array(
        '@type' => $node_type->name,
      )),
      'settings' => array(
        'category' => 'Content',
        'enabled' => FALSE,
        // Cache for 10 minutes.
        'caching_time' => 600,
        'thresholds' => array(
          'type' => 'falls',
        ),
        'table' => 'node',
        'conditions' => array(
          array(
            'field' => 'type',
            'value' => $node_type->type,
          ),
        ),
        'time_interval_field' => 'created',
        'time_interval_value' => 60 * 60 * 24,
      ),
    );
  }
  return $info;
}