From Telegraf To NewRelic

Standard

wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
apt-get update
apt-get install telegraf
systemctl start telegraf
root@ye:/etc/telegraf# cat /var/log/legacy-mq-metrics.log 
{"timestamp": 1588100043050, "metricName": "messageQueue.operation", "product": "Legacy MQ", "productVersion": "8.0.1.11", "connectionId": "64688F5E01E47020", "clientIpAddress": "36.1.90.2", "clientName": "JMS Producer", "queueManager": "QM1", "queueTopic": "MY.QUEUE.1", "putMessage": 3605}
{"timestamp": 1588100044203, "metricName": "messageQueue.operation", "product": "Legacy MQ", "productVersion": "8.0.1.11", "connectionId": "64688F5E01F0F77A", "clientIpAddress": "36.1.90.2", "clientName": "JMS Consumer","queueManager": "QM1", "queueTopic": "MY.QUEUE.1", "getMessage": 2000}
{"timestamp": 1588100060150, "metricName": "messageQueue.operation", "product": "Legacy MQ", "productVersion": "8.0.1.11", "connectionId": "64688F5E01E47020", "clientIpAddress": "36.1.90.5", "clientName": "Fin Producer", "queueManager": "QM1", "queueTopic": "MY.QUEUE.2", "putMessage": 400}
{"timestamp": 1588100065285, "metricName": "messageQueue.operation", "product": "Legacy MQ", "productVersion": "8.0.1.11", "connectionId": "64688F5E01F0F77A", "clientIpAddress": "36.1.90.7", "clientName": "Fin Consumer", "queueManager": "QM1", "queueTopic": "MY.QUEUE.2", "getMessage": 400}
root@ye:/etc/telegraf# cat /etc/telegraf/telegraf.conf
[global_tags]
[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  hostname = ""
  omit_hostname = false
  ## Log at debug level.
  debug = true
  ## Log only error level messages.
  # quiet = false
  logtarget = "file"
  logfile = "/var/log/telegraf.log"
  logfile_rotation_interval = "1d"
  logfile_rotation_max_size = "5MB"
[[outputs.influxdb]]
# Send telegraf metrics to a file for debugging
[[outputs.file]]
  ## Files to write to, "stdout" is a specially handled file.
  files = ["/var/log/metrics.out"]
  use_batch_format = false
  data_format = "json"
[[outputs.newrelic]]
  insights_key = "0154f7b739637exxxxxxxxxxxxxxxxxxxxxxxxxx"
  # we don’t need to send this as a field.  The plugin will send a proper timestamp via the Metrics API.
  fielddrop = ["timestamp"]
[[inputs.cpu]]
  percpu = true
  totalcpu = true
  collect_cpu_time = false
  report_active = false
[[inputs.disk]]
  ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
# Config for legacy MQ metrics
[[inputs.tail]]
  # The file we want to tail
  files = ["/var/log/legacy-mq-metrics.log"]
  # Donツ’t reach back to the beginning (it may be a ton of data)
  from_beginning = false
  # This plugin automatically adds this tag, we donツ’t want to emit it.
  tagexclude = ["path"]
  # Method used to watch for file changes.  Can watch by ツ“inotifyツ” or ツ“pollツ”
  watch_method = "poll"
  data_format = "json"
  # This will be our Measurement Name
  json_name_key = "metricName"
  # Use the timestamp field for our metric timestamp, if omitted Telegraf will insert one automatically.
  json_time_key = "timestamp"
  json_time_format = "unix_ms"
  tag_keys = ["product",
              "productVersion",
              "connectionId",
              "clientIpAddress",
              "clientName",
              "queueManager",
              "queueTopic"]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.