Executable Input

Note

This plugin is currently being groomed to be an integration. It works, but we haven’t spent a lot of time on it yet to optimize the user experience. Feel free to try it out, just keep in mind that we will be enhancing the experience over time.

This plugin is ported from the Telegraf Exec Input Plugin. It runs a script and reads its output. The plugin is able to parse the Nagios input data format.

Setup

The nagios plugin is included with the AppOptics host agent by default, please follow the directions below to enable it for a host agent instance.

Configuration

The host agent provides an example configuration file to help you get started quickly. It defines the plugin and task file to be loaded by the agent, but requires you to provide the correct settings for your installation. In this example a script called /tmp/test.sh, a script called /tmp/test2.sh, and all scripts matching glob pattern /tmp/collect_*.sh are configured for JSON format. Glob patterns are matched on every run, so adding new scripts that match the pattern will cause them to be picked up immediately. To enable the plugin:

  1. Make a copy of the exec example configuration file /opt/appoptics/etc/plugins.d/exec.yaml.example, renaming it to /opt/appoptics/etc/plugins.d/exec.yaml:
$ sudo cp /opt/appoptics/etc/plugins.d/exec.yaml.example /opt/appoptics/etc/plugins.d/exec.yaml
  1. Update the /opt/appoptics/etc/plugins.d/exec.yaml configuration file with settings specific to your use case, for example:
collector:
      exec:
        all:
          ## Commands array
          commands: |-
            /tmp/test.sh
            /usr/bin/mycollector --foo=bar
            /tmp/collect_*.sh

          ## Timeout for each command to complete.
          timeout: "5s"
          ## measurement name suffix (for separating different commands)
          name_suffix: "_mycollector"
          ## Data format to consume: "collectd", "graphite", "influx", "json", "nagios", or "value"
          data_format: "json"

    load:
      plugin: snap-plugin-collector-bridge-exec
      task: task-bridge-exec.yaml
  1. Restart the host agent:
$ sudo service appoptics-snapteld restart

Let’s say that we have the above configuration, and mycollector outputs the following JSON:

{
    "a": 0.5,
    "b": {
        "c": 0.1,
        "d": 5
    }
}

The collected metrics will be stored as fields under the measurement “exec_mycollector”:

exec_mycollector a=0.5,b_c=0.1,b_d=5 1452815002357578567

If using JSON, only numeric values are parsed and turned into floats. Booleans and strings will be ignored.

See more examples in the Telegraf Exec Input Plugin docs.

Metrics

For this plugin it doesn’t make much sense to create a metric table as the metrics that are generated depend on how the plugin is configured.