Could you please confirm how to add alias names for multiple agents separately in Inputs.snmp configuration?
Here is the list of agents
[[inputs.snmp]]
agents = [
“udp://11.12.21.21:161”,
“udp://11.12.21.22:161”,
“udp://11.12.21.23:161”,
“udp://11.12.21.24:161”,
“udp://11.12.21.25:161”,
“udp://11.12.21.26:161”,
“udp://11.12.21.27:161”,
“udp://11.12.21.28:161”
]
Thank you for your quick response, I dont see agent_host column get change with alias in the influxDB if I choose option-2. Do I need to enable any additional parameter within Telegraf?
Thanks,
This is very different question than your original question.
alias is used to name and distinguish different plugins from each other. This is especially helpful for logging. It is not used to rename metrics or change the data when sending it.
I think the easiest method to add your “alias” to your metrics is to add a new tag for each snmp output:
Yes I added the tags for each agent in the input.snmp, here is the configuration.
[global_tags]
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
# rack = "1a"
## Environment variables can be used as tags, and throughout the config file
#user = "$USER"
[agent]
## Default data collection interval for all inputs
#interval = "10s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
hostname = ""
## If set to true, do no set the "host" tag in the telegraf agent.
omit_hostname = false
## Method of translating SNMP objects. Can be "netsnmp" (deprecated) which
## translates by calling external programs snmptranslate and snmptable,
## or "gosmi" which translates using the built-in gosmi library.
# snmp_translator = "netsnmp"
## Name of the file to load the state of plugins from and store the state to.
## If uncommented and not empty, this file will be used to save the state of
## stateful plugins on termination of Telegraf. If the file exists on start,
## the state in the file will be restored for the plugins.
# statefile = ""
# # Configuration for sending metrics to InfluxDB 2.0
[[outputs.influxdb_v2]]
# ## The URLs of the InfluxDB cluster nodes.
# ##
# ## Multiple URLs can be specified for a single cluster, only ONE of the
# ## urls will be written to each interval.
# ## ex: urls = ["https://us-west-2-1.aws.cloud2.influxdata.com"]
urls = ["http://10.XX.XX.XX:8086"]
#
# ## Token for authentication.
token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx"
#
# ## Organization is the name of the organization you wish to write to.
organization = "SBC-TEST"
#
# ## Destination bucket to write into.
bucket = "Oracle_SNMP_US"
#
# ## The value of this tag will be used to determine the bucket. If this
# ## tag is not set the 'bucket' option is used as the default.
# # bucket_tag = ""
#
# ## If true, the bucket tag will not be added to the metric.
# # exclude_bucket_tag = false
#
# ## Timeout for HTTP messages.
# # timeout = "5s"
#
# ## Additional HTTP headers
# # http_headers = {"X-Special-Header" = "Special-Value"}
#
# ## HTTP Proxy override, if unset values the standard proxy environment
# ## variables are consulted to determine which proxy, if any, should be used.
# # http_proxy = "http://corporate.proxy:3128"
#
# ## HTTP User-Agent
user_agent = "telegraf"
[[inputs.snmp]]
agents = ["udp://10.XX.XX.XX:161"]
tags = {alias = "US-ECB01"}
[[inputs.snmp]]
agents= ["udp://10.XX.XX.XX:161"]
tags = {alias = "US-ECB02"}
[[inputs.snmp]]
agents= ["udp://10.XX.XX.XX:161"]
tags= {alias = "US-SBC1"}
[[inputs.snmp]]
agents= ["udp://10.XX.XX.XX:161"]
tags= {alias = "US-SBC02"}
[[inputs.snmp]]
agents= ["udp://10.XX.XX.XX:161"]
tags = {alias= "US-SBC05"}
path = ["/usr/share/snmp/mibs"]
#
# ## SNMP community string.
community = "SBCInfluxdb"
#
# ## Agent host tag
agent_host_tag = "agent_host"
#
[[inputs.snmp.table]]
oid = "ACMEPACKET-ENVMON-MIB::apEnvMonTemperatureStatusTable"
name = "SBC-TempStatus"
index_as_tag = true
[[inputs.snmp.table]]
oid = "APSYSMGMT-MIB::apSipSessionAgentStatsTable"
name = "SBC-AgentTableStatus"
# inherit_tags = ["source"]