telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

Cassandra plugin fails if full server name not listed in config

Open johnmalone opened this issue 9 years ago • 2 comments

Please note, the quickest way to fix a bug is to open a Pull Request.

Bug report

After upgrading a cassandra host to ubuntu 16.04 our metrics no longer showed up in wavefront. We use telegraf to scrape metrics from services, including cassandra, and the metrics were getting dropped at the wavefront proxy with the message:

root cause: "Invalid tag value for: cassandra_host"; remote: ip-172-16-132-22.eu-west-1.compute.internal]

The metric was including a blank cassandra_host tag. A snippit from a test run of our telegraf config:

` johnmalone@ip-172-16-133-140:/etc/telegraf$ sudo telegraf -test --config-directory /etc/telegraf/ | grep GarbageCollector 2017/03/29 15:40:08 I! Using config file: /etc/telegraf/telegraf.conf host url http://:8778/jolokia/read/java.lang:type=GarbageCollector,name=ConcurrentMarkSweep/CollectionTime

cassandra.javaGarbageCollector,instance_id=i-xxxxxx,mname=ConcurrentMarkSweep,service=cassandra,budget_category=processing,az=eu-west-1b,budget_region=eu-west-1,instance_type=m4.large,budget_purpose=cassandra,environment=dev,cassandra_host=,budget_environment=dev,region=eu-west-1,host=ip-x-x-x-x CollectionTime=1434 1490802008000000000`

Relevant telegraf.conf:

# Cassandra
[[inputs.cassandra]]
  name_prefix = "cassandra."
  interval = "1m0s"
  context = "/jolokia/read"
  fielddrop = ["*_RateUnit", "*_EventType", "*_LatencyUnit", "*DurationUnit"]
  servers = [":8778"]
  metrics = [   "/java.lang:type=GarbageCollector,name=ConcurrentMarkSweep/CollectionTime",
        "/java.lang:type=GarbageCollector,name=ConcurrentMarkSweep/CollectionCount",
        "/java.lang:type=GarbageCollector,name=ParNew/CollectionTime",
        "/java.lang:type=GarbageCollector,name=ParNew/CollectionCount",
        "/java.lang:type=Memory/NonHeapMemoryUsage",
        "/java.lang:type=Memory/HeapMemoryUsage",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Read,name=TotalLatency",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Write,name=TotalLatency",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Read,name=Latency",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Write,name=Latency",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Read,name=Timeouts",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Write,name=Timeouts",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Read,name=Unavailables",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Write,name=Unavailables",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Read,name=Failures",
        "/org.apache.cassandra.metrics:type=ClientRequest,scope=Write,name=Failures",
        "/org.apache.cassandra.metrics:type=CommitLog,name=TotalCommitLogSize",
        "/org.apache.cassandra.metrics:type=Compaction,name=PendingTasks",
        "/org.apache.cassandra.metrics:type=Compaction,name=BytesCompacted",
        "/org.apache.cassandra.metrics:type=Storage,name=Exceptions",
        "/org.apache.cassandra.metrics:type=Connection,name=TotalTimeouts",
        "/org.apache.cassandra.metrics:type=Storage,name=Load"
        ]

  [inputs.cassandra.tags]
    service = "cassandra"

[[inputs.cassandra]]
  name_prefix = "cassandra."
  interval = "5m0s"
  context = "/jolokia/read"
  fielddrop = ["*_RateUnit", "*_EventType", "*_LatencyUnit", "*DurationUnit"]
  servers = [":8778"]
  metrics = [
        "/org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*,scope=*,name=ReadLatency",
        "/org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*,scope=*,name=ReadTotalLatency",
        "/org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*,scope=*,name=WriteLatency",
        "/org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*,scope=*,name=WriteTotalLatency",
        ]

  [inputs.cassandra.tags]
    service = "cassandra"

[[inputs.cassandra]]
  name_prefix = "cassandra."
  interval = "60m0s"
  context = "/jolokia/read"
  fielddrop = ["*_RateUnit", "*_EventType", "*_LatencyUnit", "*DurationUnit"]
  servers = [":8778"]
  metrics = [
        "/org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*,scope=*,name=LiveDiskSpaceUsed",
        "/org.apache.cassandra.metrics:type=ColumnFamily,keyspace=*,scope=*,name=MaxRowSize",
        ]

  [inputs.cassandra.tags]
    service = "cassandra"

System info:

$ telegraf --version Telegraf v1.0.1 (git: master 26acdc9231efde105510fe5df3da7519bc4f42f7)

Ubuntu 16.04

` [Include Telegraf version, operating system name, and other relevant details]

Changing the servers line to:

servers = ["127.0.0.1:8778"]

resolved the issue.

Expected behavior:

The plugin shouldnt emit blank invalid tags as its doing here. A sensible default value for the case when no server ip is explicitly specified should resolve this.

johnmalone avatar Mar 29 '17 16:03 johnmalone

Can you please try this on the latest version of telegraf

nhaugo avatar Mar 30 '17 20:03 nhaugo

I'm going to close this issue, please reopen if it still occurs on the latest version.

danielnelson avatar Apr 11 '17 22:04 danielnelson