Skip to content

Telegraf

LinShunKang edited this page Feb 2, 2022 · 6 revisions

MyPerf4J 2.x and before itself does not access InfluxDB, but instead imports statistical data into InfluxDB via Telegraf by writing statistics to the log file.

Specific steps are as follows:

  • Install Telegraf

  • Configuring /usr/local/etc/telegraf.conf:

    # Global tags can be specified here in key="value" format.
    [global_tags]
      dc = ""
    
    # Configuration for telegraf agent
    [agent]
      ## Default data collection interval for all inputs
      interval = "1s"
      ## Rounds collection interval to 'interval'
      ## ie, if interval="10s" then always collect on :00, :10, :20, etc.
      round_interval = true
      metric_batch_size = 1000
      metric_buffer_limit = 10000
      collection_jitter = "0s"
      ## Default flushing interval for all outputs. You shouldn't set this below
      ## interval. Maximum flush_interval will be flush_interval + flush_jitter
      flush_interval = "1s"
      flush_jitter = "0s"
      precision = "ms"
      debug = false
      quiet = false
      logfile = "/tmp/telegraf.log"
      ## Override default hostname, if empty use os.Hostname()
      hostname = ""
      ## If set to true, do no set the "host" tag in the telegraf agent.
      omit_hostname = false
    
    [[outputs.influxdb]]
      urls = ["http://127.0.0.1:8086"]
      database = "MyPerf4J_Test"
      retention_policy = ""
      write_consistency = "any"
      timeout = "5s"
    
    [[inputs.tail]]
      files = ["/data/logs/MyPerf4J/metrics.log"]
      from_beginning = false
      pipe = false
      ## Method used to watch for file updates.  Can be either "inotify" or "poll".
      watch_method = "inotify"
      data_format = "influx"
    
  • Start Telegraf

  • Next Step

Clone this wiki locally