Interface TelegrafsApi


@ThreadSafe public interface TelegrafsApi
The client of the InfluxDB 2.x that implement Telegrafs HTTP API endpoint.

The following example shows how to create a Telegraf configuration with an output plugin and an input cpu plugin.

 TelegrafPlugin output = new TelegrafPlugin()
                 .type(TelegrafPlugin.TypeEnum.OUTPUT)
                 .name("influxdb_v2")
                 .description("my instance")
                 .putConfigItem("organization", "my-org")
                 .putConfigItem("bucket", "my-bucket")
                 .putConfigItem("token", "$INFLUX_TOKEN")
                 .putConfigItem("urls", Collections.singletonList("http://127.0.0.1:9999"));

 TelegrafPlugin cpu = new TelegrafPlugin()
                 .type(TelegrafPlugin.TypeEnum.INPUT)
                 .name("cpu")
                 .putConfigItem("percpu", true)
                 .putConfigItem("totalcpu", true)
                 .putConfigItem("collect_cpu_time", false)
                 .putConfigItem("report_active", false)
                 .putConfigItem("avoid_null", null);

 Telegraf telegrafConfig = telegrafsApi
      .createTelegraf("Telegraf config", "test-config", organization, Arrays.asList(output, cpu));
 
Author:
Jakub Bednar (bednar@github) (28/02/2019 08:38)
  • Method Details

    • createTelegraf

      @Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull Organization org, @Nonnull Collection<TelegrafPlugin> plugins)
      Create a telegraf config.
      Parameters:
      name - Telegraf Configuration Name
      description - Telegraf Configuration Description
      org - The organization that owns this config
      plugins - The telegraf plugins config
      Returns:
      Telegraf config created
    • createTelegraf

      @Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull Organization org, @Nonnull Map<String,Object> agentConfiguration, @Nonnull Collection<TelegrafPlugin> plugins)
      Create a telegraf config.
      Parameters:
      name - Telegraf Configuration Name
      description - Telegraf Configuration Description
      org - The organization that owns this config
      agentConfiguration - The telegraf agent config
      plugins - The telegraf plugins config
      Returns:
      Telegraf config created
    • createTelegraf

      @Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull String orgID, @Nonnull Collection<TelegrafPlugin> plugins)
      Create a telegraf config.
      Parameters:
      name - Telegraf Configuration Name
      description - Telegraf Configuration Description
      orgID - The organization that owns this config
      plugins - The telegraf plugins config
      Returns:
      Telegraf config created
    • createTelegraf

      Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull String orgID, @Nonnull Map<String,Object> agentConfiguration, @Nonnull Collection<TelegrafPlugin> plugins)
      Create a telegraf config.
      Parameters:
      name - Telegraf Configuration Name
      description - Telegraf Configuration Description
      orgID - The organization that owns this config
      agentConfiguration - The telegraf agent config
      plugins - The telegraf plugins config
      Returns:
      Telegraf config created
    • createTelegraf

      @Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull String orgID, @Nonnull String config, @Nullable TelegrafRequestMetadata metadata)
      Create a telegraf config.
      Parameters:
      name - Telegraf Configuration Name
      description - Telegraf Configuration Description
      orgID - The ID of the organization that owns this config
      config - ConfigTOML contains the raw toml config
      metadata - Metadata for the config
      Returns:
      Telegraf config created
    • createTelegraf

      @Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull Organization org, @Nonnull String config, @Nullable TelegrafRequestMetadata metadata)
      Create a telegraf config.
      Parameters:
      name - Telegraf Configuration Name
      description - Telegraf Configuration Description
      org - The organization that owns this config
      config - ConfigTOML contains the raw toml config
      metadata - Metadata for the config
      Returns:
      Telegraf config created
    • createTelegraf

      @Nonnull Telegraf createTelegraf(@Nonnull TelegrafPluginRequest telegrafPluginRequest)
      Create a telegraf config.
      Parameters:
      telegrafPluginRequest - Telegraf Configuration to create
      Returns:
      Telegraf config created
    • createAgentConfiguration

      @Nonnull HashMap<String,Object> createAgentConfiguration()
      Created default Telegraf Agent configuration.
       [agent]
         interval = "10s"
         round_interval = true
         metric_batch_size = 1000
         metric_buffer_limit = 10000
         collection_jitter = "0s"
         flush_jitter = "0s"
         precision = ""
         omit_hostname = false
       
      Returns:
      default configuration
    • updateTelegraf

      @Nonnull Telegraf updateTelegraf(@Nonnull Telegraf telegraf)
      Update a telegraf config.
      Parameters:
      telegraf - telegraf config update to apply
      Returns:
      An updated telegraf
    • updateTelegraf

      @Nonnull Telegraf updateTelegraf(@Nonnull String telegrafID, @Nonnull TelegrafPluginRequest telegrafRequest)
      Update a telegraf config.
      Parameters:
      telegrafID - ID of telegraf config
      telegrafRequest - telegraf config update to apply
      Returns:
      An updated telegraf
    • deleteTelegraf

      void deleteTelegraf(@Nonnull Telegraf telegraf)
      Delete a telegraf config.
      Parameters:
      telegraf - telegraf config to delete
    • deleteTelegraf

      void deleteTelegraf(@Nonnull String telegrafID)
      Delete a telegraf config.
      Parameters:
      telegrafID - ID of telegraf config to delete
    • cloneTelegraf

      @Nonnull Telegraf cloneTelegraf(@Nonnull String clonedName, @Nonnull String telegrafConfigID)
      Clone a telegraf config.
      Parameters:
      clonedName - name of cloned telegraf config
      telegrafConfigID - ID of telegraf config to clone
      Returns:
      cloned telegraf config
    • cloneTelegraf

      @Nonnull Telegraf cloneTelegraf(@Nonnull String clonedName, @Nonnull Telegraf telegraf)
      Clone a telegraf config.
      Parameters:
      clonedName - name of cloned telegraf config
      telegraf - telegraf config to clone
      Returns:
      cloned telegraf config
    • findTelegrafByID

      @Nonnull Telegraf findTelegrafByID(@Nonnull String telegrafID)
      Retrieve a telegraf config.
      Parameters:
      telegrafID - ID of telegraf config to get
      Returns:
      telegraf config details
    • findTelegrafs

      @Nonnull List<Telegraf> findTelegrafs()
      Returns a list of telegraf configs.
      Returns:
      A list of telegraf configs
    • findTelegrafsByOrg

      @Nonnull List<Telegraf> findTelegrafsByOrg(@Nonnull Organization organization)
      Returns a list of telegraf configs for specified organization.
      Parameters:
      organization - specifies the organization of the telegraf configs
      Returns:
      A list of telegraf configs
    • findTelegrafsByOrgId

      @Nonnull List<Telegraf> findTelegrafsByOrgId(@Nullable String orgID)
      Returns a list of telegraf configs for specified orgID.
      Parameters:
      orgID - specifies the organization of the telegraf configs
      Returns:
      A list of telegraf configs
    • getTOML

      @Nonnull String getTOML(@Nonnull Telegraf telegraf)
      Retrieve a telegraf config in TOML.
      Parameters:
      telegraf - telegraf config to get
      Returns:
      telegraf config details in TOML format
    • getTOML

      @Nonnull String getTOML(@Nonnull String telegrafID)
      Retrieve a telegraf config in TOML.
      Parameters:
      telegrafID - ID of telegraf config to get
      Returns:
      telegraf config details in TOML format
    • getMembers

      @Nonnull List<ResourceMember> getMembers(@Nonnull Telegraf telegraf)
      List all users with member privileges for a telegraf config.
      Parameters:
      telegraf - the telegraf config
      Returns:
      a list of telegraf config members
    • getMembers

      @Nonnull List<ResourceMember> getMembers(@Nonnull String telegrafID)
      List all users with member privileges for a telegraf config.
      Parameters:
      telegrafID - ID of the telegraf config
      Returns:
      a list of telegraf config members
    • addMember

      @Nonnull ResourceMember addMember(@Nonnull User member, @Nonnull Telegraf telegraf)
      Add telegraf config member.
      Parameters:
      member - user to add as member
      telegraf - the telegraf config
      Returns:
      member added to telegraf
    • addMember

      @Nonnull ResourceMember addMember(@Nonnull String memberID, @Nonnull String telegrafID)
      Add telegraf config member.
      Parameters:
      memberID - user ID to add as member
      telegrafID - ID of the telegraf config
      Returns:
      member added to telegraf
    • deleteMember

      void deleteMember(@Nonnull User member, @Nonnull Telegraf telegraf)
      Removes a member from a telegraf config.
      Parameters:
      member - member to remove
      telegraf - the telegraf
    • deleteMember

      void deleteMember(@Nonnull String memberID, @Nonnull String telegrafID)
      Removes a member from a telegraf config.
      Parameters:
      memberID - ID of member to remove
      telegrafID - ID of the telegraf
    • getOwners

      @Nonnull List<ResourceOwner> getOwners(@Nonnull Telegraf telegraf)
      List all owners of a telegraf config.
      Parameters:
      telegraf - the telegraf config
      Returns:
      a list of telegraf config owners
    • getOwners

      @Nonnull List<ResourceOwner> getOwners(@Nonnull String telegrafID)
      List all owners of a telegraf config.
      Parameters:
      telegrafID - ID of the telegraf config
      Returns:
      a list of telegraf config owners
    • addOwner

      @Nonnull ResourceOwner addOwner(@Nonnull User owner, @Nonnull Telegraf telegraf)
      Add telegraf config owner.
      Parameters:
      owner - user to add as owner
      telegraf - the telegraf config
      Returns:
      telegraf config owner added
    • addOwner

      @Nonnull ResourceOwner addOwner(@Nonnull String ownerID, @Nonnull String telegrafID)
      Add telegraf config owner.
      Parameters:
      ownerID - ID of user to add as owner
      telegrafID - ID of the telegraf config
      Returns:
      telegraf config owner added
    • deleteOwner

      void deleteOwner(@Nonnull User owner, @Nonnull Telegraf telegraf)
      Removes an owner from a telegraf config.
      Parameters:
      owner - owner to remove
      telegraf - the telegraf config
    • deleteOwner

      void deleteOwner(@Nonnull String ownerID, @Nonnull String telegrafID)
      Removes an owner from a telegraf config.
      Parameters:
      ownerID - ID of owner to remove
      telegrafID - ID of the telegraf config
    • getLabels

      @Nonnull List<Label> getLabels(@Nonnull Telegraf telegraf)
      List all labels for a telegraf config.
      Parameters:
      telegraf - the telegraf config
      Returns:
      a list of all labels for a telegraf config
    • getLabels

      @Nonnull List<Label> getLabels(@Nonnull String telegrafID)
      List all labels for a telegraf config.
      Parameters:
      telegrafID - ID of the telegraf config
      Returns:
      a list of all labels for a telegraf config
    • addLabel

      @Nonnull LabelResponse addLabel(@Nonnull Label label, @Nonnull Telegraf telegraf)
      Add a label to a telegraf config.
      Parameters:
      label - label to add
      telegraf - the telegraf config
      Returns:
      added label
    • addLabel

      @Nonnull LabelResponse addLabel(@Nonnull String labelID, @Nonnull String telegrafID)
      Add a label to a telegraf config.
      Parameters:
      labelID - ID of label to add
      telegrafID - ID of the telegraf config
      Returns:
      added label
    • deleteLabel

      void deleteLabel(@Nonnull Label label, @Nonnull Telegraf telegraf)
      Delete a label from a telegraf config.
      Parameters:
      label - label to delete
      telegraf - the telegraf config
    • deleteLabel

      void deleteLabel(@Nonnull String labelID, @Nonnull String telegrafID)
      Delete a label from a telegraf config.
      Parameters:
      labelID - ID of label to delete
      telegrafID - ID of the telegraf config