Skip to content

/telegrafs POST are requestBody properties up-to-date?  #611

@karel-rehor

Description

@karel-rehor

After comparing a POST request to /telegrafs sent from the UI to the definitions in openapi
(components/schemas/TelegrafPluginRequest) there appears to be a number of differences.

The UI request body looks like this.

{
   "name":"Ferret Config",
   "description":"asdf",
   "agent":{"collectionInterval":10000},
   "orgID":"9c5955fc99a60b8f",
   "plugins":
      [
         {
            "name":"influxdb_v2",
            "type":
            "output",
            "config":
               {
                  "urls":
                     [
                        "https://twodotoh-dev-bonitoo-kk.remocal.influxdev.co"
                     ],
                  "token":"$INFLUX_TOKEN",
                  "organization":"dev",
                  "bucket":"devbucket"
               }
         },
         {
            "name":"cpu",
            "type":"input"
        }
      ]
}

There are five top level properties name, description, agent, orgID, plugins.

The document components/schemas/TelegrafPluginRequest.yml also includes fields for metadata and config, however it makes no mention of an agent field. Also during blackbox testing, when sending a request body with a combination {name, description, orgID, config} the server returns HTTP 500.

The fields metadata and config do show up as part of the response, however the response config field seems to ignore the config field sent in the request. I see the word "legacy" in the comments of the yaml document, So, the question arises: are these schema definitions up-to-date?

# This defines the 'legacy' `TelegrafConfigDecode` type in the api.
type: object
properties:
  name:
    type: string
  description:
    type: string
  plugins:
    type: array
    items:
      type: object
      properties:
        type:
          type: string
        name:
          type: string
        alias:
          type: string
        description:
          type: string
        config:
          type: string
  metadata:
    type: object
    properties:
      buckets:
        type: array
        items:
          type: string
  config:
    type: string
  orgID:
    type: string

Related Issue
#610

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions