User Tools

Site Tools


filters

Filters

This page describes filtering of possible monitored sensors (to save disk space, disk writes, CPU cycles, space for graphs on server page, …).

Plugin types

There are two basic types of plugins depending on how they handle multiple instances of same resource (something we want to measure).

  • Plugin with single instance (singleton) which can handle multiple resources (statistics of multiple disks when reading /proc/diskstats, usage of mount points when parsing output of df, …)
  • Plugin with instance per each configured resource (MySQL on standard IP & port, MySQL on local socket only, Apache on 192.168.2.1, …)

If you don't want to monitor certain MySQL instance you can just comment the relevant configuration. However if you don't want to monitor disks sd[a-z] you must use filters (though you can filter sensors of MySQL plugin too).

Sensor names

Sensor is an abstraction of part of some resource and associated data (currently stored in RRD). Sensor name consists of base name (everything from start until first '-') and instance name (everything after first '-'). However sensor doesn't need to have associated instance. Examples:

  • if_rx-eth0
    • base: if_rx
    • instance: eth0
  • apache_busyworkers-default
    • base: apache_busyworkers
    • instance: default
  • fs_used-/home/www-data
    • base: fs_used
    • instance: /home/www-data
  • sys_forks
    • base: sys_forks

Sensors aren't currently tied to plugins (on bijk-node). List of valid sensors is in /usr/share/bijk/sensors.db.

Filter configuration

Filters are configured under plugin node in /etc/bijk/plugins.yml. In order to add filter, add sensors node under plugin node (system, disk, filesystem, …) with include and/or exclude child nodes. include and exclude nodes must contain array of Perl regular expressions which are matched with actual sensor. Example:

filesystem:
  sensors:
    include:
      - '^[^-]*-/lib/my_mount'
    exclude:
      - '^[^-]*-/lib'
      - '^[^-]*-/dev'

It's better to put regular expression in quotes to avoid YAML parser from interpreting some special characters. The ^[^-]* matches sensor base name. Here we filter just instances.

Filter processing

Similar to host_access(5).

  1. Some plugin calls update_sensor( sensor_base, timestamp, value, sensor_instance )
  2. If the sensor (name created from sensor_base and sensor_instance) was already checked against filters, sensor is discarded/allowed instantly
  3. If one of the regular expressions in include array matches with sensor name, sensor is allowed
  4. If one of the regular expressions in exclude array matches with sensor name, sensor is discarded
  5. Sensor is allowed

Examples

Suppose you have Ethernet interfaces eth0, eth0:0, eth0:1, eth0:2 where only the first one is real you want to monitor. The configuration for this plugin will look like this:

traffic:
  sensors:
    exclude:
      - 'eth0:'

If you decided you want to monitor also eth0:2, the configuration will look like this:

traffic:
  sensors:
    include:
      - 'eth0:2'
    exclude:
      - 'eth0:'
filters.txt · Last modified: 2010/08/06 19:54 by woky