Metric tags

Tags allow you to add extra identifiers to your metrics. This is useful to give more context to a metric which also allows for the monitoring of multiple instances of supported plugins. Tags are also available for use in custom plugins.

The common use case for tags is to allow monitoring of multiple instances of the same service/plugin. For example, you could monitor two MySQL servers from a single agent install. This can be configured from the plugin's .yaml configuration file at /etc/sd-agent/conf.d/

Here's an example MySQL config with multiple instances and tags:

init_config:

instances:
    # NOTE: Even if the server name is "localhost", the agent will connect to MySQL using TCP/IP, unless you also
    # provide a value for the sock key (below).
  - server: localhost
    user: serverdensity
    pass: *******
    # port: 3306             # Optional
    sock: /var/run/mysqld/mysqld.sock    # Connect via Unix Socket
    # defaults_file: my.cnf  # Alternate configuration mechanism
    # connect_timeout: None  # Optional integer seconds
    tags:                  # Optional
      - server:localhost
    # options:               # Optional
    #   replication: false
    #   replication_non_blocking_status: false  # grab slave count in non-blocking manner (req. performance_schema)
    #   galera_cluster: false
    #   extra_status_metrics: true
    #   extra_innodb_metrics: true

  - server: remote
    user: serverdensity
    pass: *******
    # port: 3306             # Optional
    sock: /var/run/mysqld/mysqld.sock    # Connect via Unix Socket
    # defaults_file: my.cnf  # Alternate configuration mechanism
    # connect_timeout: None  # Optional integer seconds
    tags:                  # Optional
      - server:remote
    # options:               # Optional
    #   replication: false
    #   replication_non_blocking_status: false  # grab slave count in non-blocking manner (req. performance_schema)
    #   galera_cluster: false
    #   extra_status_metrics: true
    #   extra_innodb_metrics: true


You can refer to the example configs for examples on how to use tags for the plugin if supported (/etc/sd-agent/conf.d/plugin.yaml.example). Please note that tags must be key:value pairs else they will be ignored (see server:remote in the example above)

Once the instances are returning metrics you can differentiate between them on graphs and alerts under the "Source" dropdown:

Capture39.PNG

Capture40.PNG

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.