Add a custom metric

Add a custom metric

If required, you can add a custom metric, for example, to monitor a third-party software. This section describes how to add a custom metric to Telegraf.

Note

To add a custom metric to a new endpoint, you must first add the new endpoint to Prometheus as described in Add a custom monitoring endpoint.

To add a custom metric to Telegraf:

  1. Log in to the Salt Master node.

  2. Edit the telegraf section in the classes/cluster/cluster_name/init.yml file of the Reclass model as required.

    Example:

    telegraf:
      agent:
        input:
          procstat:
            process:
              memcached:
                exe: memcached
          memcached:
            servers:
              - address: {{ server.bind.address | replace("0.0.0.0", "127.0.0.1") }}
                port: {{ server.bind.port }}
    
  3. Apply the Telegraf Salt formula:

    salt -C 'I@linux:system' state.sls telegraf