Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: get telegraf by id doesn't seem to work #19626

Closed
russorat opened this issue Sep 23, 2020 · 2 comments · Fixed by #19695
Closed

cli: get telegraf by id doesn't seem to work #19626

russorat opened this issue Sep 23, 2020 · 2 comments · Fixed by #19695
Assignees

Comments

@russorat
Copy link
Contributor

My expectation is that when i add the -i option to the influx telegrafs command, only a single telegraf config is returned.

➜  influxdb git:(master) ✗ influx telegrafs -h

	List Telegraf configuration(s). Subcommands manage Telegraf configurations.

	Examples:
		# list all known Telegraf configurations
		influx telegrafs

		# list Telegraf configuration corresponding to specific ID
		influx telegrafs --id $ID

		# list Telegraf configuration corresponding to specific ID shorts
		influx telegrafs -i $ID

Usage:
  influx telegrafs [flags]
  influx telegrafs [command]

Available Commands:
  create      Create a Telegraf configuration
  rm          Remove Telegraf configuration(s)
  update      Update a Telegraf configuration

Flags:
  -c, --active-config string   Config name to use for command; Maps to env var $INFLUX_ACTIVE_CONFIG
      --configs-path string    Path to the influx CLI configurations; Maps to env var $INFLUX_CONFIGS_PATH (default "/Users/rsavage/.influxdbv2/configs")
  -h, --help                   Help for the telegrafs command
      --hide-headers           Hide the table headers; defaults false; Maps to env var $INFLUX_HIDE_HEADERS
      --host string            HTTP address of InfluxDB; Maps to env var $INFLUX_HOST
  -i, --id string              Telegraf configuration ID to retrieve.
      --json                   Output data as json; defaults false; Maps to env var $INFLUX_OUTPUT_JSON
  -o, --org string             The name of the organization; Maps to env var $INFLUX_ORG
      --org-id string          The ID of the organization; Maps to env var $INFLUX_ORG_ID
      --skip-verify            Skip TLS certificate chain and host name verification.
  -t, --token string           Authentication token; Maps to env var $INFLUX_TOKEN

Use "influx telegrafs [command] --help" for more information about a command.
➜  influxdb git:(master) ✗ influx telegrafs
ID			OrgID			Name		Description
03a79fae3d9f2000	03921cbebef90000	System Metrics
04c6b75311f76000	03921cbebef90000	Docker + System
04f269ca24531000	03921cbebef90000	MyData
➜  influxdb git:(master) ✗ influx telegrafs -i 03a79fae3d9f2000
ID			OrgID			Name		Description
03a79fae3d9f2000	03921cbebef90000	System Metrics
04c6b75311f76000	03921cbebef90000	Docker + System
04f269ca24531000	03921cbebef90000	MyData
@glinton
Copy link
Contributor

glinton commented Oct 6, 2020

This appears to be a cloud api issue, as a raw curl to cloud returns all telegrafs as well.

$ curl -s -H "Authorization: Token abc123" \
   '...cloud2.influxdata.com/api/v2/telegrafs?orgID=abc123&resourceID=abc123' | jq
{
  "configurations": [
    {
      "id": "abc000",
      "orgID": "abc123",
      "name": "namedTelegraf",
      "config": "# some telegraf config",
      "metadata": {
        "buckets": [
          "bucket name"
        ]
      },
      "labels": [],
      "links": {}
    },
    {
      "id": "abc001",
      "orgID": "abc123",
      "name": "namedTelegraf",
      "config": "# some telegraf config",
      "metadata": {
        "buckets": [
          "bucket name"
        ]
      },
      "labels": [],
      "links": {}
    },
    {
      "id": "abc123",
      "orgID": "abc123",
      "name": "namedTelegraf",
      "description": "test fetching single resource",
      "config": "# some telegraf config",
      "metadata": {
        "buckets": [
          "bucket name"
        ]
      },
      "labels": [],
      "links": {}
    }
  ]
}

Using the cli or curl against an oss instance returns the individual config as expected.

There is currently no means in the cli to return the config portion of the telegraf config if that is what was expected.

@russorat
Copy link
Contributor Author

russorat commented Oct 6, 2020

thanks @glinton ! i think the CLI should be using this API to fetch the specific telegraf resource given it's ID, similar to other resources: https://docs.influxdata.com/influxdb/v2.0/api/#operation/GetTelegrafsID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants