Created
January 17, 2016 16:55
-
-
Save tobgu/42352b0b072bd1adcd4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run cassandra with Jolokia to expose JMX metrics over HTTP | |
# Add the following to /etc/cassandra/cassandra-env.sh | |
JVM_OPTS="$JVM_OPTS -javaagent:/opt/jolokia/jolokia-jvm-agent.jar" | |
# See https://www.flexinvesting.fi/2014/jolokia-apache-cassandra/ | |
# for more information. | |
# Collect information with Telegraf according to the below config. | |
# There's also a http json plugin that should be useful for fetching | |
# information from arbitrary HTTP JSON interfaces. | |
############### Telegraf config file ####################### | |
# Tags can also be specified via a normal map, but only one form at a time: | |
[tags] | |
# dc = "us-east-1" | |
# Configuration for telegraf agent | |
[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 | |
# Default data flushing interval for all outputs. You should not set this below | |
# interval. Maximum flush_interval will be flush_interval + flush_jitter | |
flush_interval = "10s" | |
# Jitter the flush interval by a random amount. This is primarily to avoid | |
# large write spikes for users running a large number of telegraf instances. | |
# ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s | |
flush_jitter = "0s" | |
# Run telegraf in debug mode | |
debug = false | |
# Run telegraf in quiet mode | |
quiet = false | |
# Override default hostname, if empty use os.Hostname() | |
hostname = "" | |
############################################################################### | |
# OUTPUTS # | |
############################################################################### | |
# Configuration for influxdb server to send metrics to | |
[[outputs.influxdb]] | |
# The full HTTP or UDP endpoint URL for your InfluxDB instance. | |
# Multiple urls can be specified but it is assumed that they are part of the same | |
# cluster, this means that only ONE of the urls will be written to each interval. | |
# urls = ["udp://localhost:8089"] # UDP endpoint example | |
urls = ["http://localhost:8086"] # required | |
# The target database for metrics (telegraf will create it if not exists) | |
database = "telegraf" # required | |
# Precision of writes, valid values are n, u, ms, s, m, and h | |
# note: using second precision greatly helps InfluxDB compression | |
precision = "s" | |
# Connection timeout (for the connection with InfluxDB), formatted as a string. | |
# If not provided, will default to 0 (no timeout) | |
# timeout = "5s" | |
# username = "telegraf" | |
# password = "metricsmetricsmetricsmetrics" | |
# Set the user agent for HTTP POSTs (can be useful for log differentiation) | |
# user_agent = "telegraf" | |
# Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes) | |
# udp_payload = 512 | |
############################################################################### | |
# INPUTS # | |
############################################################################### | |
# Inserts sine and cosine waves for demonstration purposes | |
[[inputs.Trig]] | |
# Set the amplitude | |
amplitude = 10.0 | |
# Read metrics about cpu usage | |
[[inputs.cpu]] | |
# Whether to report per-cpu stats or not | |
percpu = true | |
# Whether to report total system cpu stats or not | |
totalcpu = true | |
# Comment this line if you want the raw CPU time metrics | |
drop = ["time_*"] | |
# Read metrics about disk usage by mount point | |
[[inputs.disk]] | |
# By default, telegraf gather stats for all mountpoints. | |
# Setting mountpoints will restrict the stats to the specified mountpoints. | |
# Mountpoints=["/"] | |
# Read metrics about disk IO by device | |
[[inputs.diskio]] | |
# By default, telegraf will gather stats for all devices including | |
# disk partitions. | |
# Setting devices will restrict the stats to the specified devcies. | |
# devices = ["sda","sdb"] | |
# Uncomment the following line if you do not need disk serial numbers. | |
# skip_serial_number = true | |
# Read InfluxDB-formatted JSON metrics from one or more HTTP endpoints | |
[[inputs.influxdb]] | |
# Works with InfluxDB debug endpoints out of the box, | |
# but other services can use this format too. | |
# See the influxdb plugin's README for more details. | |
# Multiple URLs from which to read InfluxDB-formatted JSON | |
urls = [ | |
"http://localhost:8086/debug/vars" | |
] | |
[[inputs.jolokia]] | |
# This is the context root used to compose the jolokia url | |
context = "/jolokia/read" | |
# List of servers exposing jolokia read service | |
[[inputs.jolokia.servers]] | |
name = "stable" | |
host = "localhost" | |
port = "8778" | |
# username = "myuser" | |
# password = "mypassword" | |
# List of metrics collected on above servers | |
# Each metric consists in a name, a jmx path and either a pass or drop slice attributes | |
# This collect all heap memory usage metrics | |
[[inputs.jolokia.metrics]] | |
name = "heap_memory_usage" | |
jmx = "/java.lang:type=Memory/HeapMemoryUsage" | |
# Read metrics about memory usage | |
[[inputs.mem]] | |
# no configuration | |
# Read metrics about network interface usage | |
[[inputs.net]] | |
# By default, telegraf gathers stats from any up interface (excluding loopback) | |
# Setting interfaces will tell it to gather these explicit interfaces, | |
# regardless of status. | |
# | |
# interfaces = ["eth0", ... ] | |
# Read metrics about TCP status such as established, time wait etc and UDP sockets counts. | |
[[inputs.netstat]] | |
# no configuration | |
# Ping given url(s) and return statistics | |
[[inputs.ping]] | |
# urls to ping | |
urls = ["www.google.com"] # required | |
# number of pings to send (ping -c <COUNT>) | |
count = 1 # required | |
# interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>) | |
ping_interval = 0.0 | |
# ping timeout, in s. 0 == no timeout (ping -t <TIMEOUT>) | |
timeout = 0.0 | |
# interface to send ping from (ping -I <INTERFACE>) | |
interface = "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been working on this same approach too. Have a look: https://github.com/chrusty/telegraf-cassandra
This is working quite well, but I'm still looking for a clean solution to monitor individual tables.