@ThreadSafe public interface TelegrafsApi
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));
| Modifier and Type | Method and Description |
|---|---|
LabelResponse |
addLabel(Label label,
Telegraf telegraf)
Add a label to a telegraf config.
|
LabelResponse |
addLabel(String labelID,
String telegrafID)
Add a label to a telegraf config.
|
ResourceMember |
addMember(String memberID,
String telegrafID)
Add telegraf config member.
|
ResourceMember |
addMember(User member,
Telegraf telegraf)
Add telegraf config member.
|
ResourceOwner |
addOwner(String ownerID,
String telegrafID)
Add telegraf config owner.
|
ResourceOwner |
addOwner(User owner,
Telegraf telegraf)
Add telegraf config owner.
|
Telegraf |
cloneTelegraf(String clonedName,
String telegrafConfigID)
Clone a telegraf config.
|
Telegraf |
cloneTelegraf(String clonedName,
Telegraf telegraf)
Clone a telegraf config.
|
HashMap<String,Object> |
createAgentConfiguration()
Created default Telegraf Agent configuration.
|
Telegraf |
createTelegraf(String name,
String description,
Organization org,
Collection<TelegrafPlugin> plugins)
Create a telegraf config.
|
Telegraf |
createTelegraf(String name,
String description,
Organization org,
Map<String,Object> agentConfiguration,
Collection<TelegrafPlugin> plugins)
Create a telegraf config.
|
Telegraf |
createTelegraf(String name,
String description,
Organization org,
String config,
TelegrafRequestMetadata metadata)
Create a telegraf config.
|
Telegraf |
createTelegraf(String name,
String description,
String orgID,
Collection<TelegrafPlugin> plugins)
Create a telegraf config.
|
Telegraf |
createTelegraf(String name,
String description,
String orgID,
Map<String,Object> agentConfiguration,
Collection<TelegrafPlugin> plugins)
Create a telegraf config.
|
Telegraf |
createTelegraf(String name,
String description,
String orgID,
String config,
TelegrafRequestMetadata metadata)
Create a telegraf config.
|
Telegraf |
createTelegraf(TelegrafPluginRequest telegrafPluginRequest)
Create a telegraf config.
|
void |
deleteLabel(Label label,
Telegraf telegraf)
Delete a label from a telegraf config.
|
void |
deleteLabel(String labelID,
String telegrafID)
Delete a label from a telegraf config.
|
void |
deleteMember(String memberID,
String telegrafID)
Removes a member from a telegraf config.
|
void |
deleteMember(User member,
Telegraf telegraf)
Removes a member from a telegraf config.
|
void |
deleteOwner(String ownerID,
String telegrafID)
Removes an owner from a telegraf config.
|
void |
deleteOwner(User owner,
Telegraf telegraf)
Removes an owner from a telegraf config.
|
void |
deleteTelegraf(String telegrafID)
Delete a telegraf config.
|
void |
deleteTelegraf(Telegraf telegraf)
Delete a telegraf config.
|
Telegraf |
findTelegrafByID(String telegrafID)
Retrieve a telegraf config.
|
List<Telegraf> |
findTelegrafs()
Returns a list of telegraf configs.
|
List<Telegraf> |
findTelegrafsByOrg(Organization organization)
Returns a list of telegraf configs for specified
organization. |
List<Telegraf> |
findTelegrafsByOrgId(String orgID)
Returns a list of telegraf configs for specified
orgID. |
List<Label> |
getLabels(String telegrafID)
List all labels for a telegraf config.
|
List<Label> |
getLabels(Telegraf telegraf)
List all labels for a telegraf config.
|
List<ResourceMember> |
getMembers(String telegrafID)
List all users with member privileges for a telegraf config.
|
List<ResourceMember> |
getMembers(Telegraf telegraf)
List all users with member privileges for a telegraf config.
|
List<ResourceOwner> |
getOwners(String telegrafID)
List all owners of a telegraf config.
|
List<ResourceOwner> |
getOwners(Telegraf telegraf)
List all owners of a telegraf config.
|
String |
getTOML(String telegrafID)
Retrieve a telegraf config in TOML.
|
String |
getTOML(Telegraf telegraf)
Retrieve a telegraf config in TOML.
|
Telegraf |
updateTelegraf(String telegrafID,
TelegrafPluginRequest telegrafRequest)
Update a telegraf config.
|
Telegraf |
updateTelegraf(Telegraf telegraf)
Update a telegraf config.
|
@Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull Organization org, @Nonnull Collection<TelegrafPlugin> plugins)
name - Telegraf Configuration Namedescription - Telegraf Configuration Descriptionorg - The organization that owns this configplugins - The telegraf plugins config@Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull Organization org, @Nonnull Map<String,Object> agentConfiguration, @Nonnull Collection<TelegrafPlugin> plugins)
name - Telegraf Configuration Namedescription - Telegraf Configuration Descriptionorg - The organization that owns this configagentConfiguration - The telegraf agent configplugins - The telegraf plugins config@Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull String orgID, @Nonnull Collection<TelegrafPlugin> plugins)
name - Telegraf Configuration Namedescription - Telegraf Configuration DescriptionorgID - The organization that owns this configplugins - The telegraf plugins configTelegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull String orgID, @Nonnull Map<String,Object> agentConfiguration, @Nonnull Collection<TelegrafPlugin> plugins)
name - Telegraf Configuration Namedescription - Telegraf Configuration DescriptionorgID - The organization that owns this configagentConfiguration - The telegraf agent configplugins - The telegraf plugins config@Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull String orgID, @Nonnull String config, @Nullable TelegrafRequestMetadata metadata)
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@Nonnull Telegraf createTelegraf(@Nonnull String name, @Nullable String description, @Nonnull Organization org, @Nonnull String config, @Nullable TelegrafRequestMetadata metadata)
name - Telegraf Configuration Namedescription - Telegraf Configuration Descriptionorg - The organization that owns this configconfig - ConfigTOML contains the raw toml configmetadata - Metadata for the config@Nonnull Telegraf createTelegraf(@Nonnull TelegrafPluginRequest telegrafPluginRequest)
telegrafPluginRequest - Telegraf Configuration to create@Nonnull HashMap<String,Object> createAgentConfiguration()
[agent] interval = "10s" round_interval = true metric_batch_size = 1000 metric_buffer_limit = 10000 collection_jitter = "0s" flush_jitter = "0s" precision = "" omit_hostname = false
@Nonnull Telegraf updateTelegraf(@Nonnull Telegraf telegraf)
telegraf - telegraf config update to apply@Nonnull Telegraf updateTelegraf(@Nonnull String telegrafID, @Nonnull TelegrafPluginRequest telegrafRequest)
telegrafID - ID of telegraf configtelegrafRequest - telegraf config update to applyvoid deleteTelegraf(@Nonnull Telegraf telegraf)
telegraf - telegraf config to deletevoid deleteTelegraf(@Nonnull String telegrafID)
telegrafID - ID of telegraf config to delete@Nonnull Telegraf cloneTelegraf(@Nonnull String clonedName, @Nonnull String telegrafConfigID)
clonedName - name of cloned telegraf configtelegrafConfigID - ID of telegraf config to clone@Nonnull Telegraf cloneTelegraf(@Nonnull String clonedName, @Nonnull Telegraf telegraf)
clonedName - name of cloned telegraf configtelegraf - telegraf config to clone@Nonnull Telegraf findTelegrafByID(@Nonnull String telegrafID)
telegrafID - ID of telegraf config to get@Nonnull List<Telegraf> findTelegrafs()
@Nonnull List<Telegraf> findTelegrafsByOrg(@Nonnull Organization organization)
organization.organization - specifies the organization of the telegraf configs@Nonnull List<Telegraf> findTelegrafsByOrgId(@Nullable String orgID)
orgID.orgID - specifies the organization of the telegraf configs@Nonnull String getTOML(@Nonnull Telegraf telegraf)
telegraf - telegraf config to get@Nonnull String getTOML(@Nonnull String telegrafID)
telegrafID - ID of telegraf config to get@Nonnull List<ResourceMember> getMembers(@Nonnull Telegraf telegraf)
telegraf - the telegraf config@Nonnull List<ResourceMember> getMembers(@Nonnull String telegrafID)
telegrafID - ID of the telegraf config@Nonnull ResourceMember addMember(@Nonnull User member, @Nonnull Telegraf telegraf)
member - user to add as membertelegraf - the telegraf config@Nonnull ResourceMember addMember(@Nonnull String memberID, @Nonnull String telegrafID)
memberID - user ID to add as membertelegrafID - ID of the telegraf configvoid deleteMember(@Nonnull User member, @Nonnull Telegraf telegraf)
member - member to removetelegraf - the telegrafvoid deleteMember(@Nonnull String memberID, @Nonnull String telegrafID)
telegrafID - ID of the telegrafmemberID - ID of member to remove@Nonnull List<ResourceOwner> getOwners(@Nonnull Telegraf telegraf)
telegraf - the telegraf config@Nonnull List<ResourceOwner> getOwners(@Nonnull String telegrafID)
telegrafID - ID of the telegraf config@Nonnull ResourceOwner addOwner(@Nonnull User owner, @Nonnull Telegraf telegraf)
owner - user to add as ownertelegraf - the telegraf config@Nonnull ResourceOwner addOwner(@Nonnull String ownerID, @Nonnull String telegrafID)
telegrafID - ID of the telegraf configownerID - ID of user to add as ownervoid deleteOwner(@Nonnull User owner, @Nonnull Telegraf telegraf)
owner - owner to removetelegraf - the telegraf configvoid deleteOwner(@Nonnull String ownerID, @Nonnull String telegrafID)
telegrafID - ID of the telegraf configownerID - ID of owner to remove@Nonnull List<Label> getLabels(@Nonnull Telegraf telegraf)
telegraf - the telegraf config@Nonnull List<Label> getLabels(@Nonnull String telegrafID)
telegrafID - ID of the telegraf config@Nonnull LabelResponse addLabel(@Nonnull Label label, @Nonnull Telegraf telegraf)
label - label to addtelegraf - the telegraf config@Nonnull LabelResponse addLabel(@Nonnull String labelID, @Nonnull String telegrafID)
telegrafID - ID of the telegraf configlabelID - ID of label to addvoid deleteLabel(@Nonnull Label label, @Nonnull Telegraf telegraf)
label - label to deletetelegraf - the telegraf configCopyright © 2018–2023 InfluxData, Inc.. All rights reserved.