Advertisement
Guest User

localhost.conf

a guest
Jul 1st, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.41 KB | None | 0 0
  1. # Telegraf Configuration
  2. #
  3. # Telegraf is entirely plugin driven. All metrics are gathered from the
  4. # declared inputs, and sent to the declared outputs.
  5. #
  6. # Plugins must be declared in here to be active.
  7. # To deactivate a plugin, comment out the name and any variables.
  8. #
  9. # Use 'telegraf -config telegraf.conf -test' to see what metrics a config
  10. # file would generate.
  11. #
  12. # Environment variables can be used anywhere in this config file, simply prepend
  13. # them with $. For strings the variable must be within quotes (ie, "$STR_VAR"),
  14. # for numbers and booleans they should be plain (ie, $INT_VAR, $BOOL_VAR)
  15.  
  16.  
  17. # Global tags can be specified here in key="value" format.
  18. [global_tags]
  19.   # dc = "us-east-1" # will tag all metrics with dc=us-east-1
  20.   # rack = "1a"
  21.   ## Environment variables can be used as tags, and throughout the config file
  22.   # user = "$USER"
  23.  
  24.  
  25. # Configuration for telegraf agent
  26. [agent]
  27.   ## Default data collection interval for all inputs
  28.   interval = "10s"
  29.   ## Rounds collection interval to 'interval'
  30.   ## ie, if interval="10s" then always collect on :00, :10, :20, etc.
  31.   round_interval = true
  32.  
  33.   ## Telegraf will send metrics to outputs in batches of at
  34.   ## most metric_batch_size metrics.
  35.   metric_batch_size = 1000
  36.   ## For failed writes, telegraf will cache metric_buffer_limit metrics for each
  37.   ## output, and will flush this buffer on a successful write. Oldest metrics
  38.   ## are dropped first when this buffer fills.
  39.   metric_buffer_limit = 10000
  40.  
  41.   ## Collection jitter is used to jitter the collection by a random amount.
  42.   ## Each plugin will sleep for a random time within jitter before collecting.
  43.   ## This can be used to avoid many plugins querying things like sysfs at the
  44.   ## same time, which can have a measurable effect on the system.
  45.   collection_jitter = "0s"
  46.  
  47.   ## Default flushing interval for all outputs. You shouldn't set this below
  48.   ## interval. Maximum flush_interval will be flush_interval + flush_jitter
  49.   flush_interval = "10s"
  50.   ## Jitter the flush interval by a random amount. This is primarily to avoid
  51.   ## large write spikes for users running a large number of telegraf instances.
  52.   ## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
  53.   flush_jitter = "0s"
  54.  
  55.   ## Run telegraf in debug mode
  56.   debug = false
  57.   ## Run telegraf in quiet mode
  58.   quiet = false
  59.   ## Override default hostname, if empty use os.Hostname()
  60.   hostname = ""
  61.   ## If set to true, do no set the "host" tag in the telegraf agent.
  62.   omit_hostname = false
  63.  
  64.  
  65. ###############################################################################
  66. #                            OUTPUT PLUGINS                                   #
  67. ###############################################################################
  68.  
  69. # Configuration for influxdb server to send metrics to
  70. [[outputs.influxdb]]
  71.   ## The full HTTP or UDP endpoint URL for your InfluxDB instance.
  72.   ## Multiple urls can be specified as part of the same cluster,
  73.   ## this means that only ONE of the urls will be written to each interval.
  74.   # urls = ["udp://localhost:8089"] # UDP endpoint example
  75.   urls = ["http://localhost:8086"] # required
  76.   ## The target database for metrics (telegraf will create it if not exists).
  77.   database = "telegraf" # required
  78.   ## Precision of writes, valid values are "ns", "us" (or "ยตs"), "ms", "s", "m", "h".
  79.   ## note: using "s" precision greatly improves InfluxDB compression.
  80.   precision = "s"
  81.  
  82.   ## Retention policy to write to.
  83.   retention_policy = "default"
  84.   ## Write consistency (clusters only), can be: "any", "one", "quorom", "all"
  85.   write_consistency = "any"
  86.  
  87.   ## Write timeout (for the InfluxDB client), formatted as a string.
  88.   ## If not provided, will default to 5s. 0s means no timeout (not recommended).
  89.   timeout = "5s"
  90.   # username = "telegraf"
  91.   # password = "metricsmetricsmetricsmetrics"
  92.   ## Set the user agent for HTTP POSTs (can be useful for log differentiation)
  93.   # user_agent = "telegraf"
  94.   ## Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
  95.   # udp_payload = 512
  96.  
  97.   ## Optional SSL Config
  98.   # ssl_ca = "/etc/telegraf/ca.pem"
  99.   # ssl_cert = "/etc/telegraf/cert.pem"
  100.   # ssl_key = "/etc/telegraf/key.pem"
  101.   ## Use SSL but skip chain & host verification
  102.   # insecure_skip_verify = false
  103.  
  104.  
  105.  
  106. ###############################################################################
  107. #                            INPUT PLUGINS                                    #
  108. ###############################################################################
  109.  
  110. # Reads oids value from one or many snmp agents
  111. [[inputs.snmp]]
  112.   ## Use 'oids.txt' file to translate oids to names
  113.   ## To generate 'oids.txt' you need to run:
  114.   ##   snmptranslate -m all -Tz -On | sed -e 's/"//g' > /tmp/oids.txt
  115.   ## Or if you have an other MIB folder with custom MIBs
  116.   ##   snmptranslate -M /mycustommibfolder -Tz -On -m all | sed -e 's/"//g' > oids.txt
  117.   snmptranslate_file = "/tmp/oids.txt"
  118.   [[inputs.snmp.host]]
  119.     address = "192.168.2.2:161"
  120.     # SNMP community
  121.     community = "public" # default public
  122.     # SNMP version (1, 2 or 3)
  123.     # Version 3 not supported yet
  124.     version = 2 # default 2
  125.     # SNMP response timeout
  126.     timeout = 2.0 # default 2.0
  127.     # SNMP request retries
  128.     retries = 2 # default 2
  129.     # Which get/bulk do you want to collect for this host
  130.     collect = ["mybulk", "sysservices", "sysdescr"]
  131.     # Simple list of OIDs to get, in addition to "collect"
  132.     get_oids = []
  133.  
  134.   [[inputs.snmp.host]]
  135.     address = "192.168.2.3:161"
  136.     community = "public"
  137.     version = 2
  138.     timeout = 2.0
  139.     retries = 2
  140.     collect = ["mybulk"]
  141.     get_oids = [
  142.         "ifNumber",
  143.         ".1.3.6.1.2.1.1.3.0",
  144.     ]
  145.  
  146.   [[inputs.snmp.get]]
  147.     name = "ifnumber"
  148.     oid = "ifNumber"
  149.  
  150.   [[inputs.snmp.get]]
  151.     name = "interface_speed"
  152.     oid = "ifSpeed"
  153.     instance = "0"
  154.  
  155.   [[inputs.snmp.get]]
  156.     name = "sysuptime"
  157.     oid = ".1.3.6.1.2.1.1.3.0"
  158.     unit = "second"
  159.  
  160.   [[inputs.snmp.bulk]]
  161.     name = "mybulk"
  162.     max_repetition = 127
  163.     oid = ".1.3.6.1.2.1.1"
  164.  
  165.   [[inputs.snmp.bulk]]
  166.     name = "ifoutoctets"
  167.     max_repetition = 127
  168.     oid = "ifOutOctets"
  169.  
  170.   [[inputs.snmp.host]]
  171.     address = "192.168.2.13:161"
  172.     #address = "127.0.0.1:161"
  173.     community = "public"
  174.     version = 2
  175.     timeout = 2.0
  176.     retries = 2
  177.     #collect = ["mybulk", "sysservices", "sysdescr", "systype"]
  178.     collect = ["sysuptime" ]
  179.     [[inputs.snmp.host.table]]
  180.       name = "iftable3"
  181.       include_instances = ["enp5s0", "eth1"]
  182.  
  183.   # SNMP TABLEs
  184.   # table without mapping neither subtables
  185.   [[inputs.snmp.table]]
  186.     name = "iftable1"
  187.     oid = ".1.3.6.1.2.1.31.1.1.1"
  188.  
  189.   # table without mapping but with subtables
  190.   [[inputs.snmp.table]]
  191.     name = "iftable2"
  192.     oid = ".1.3.6.1.2.1.31.1.1.1"
  193.     sub_tables = [".1.3.6.1.2.1.2.2.1.13"]
  194.  
  195.   # table with mapping but without subtables
  196.   [[inputs.snmp.table]]
  197.     name = "iftable3"
  198.     oid = ".1.3.6.1.2.1.31.1.1.1"
  199.     # if empty. get all instances
  200.     mapping_table = ".1.3.6.1.2.1.31.1.1.1.1"
  201.     # if empty, get all subtables
  202.  
  203.   # table with both mapping and subtables
  204.   [[inputs.snmp.table]]
  205.     name = "iftable4"
  206.     oid = ".1.3.6.1.2.1.31.1.1.1"
  207.     # if empty get all instances
  208.     mapping_table = ".1.3.6.1.2.1.31.1.1.1.1"
  209.     # if empty get all subtables
  210.     # sub_tables could be not "real subtables"
  211.     sub_tables=[".1.3.6.1.2.1.2.2.1.13", "bytes_recv", "bytes_send"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement