Package com.influxdb.client
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 Summary
Modifier and TypeMethodDescriptionAdd a label to a telegraf config.Add a label to a telegraf config.Add telegraf config member.Add telegraf config member.Add telegraf config owner.Add telegraf config owner.cloneTelegraf(String clonedName, Telegraf telegraf) Clone a telegraf config.cloneTelegraf(String clonedName, String telegrafConfigID) Clone a telegraf config.Created default Telegraf Agent configuration.createTelegraf(TelegrafPluginRequest telegrafPluginRequest) Create a telegraf config.createTelegraf(String name, String description, Organization org, String config, TelegrafRequestMetadata metadata) Create a telegraf config.createTelegraf(String name, String description, Organization org, Collection<TelegrafPlugin> plugins) Create a telegraf config.createTelegraf(String name, String description, Organization org, Map<String, Object> agentConfiguration, Collection<TelegrafPlugin> plugins) Create a telegraf config.createTelegraf(String name, String description, String orgID, String config, TelegrafRequestMetadata metadata) Create a telegraf config.createTelegraf(String name, String description, String orgID, Collection<TelegrafPlugin> plugins) Create a telegraf config.createTelegraf(String name, String description, String orgID, Map<String, Object> agentConfiguration, Collection<TelegrafPlugin> plugins) Create a telegraf config.voiddeleteLabel(Label label, Telegraf telegraf) Delete a label from a telegraf config.voiddeleteLabel(String labelID, String telegrafID) Delete a label from a telegraf config.voiddeleteMember(User member, Telegraf telegraf) Removes a member from a telegraf config.voiddeleteMember(String memberID, String telegrafID) Removes a member from a telegraf config.voiddeleteOwner(User owner, Telegraf telegraf) Removes an owner from a telegraf config.voiddeleteOwner(String ownerID, String telegrafID) Removes an owner from a telegraf config.voiddeleteTelegraf(Telegraf telegraf) Delete a telegraf config.voiddeleteTelegraf(String telegrafID) Delete a telegraf config.findTelegrafByID(String telegrafID) Retrieve a telegraf config.Returns a list of telegraf configs.findTelegrafsByOrg(Organization organization) Returns a list of telegraf configs for specifiedorganization.findTelegrafsByOrgId(String orgID) Returns a list of telegraf configs for specifiedorgID.List all labels for a telegraf config.List all labels for a telegraf config.getMembers(Telegraf telegraf) List all users with member privileges for a telegraf config.getMembers(String telegrafID) List all users with member privileges for a telegraf config.List all owners of a telegraf config.List all owners of a telegraf config.Retrieve a telegraf config in TOML.Retrieve a telegraf config in TOML.updateTelegraf(Telegraf telegraf) Update a telegraf config.updateTelegraf(String telegrafID, TelegrafPluginRequest telegrafRequest) Update a telegraf config.
-
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 Namedescription- Telegraf Configuration Descriptionorg- The organization that owns this configplugins- 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 Namedescription- Telegraf Configuration Descriptionorg- The organization that owns this configagentConfiguration- The telegraf agent configplugins- 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 Namedescription- Telegraf Configuration DescriptionorgID- The organization that owns this configplugins- 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 Namedescription- Telegraf Configuration DescriptionorgID- The organization that owns this configagentConfiguration- The telegraf agent configplugins- 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 Namedescription- Telegraf Configuration DescriptionorgID- The ID of the organization that owns this configconfig- ConfigTOML contains the raw toml configmetadata- 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 Namedescription- Telegraf Configuration Descriptionorg- The organization that owns this configconfig- ConfigTOML contains the raw toml configmetadata- Metadata for the config- Returns:
- Telegraf config created
-
createTelegraf
Create a telegraf config.- Parameters:
telegrafPluginRequest- Telegraf Configuration to create- Returns:
- Telegraf config created
-
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
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 configtelegrafRequest- telegraf config update to apply- Returns:
- An updated telegraf
-
deleteTelegraf
Delete a telegraf config.- Parameters:
telegraf- telegraf config to delete
-
deleteTelegraf
Delete a telegraf config.- Parameters:
telegrafID- ID of telegraf config to delete
-
cloneTelegraf
Clone a telegraf config.- Parameters:
clonedName- name of cloned telegraf configtelegrafConfigID- ID of telegraf config to clone- Returns:
- cloned telegraf config
-
cloneTelegraf
Clone a telegraf config.- Parameters:
clonedName- name of cloned telegraf configtelegraf- telegraf config to clone- Returns:
- cloned telegraf config
-
findTelegrafByID
Retrieve a telegraf config.- Parameters:
telegrafID- ID of telegraf config to get- Returns:
- telegraf config details
-
findTelegrafs
Returns a list of telegraf configs.- Returns:
- A list of telegraf configs
-
findTelegrafsByOrg
Returns a list of telegraf configs for specifiedorganization.- Parameters:
organization- specifies the organization of the telegraf configs- Returns:
- A list of telegraf configs
-
findTelegrafsByOrgId
Returns a list of telegraf configs for specifiedorgID.- Parameters:
orgID- specifies the organization of the telegraf configs- Returns:
- A list of telegraf configs
-
getTOML
Retrieve a telegraf config in TOML.- Parameters:
telegraf- telegraf config to get- Returns:
- telegraf config details in TOML format
-
getTOML
Retrieve a telegraf config in TOML.- Parameters:
telegrafID- ID of telegraf config to get- Returns:
- telegraf config details in TOML format
-
getMembers
List all users with member privileges for a telegraf config.- Parameters:
telegraf- the telegraf config- Returns:
- a list of telegraf config members
-
getMembers
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
Add telegraf config member.- Parameters:
member- user to add as membertelegraf- the telegraf config- Returns:
- member added to telegraf
-
addMember
Add telegraf config member.- Parameters:
memberID- user ID to add as membertelegrafID- ID of the telegraf config- Returns:
- member added to telegraf
-
deleteMember
Removes a member from a telegraf config.- Parameters:
member- member to removetelegraf- the telegraf
-
deleteMember
Removes a member from a telegraf config.- Parameters:
memberID- ID of member to removetelegrafID- ID of the telegraf
-
getOwners
List all owners of a telegraf config.- Parameters:
telegraf- the telegraf config- Returns:
- a list of telegraf config owners
-
getOwners
List all owners of a telegraf config.- Parameters:
telegrafID- ID of the telegraf config- Returns:
- a list of telegraf config owners
-
addOwner
Add telegraf config owner.- Parameters:
owner- user to add as ownertelegraf- the telegraf config- Returns:
- telegraf config owner added
-
addOwner
Add telegraf config owner.- Parameters:
ownerID- ID of user to add as ownertelegrafID- ID of the telegraf config- Returns:
- telegraf config owner added
-
deleteOwner
Removes an owner from a telegraf config.- Parameters:
owner- owner to removetelegraf- the telegraf config
-
deleteOwner
Removes an owner from a telegraf config.- Parameters:
ownerID- ID of owner to removetelegrafID- ID of the telegraf config
-
getLabels
List all labels for a telegraf config.- Parameters:
telegraf- the telegraf config- Returns:
- a list of all labels for a telegraf config
-
getLabels
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
Add a label to a telegraf config.- Parameters:
label- label to addtelegraf- the telegraf config- Returns:
- added label
-
addLabel
Add a label to a telegraf config.- Parameters:
labelID- ID of label to addtelegrafID- ID of the telegraf config- Returns:
- added label
-
deleteLabel
Delete a label from a telegraf config.- Parameters:
label- label to deletetelegraf- the telegraf config
-
deleteLabel
Delete a label from a telegraf config.- Parameters:
labelID- ID of label to deletetelegrafID- ID of the telegraf config
-