Change config file indentation to 2 spaces

This commit is contained in:
Cameron Sparr 2015-10-15 15:53:29 -06:00
parent 555436a222
commit 4e5ed9d3b9
34 changed files with 387 additions and 381 deletions

View File

@ -349,25 +349,21 @@ var header = `# Telegraf configuration
# Tags can also be specified via a normal map, but only one form at a time: # Tags can also be specified via a normal map, but only one form at a time:
[tags] [tags]
# dc = "us-east-1" # dc = "us-east-1"
# Configuration for telegraf agent # Configuration for telegraf agent
[agent] [agent]
# Default data collection interval for all plugins # Default data collection interval for all plugins
interval = "10s" interval = "10s"
# If utc = false, uses local time (utc is highly recommended)
# If utc = false, uses local time (utc is highly recommended) utc = true
utc = true # Precision of writes, valid values are n, u, ms, s, m, and h
# note: using second precision greatly helps InfluxDB compression
# Precision of writes, valid values are n, u, ms, s, m, and h precision = "s"
# note: using second precision greatly helps InfluxDB compression # run telegraf in debug mode
precision = "s" debug = false
# Override default hostname, if empty use os.Hostname()
# run telegraf in debug mode hostname = ""
debug = false
# Override default hostname, if empty use os.Hostname()
hostname = ""
############################################################################### ###############################################################################
@ -413,7 +409,7 @@ func PrintSampleConfig(pluginFilters []string, outputFilters []string) {
config := output.SampleConfig() config := output.SampleConfig()
if config == "" { if config == "" {
fmt.Printf("\n # no configuration\n") fmt.Printf("\n # no configuration\n")
} else { } else {
fmt.Printf(config) fmt.Printf(config)
} }
@ -455,7 +451,7 @@ func printConfig(name string, plugin plugins.Plugin) {
fmt.Printf("\n# %s\n[%s]", plugin.Description(), name) fmt.Printf("\n# %s\n[%s]", plugin.Description(), name)
config := plugin.SampleConfig() config := plugin.SampleConfig()
if config == "" { if config == "" {
fmt.Printf("\n # no configuration\n") fmt.Printf("\n # no configuration\n")
} else { } else {
fmt.Printf(config) fmt.Printf(config)
} }

View File

@ -21,25 +21,25 @@
# Tags can also be specified via a normal map, but only one form at a time: # Tags can also be specified via a normal map, but only one form at a time:
[tags] [tags]
# dc = "us-east-1" # dc = "us-east-1"
# Configuration for telegraf agent # Configuration for telegraf agent
[agent] [agent]
# Default data collection interval for all plugins # Default data collection interval for all plugins
interval = "10s" interval = "10s"
# If utc = false, uses local time (utc is highly recommended) # If utc = false, uses local time (utc is highly recommended)
utc = true utc = true
# Precision of writes, valid values are n, u, ms, s, m, and h # Precision of writes, valid values are n, u, ms, s, m, and h
# note: using second precision greatly helps InfluxDB compression # note: using second precision greatly helps InfluxDB compression
precision = "s" precision = "s"
# run telegraf in debug mode # run telegraf in debug mode
debug = false debug = false
# Override default hostname, if empty use os.Hostname() # Override default hostname, if empty use os.Hostname()
hostname = "" hostname = ""
############################################################################### ###############################################################################
@ -50,24 +50,24 @@
# Configuration for influxdb server to send metrics to # Configuration for influxdb server to send metrics to
[outputs.influxdb] [outputs.influxdb]
# The full HTTP endpoint URL for your InfluxDB instance # The full HTTP endpoint URL for your InfluxDB instance
# Multiple urls can be specified for InfluxDB cluster support. Server to # Multiple urls can be specified for InfluxDB cluster support. Server to
# write to will be randomly chosen each interval. # write to will be randomly chosen each interval.
urls = ["http://localhost:8086"] # required. urls = ["http://localhost:8086"] # required.
# The target database for metrics. This database must already exist # The target database for metrics. This database must already exist
database = "telegraf" # required. database = "telegraf" # required.
# Connection timeout (for the connection with InfluxDB), formatted as a string. # Connection timeout (for the connection with InfluxDB), formatted as a string.
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". # Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
# If not provided, will default to 0 (no timeout) # If not provided, will default to 0 (no timeout)
# timeout = "5s" # timeout = "5s"
# username = "telegraf" # username = "telegraf"
# password = "metricsmetricsmetricsmetrics" # password = "metricsmetricsmetricsmetrics"
# Set the user agent for the POSTs (can be useful for log differentiation) # Set the user agent for the POSTs (can be useful for log differentiation)
# user_agent = "telegraf" # user_agent = "telegraf"
############################################################################### ###############################################################################
@ -76,29 +76,29 @@
# Read metrics about cpu usage # Read metrics about cpu usage
[cpu] [cpu]
# Whether to report per-cpu stats or not # Whether to report per-cpu stats or not
percpu = true percpu = true
# Whether to report total system cpu stats or not # Whether to report total system cpu stats or not
totalcpu = true totalcpu = true
# Comment this line if you want the raw CPU time metrics # Comment this line if you want the raw CPU time metrics
drop = ["cpu_time"] drop = ["cpu_time"]
# Read metrics about disk usage by mount point # Read metrics about disk usage by mount point
[disk] [disk]
# no configuration # no configuration
# Read metrics about disk IO by device # Read metrics about disk IO by device
[io] [io]
# no configuration # no configuration
# Read metrics about memory usage # Read metrics about memory usage
[mem] [mem]
# no configuration # no configuration
# Read metrics about swap memory usage # Read metrics about swap memory usage
[swap] [swap]
# no configuration # no configuration
# Read metrics about system load & uptime # Read metrics about system load & uptime
[system] [system]
# no configuration # no configuration

View File

@ -24,13 +24,13 @@ type AMQP struct {
} }
var sampleConfig = ` var sampleConfig = `
# AMQP url # AMQP url
url = "amqp://localhost:5672/influxdb" url = "amqp://localhost:5672/influxdb"
# AMQP exchange # AMQP exchange
exchange = "telegraf" exchange = "telegraf"
# Telegraf tag to use as a routing key # Telegraf tag to use as a routing key
# ie, if this tag exists, it's value will be used as the routing key # ie, if this tag exists, it's value will be used as the routing key
routing_tag = "host" routing_tag = "host"
` `
func (q *AMQP) Connect() error { func (q *AMQP) Connect() error {

View File

@ -22,11 +22,11 @@ type Datadog struct {
} }
var sampleConfig = ` var sampleConfig = `
# Datadog API key # Datadog API key
apikey = "my-secret-key" # required. apikey = "my-secret-key" # required.
# Connection timeout. # Connection timeout.
# timeout = "5s" # timeout = "5s"
` `
type TimeSeries struct { type TimeSeries struct {

View File

@ -27,20 +27,20 @@ type InfluxDB struct {
} }
var sampleConfig = ` var sampleConfig = `
# The full HTTP endpoint URL for your InfluxDB instance # The full HTTP endpoint URL for your InfluxDB instance
# Multiple urls can be specified for InfluxDB cluster support. # Multiple urls can be specified for InfluxDB cluster support.
urls = ["http://localhost:8086"] # required urls = ["http://localhost:8086"] # required
# The target database for metrics (telegraf will create it if not exists) # The target database for metrics (telegraf will create it if not exists)
database = "telegraf" # required database = "telegraf" # required
# # Connection timeout (for the connection with InfluxDB), formatted as a string. # Connection timeout (for the connection with InfluxDB), formatted as a string.
# # Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". # Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
# # If not provided, will default to 0 (no timeout) # If not provided, will default to 0 (no timeout)
# timeout = "5s" # timeout = "5s"
# username = "telegraf" # username = "telegraf"
# password = "metricsmetricsmetricsmetrics" # password = "metricsmetricsmetricsmetrics"
# # Set the user agent for the POSTs (can be useful for log differentiation) # Set the user agent for the POSTs (can be useful for log differentiation)
# user_agent = "telegraf" # user_agent = "telegraf"
` `
func (i *InfluxDB) Connect() error { func (i *InfluxDB) Connect() error {

View File

@ -22,13 +22,13 @@ type Kafka struct {
} }
var sampleConfig = ` var sampleConfig = `
# URLs of kafka brokers # URLs of kafka brokers
brokers = ["localhost:9092"] brokers = ["localhost:9092"]
# Kafka topic for producer messages # Kafka topic for producer messages
topic = "telegraf" topic = "telegraf"
# Telegraf tag to use as a routing key # Telegraf tag to use as a routing key
# ie, if this tag exists, it's value will be used as the routing key # ie, if this tag exists, it's value will be used as the routing key
routing_tag = "host" routing_tag = "host"
` `
func (k *Kafka) Connect() error { func (k *Kafka) Connect() error {

View File

@ -33,16 +33,16 @@ type MQTT struct {
} }
var sampleConfig = ` var sampleConfig = `
servers = ["localhost:1883"] # required. servers = ["localhost:1883"] # required.
# MQTT outputs send metrics to this topic format # MQTT outputs send metrics to this topic format
# "<topic_prefix>/host/<hostname>/<pluginname>/" # "<topic_prefix>/host/<hostname>/<pluginname>/"
# ex: prefix/host/web01.example.com/mem/available # ex: prefix/host/web01.example.com/mem/available
# topic_prefix = "prefix" # topic_prefix = "prefix"
# username and password to connect MQTT server. # username and password to connect MQTT server.
# username = "telegraf" # username = "telegraf"
# password = "metricsmetricsmetricsmetrics" # password = "metricsmetricsmetricsmetrics"
` `
func (m *MQTT) Connect() error { func (m *MQTT) Connect() error {

View File

@ -22,18 +22,18 @@ type OpenTSDB struct {
} }
var sampleConfig = ` var sampleConfig = `
# prefix for metrics keys # prefix for metrics keys
prefix = "my.specific.prefix." prefix = "my.specific.prefix."
## Telnet Mode ## ## Telnet Mode ##
# DNS name of the OpenTSDB server in telnet mode # DNS name of the OpenTSDB server in telnet mode
host = "opentsdb.example.com" host = "opentsdb.example.com"
# Port of the OpenTSDB server in telnet mode # Port of the OpenTSDB server in telnet mode
port = 4242 port = 4242
# Debug true - Prints OpenTSDB communication # Debug true - Prints OpenTSDB communication
debug = false debug = false
` `
type MetricLine struct { type MetricLine struct {

View File

@ -19,8 +19,8 @@ type Apache struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of Apache status URI to gather stats. # An array of Apache status URI to gather stats.
urls = ["http://localhost/server-status?auto"] urls = ["http://localhost/server-status?auto"]
` `
func (n *Apache) SampleConfig() string { func (n *Apache) SampleConfig() string {
@ -73,24 +73,24 @@ func (n *Apache) gatherUrl(addr *url.URL, acc plugins.Accumulator) error {
sc := bufio.NewScanner(resp.Body) sc := bufio.NewScanner(resp.Body)
for sc.Scan() { for sc.Scan() {
line := sc.Text() line := sc.Text()
if strings.Contains(line, ":") { if strings.Contains(line, ":") {
parts := strings.SplitN(line, ":", 2) parts := strings.SplitN(line, ":", 2)
key, part := strings.Replace(parts[0], " ", "", -1), strings.TrimSpace(parts[1]) key, part := strings.Replace(parts[0], " ", "", -1), strings.TrimSpace(parts[1])
switch key { switch key {
case "Scoreboard": case "Scoreboard":
n.gatherScores(part, acc, tags) n.gatherScores(part, acc, tags)
default: default:
value, err := strconv.ParseFloat(part, 32) value, err := strconv.ParseFloat(part, 32)
if err != nil { if err != nil {
continue continue
} }
acc.Add(key, value, tags) acc.Add(key, value, tags)
} }
} }
} }
return nil return nil
@ -98,52 +98,63 @@ func (n *Apache) gatherUrl(addr *url.URL, acc plugins.Accumulator) error {
func (n *Apache) gatherScores(data string, acc plugins.Accumulator, tags map[string]string) { func (n *Apache) gatherScores(data string, acc plugins.Accumulator, tags map[string]string) {
var waiting, open int = 0, 0 var waiting, open int = 0, 0
var S, R, W, K, D, C, L, G, I int = 0, 0, 0, 0, 0, 0, 0, 0, 0 var S, R, W, K, D, C, L, G, I int = 0, 0, 0, 0, 0, 0, 0, 0, 0
for _, s := range strings.Split(data, "") { for _, s := range strings.Split(data, "") {
switch s { switch s {
case "_": waiting++ case "_":
case "S": S++ waiting++
case "R": R++ case "S":
case "W": W++ S++
case "K": K++ case "R":
case "D": D++ R++
case "C": C++ case "W":
case "L": L++ W++
case "G": G++ case "K":
case "I": I++ K++
case ".": open++ case "D":
} D++
} case "C":
C++
case "L":
L++
case "G":
G++
case "I":
I++
case ".":
open++
}
}
acc.Add("scboard_waiting", float64(waiting), tags); acc.Add("scboard_waiting", float64(waiting), tags)
acc.Add("scboard_starting", float64(S), tags); acc.Add("scboard_starting", float64(S), tags)
acc.Add("scboard_reading", float64(R), tags); acc.Add("scboard_reading", float64(R), tags)
acc.Add("scboard_sending", float64(W), tags); acc.Add("scboard_sending", float64(W), tags)
acc.Add("scboard_keepalive", float64(K), tags); acc.Add("scboard_keepalive", float64(K), tags)
acc.Add("scboard_dnslookup", float64(D), tags); acc.Add("scboard_dnslookup", float64(D), tags)
acc.Add("scboard_closing", float64(C), tags); acc.Add("scboard_closing", float64(C), tags)
acc.Add("scboard_logging", float64(L), tags); acc.Add("scboard_logging", float64(L), tags)
acc.Add("scboard_finishing", float64(G), tags); acc.Add("scboard_finishing", float64(G), tags)
acc.Add("scboard_idle_cleanup", float64(I), tags); acc.Add("scboard_idle_cleanup", float64(I), tags)
acc.Add("scboard_open", float64(open), tags); acc.Add("scboard_open", float64(open), tags)
} }
// Get tag(s) for the apache plugin // Get tag(s) for the apache plugin
func getTags(addr *url.URL) map[string]string { func getTags(addr *url.URL) map[string]string {
h := addr.Host h := addr.Host
host, port, err := net.SplitHostPort(h) host, port, err := net.SplitHostPort(h)
if err != nil { if err != nil {
host = addr.Host host = addr.Host
if addr.Scheme == "http" { if addr.Scheme == "http" {
port = "80" port = "80"
} else if addr.Scheme == "https" { } else if addr.Scheme == "https" {
port = "443" port = "443"
} else { } else {
port = "" port = ""
} }
} }
return map[string]string{"server": host, "port": port} return map[string]string{"server": host, "port": port}
} }

View File

@ -21,12 +21,12 @@ type Disque struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of URI to gather stats about. Specify an ip or hostname # An array of URI to gather stats about. Specify an ip or hostname
# with optional port and password. ie disque://localhost, disque://10.10.3.33:18832, # with optional port and password. ie disque://localhost, disque://10.10.3.33:18832,
# 10.0.0.1:10000, etc. # 10.0.0.1:10000, etc.
# #
# If no servers are specified, then localhost is used as the host. # If no servers are specified, then localhost is used as the host.
servers = ["localhost"] servers = ["localhost"]
` `
func (r *Disque) SampleConfig() string { func (r *Disque) SampleConfig() string {

View File

@ -28,12 +28,12 @@ type node struct {
} }
const sampleConfig = ` const sampleConfig = `
# specify a list of one or more Elasticsearch servers # specify a list of one or more Elasticsearch servers
servers = ["http://localhost:9200"] servers = ["http://localhost:9200"]
# set local to false when you want to read the indices stats from all nodes # set local to false when you want to read the indices stats from all nodes
# within the cluster # within the cluster
local = true local = true
` `
// Elasticsearch is a plugin to read stats from one or many Elasticsearch // Elasticsearch is a plugin to read stats from one or many Elasticsearch

View File

@ -13,17 +13,17 @@ import (
) )
const sampleConfig = ` const sampleConfig = `
# specify commands via an array of tables # specify commands via an array of tables
[[exec.commands]] [[exec.commands]]
# the command to run # the command to run
command = "/usr/bin/mycollector --foo=bar" command = "/usr/bin/mycollector --foo=bar"
# name of the command (used as a prefix for measurements) # name of the command (used as a prefix for measurements)
name = "mycollector" name = "mycollector"
# Only run this command if it has been at least this many # Only run this command if it has been at least this many
# seconds since it last ran # seconds since it last ran
interval = 10 interval = 10
` `
type Exec struct { type Exec struct {

View File

@ -84,13 +84,13 @@ type haproxy struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of address to gather stats about. Specify an ip on hostname # An array of address to gather stats about. Specify an ip on hostname
# with optional port. ie localhost, 10.10.3.33:1936, etc. # with optional port. ie localhost, 10.10.3.33:1936, etc.
# #
# If no servers are specified, then default to 127.0.0.1:1936 # If no servers are specified, then default to 127.0.0.1:1936
servers = ["http://myhaproxy.com:1936", "http://anotherhaproxy.com:1936"] servers = ["http://myhaproxy.com:1936", "http://anotherhaproxy.com:1936"]
# Or you can also use local socket(not work yet) # Or you can also use local socket(not work yet)
# servers = ["socket:/run/haproxy/admin.sock"] # servers = ["socket:/run/haproxy/admin.sock"]
` `
func (r *haproxy) SampleConfig() string { func (r *haproxy) SampleConfig() string {

View File

@ -46,25 +46,25 @@ func (c RealHTTPClient) MakeRequest(req *http.Request) (*http.Response, error) {
} }
var sampleConfig = ` var sampleConfig = `
# Specify services via an array of tables # Specify services via an array of tables
[[httpjson.services]] [[httpjson.services]]
# a name for the service being polled # a name for the service being polled
name = "webserver_stats" name = "webserver_stats"
# URL of each server in the service's cluster # URL of each server in the service's cluster
servers = [ servers = [
"http://localhost:9999/stats/", "http://localhost:9999/stats/",
"http://localhost:9998/stats/", "http://localhost:9998/stats/",
] ]
# HTTP method to use (case-sensitive) # HTTP method to use (case-sensitive)
method = "GET" method = "GET"
# HTTP parameters (all values must be strings) # HTTP parameters (all values must be strings)
[httpjson.services.parameters] [httpjson.services.parameters]
event_type = "cpu_spike" event_type = "cpu_spike"
threshold = "0.75" threshold = "0.75"
` `
func (h *HttpJson) SampleConfig() string { func (h *HttpJson) SampleConfig() string {

View File

@ -20,17 +20,17 @@ type Kafka struct {
} }
var sampleConfig = ` var sampleConfig = `
# topic to consume # topic to consume
topic = "topic_with_metrics" topic = "topic_with_metrics"
# the name of the consumer group # the name of the consumer group
consumerGroupName = "telegraf_metrics_consumers" consumerGroupName = "telegraf_metrics_consumers"
# an array of Zookeeper connection strings # an array of Zookeeper connection strings
zookeeperPeers = ["localhost:2181"] zookeeperPeers = ["localhost:2181"]
# Batch size of points sent to InfluxDB # Batch size of points sent to InfluxDB
batchSize = 1000 batchSize = 1000
` `
func (k *Kafka) SampleConfig() string { func (k *Kafka) SampleConfig() string {

View File

@ -131,11 +131,11 @@ var serverTypeMapping = map[string]ServerType{
} }
var sampleConfig = ` var sampleConfig = `
# An array of URI to gather stats about LeoFS. # An array of URI to gather stats about LeoFS.
# Specify an ip or hostname with port. ie 127.0.0.1:4020 # Specify an ip or hostname with port. ie 127.0.0.1:4020
# #
# If no servers are specified, then 127.0.0.1 is used as the host and 4020 as the port. # If no servers are specified, then 127.0.0.1 is used as the host and 4020 as the port.
servers = ["127.0.0.1:4021"] servers = ["127.0.0.1:4021"]
` `
func (l *LeoFS) SampleConfig() string { func (l *LeoFS) SampleConfig() string {

View File

@ -25,11 +25,11 @@ type Lustre2 struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of /proc globs to search for Lustre stats # An array of /proc globs to search for Lustre stats
# If not specified, the default will work on Lustre 2.5.x # If not specified, the default will work on Lustre 2.5.x
# #
# ost_procfiles = ["/proc/fs/lustre/obdfilter/*/stats", "/proc/fs/lustre/osd-ldiskfs/*/stats"] # ost_procfiles = ["/proc/fs/lustre/obdfilter/*/stats", "/proc/fs/lustre/osd-ldiskfs/*/stats"]
# mds_procfiles = ["/proc/fs/lustre/mdt/*/md_stats"] # mds_procfiles = ["/proc/fs/lustre/mdt/*/md_stats"]
` `
/* The wanted fields would be a []string if not for the /* The wanted fields would be a []string if not for the

View File

@ -17,11 +17,11 @@ type Memcached struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of address to gather stats about. Specify an ip on hostname # An array of address to gather stats about. Specify an ip on hostname
# with optional port. ie localhost, 10.0.0.1:11211, etc. # with optional port. ie localhost, 10.0.0.1:11211, etc.
# #
# If no servers are specified, then localhost is used as the host. # If no servers are specified, then localhost is used as the host.
servers = ["localhost"] servers = ["localhost"]
` `
var defaultTimeout = 5 * time.Second var defaultTimeout = 5 * time.Second

View File

@ -25,12 +25,12 @@ type Ssl struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of URI to gather stats about. Specify an ip or hostname # An array of URI to gather stats about. Specify an ip or hostname
# with optional port add password. ie mongodb://user:auth_key@10.10.3.30:27017, # with optional port add password. ie mongodb://user:auth_key@10.10.3.30:27017,
# mongodb://10.10.3.33:18832, 10.0.0.1:10000, etc. # mongodb://10.10.3.33:18832, 10.0.0.1:10000, etc.
# #
# If no servers are specified, then 127.0.0.1 is used as the host and 27107 as the port. # If no servers are specified, then 127.0.0.1 is used as the host and 27107 as the port.
servers = ["127.0.0.1:27017"] servers = ["127.0.0.1:27017"]
` `
func (m *MongoDB) SampleConfig() string { func (m *MongoDB) SampleConfig() string {

View File

@ -14,14 +14,14 @@ type Mysql struct {
} }
var sampleConfig = ` var sampleConfig = `
# specify servers via a url matching: # specify servers via a url matching:
# [username[:password]@][protocol[(address)]]/[?tls=[true|false|skip-verify]] # [username[:password]@][protocol[(address)]]/[?tls=[true|false|skip-verify]]
# e.g. # e.g.
# root:root@http://10.0.0.18/?tls=false # root:root@http://10.0.0.18/?tls=false
# root:passwd@tcp(127.0.0.1:3036)/ # root:passwd@tcp(127.0.0.1:3036)/
# #
# If no servers are specified, then localhost is used as the host. # If no servers are specified, then localhost is used as the host.
servers = ["localhost"] servers = ["localhost"]
` `
func (m *Mysql) SampleConfig() string { func (m *Mysql) SampleConfig() string {

View File

@ -19,8 +19,8 @@ type Nginx struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of Nginx stub_status URI to gather stats. # An array of Nginx stub_status URI to gather stats.
urls = ["http://localhost/status"] urls = ["http://localhost/status"]
` `
func (n *Nginx) SampleConfig() string { func (n *Nginx) SampleConfig() string {
@ -141,22 +141,21 @@ func (n *Nginx) gatherUrl(addr *url.URL, acc plugins.Accumulator) error {
// Get tag(s) for the nginx plugin // Get tag(s) for the nginx plugin
func getTags(addr *url.URL) map[string]string { func getTags(addr *url.URL) map[string]string {
h := addr.Host h := addr.Host
host, port, err := net.SplitHostPort(h) host, port, err := net.SplitHostPort(h)
if err != nil { if err != nil {
host = addr.Host host = addr.Host
if addr.Scheme == "http" { if addr.Scheme == "http" {
port = "80" port = "80"
} else if addr.Scheme == "https" { } else if addr.Scheme == "https" {
port = "443" port = "443"
} else { } else {
port = "" port = ""
} }
} }
return map[string]string{"server": host, "port": port} return map[string]string{"server": host, "port": port}
} }
func init() { func init() {
plugins.Add("nginx", func() plugins.Plugin { plugins.Add("nginx", func() plugins.Plugin {
return &Nginx{} return &Nginx{}

View File

@ -39,19 +39,19 @@ type phpfpm struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of addresses to gather stats about. Specify an ip or hostname # An array of addresses to gather stats about. Specify an ip or hostname
# with optional port and path. # with optional port and path.
# #
# Plugin can be configured in two modes (both can be used): # Plugin can be configured in two modes (both can be used):
# - http: the URL must start with http:// or https://, ex: # - http: the URL must start with http:// or https://, ex:
# "http://localhost/status" # "http://localhost/status"
# "http://192.168.130.1/status?full" # "http://192.168.130.1/status?full"
# - unixsocket: path to fpm socket, ex: # - unixsocket: path to fpm socket, ex:
# "/var/run/php5-fpm.sock" # "/var/run/php5-fpm.sock"
# "192.168.10.10:/var/run/php5-fpm-www2.sock" # "192.168.10.10:/var/run/php5-fpm-www2.sock"
# #
# If no servers are specified, then default to 127.0.0.1/server-status # If no servers are specified, then default to 127.0.0.1/server-status
urls = ["http://localhost/status"] urls = ["http://localhost/status"]
` `
func (r *phpfpm) SampleConfig() string { func (r *phpfpm) SampleConfig() string {

View File

@ -40,16 +40,16 @@ func (_ *Ping) Description() string {
} }
var sampleConfig = ` var sampleConfig = `
# urls to ping # urls to ping
urls = ["www.google.com"] # required urls = ["www.google.com"] # required
# number of pings to send (ping -c <COUNT>) # number of pings to send (ping -c <COUNT>)
count = 1 # required count = 1 # required
# interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>) # interval, in s, at which to ping. 0 == default (ping -i <PING_INTERVAL>)
ping_interval = 0.0 ping_interval = 0.0
# ping timeout, in s. 0 == no timeout (ping -t <TIMEOUT>) # ping timeout, in s. 0 == no timeout (ping -t <TIMEOUT>)
timeout = 0.0 timeout = 0.0
# interface to send ping from (ping -I <INTERFACE>) # interface to send ping from (ping -I <INTERFACE>)
interface = "" interface = ""
` `
func (_ *Ping) SampleConfig() string { func (_ *Ping) SampleConfig() string {

View File

@ -24,33 +24,33 @@ type Postgresql struct {
var ignoredColumns = map[string]bool{"datid": true, "datname": true, "stats_reset": true} var ignoredColumns = map[string]bool{"datid": true, "datname": true, "stats_reset": true}
var sampleConfig = ` var sampleConfig = `
# specify servers via an array of tables # specify servers via an array of tables
[[postgresql.servers]] [[postgresql.servers]]
# specify address via a url matching: # specify address via a url matching:
# postgres://[pqgotest[:password]]@localhost[/dbname]?sslmode=[disable|verify-ca|verify-full] # postgres://[pqgotest[:password]]@localhost[/dbname]?sslmode=[disable|verify-ca|verify-full]
# or a simple string: # or a simple string:
# host=localhost user=pqotest password=... sslmode=... dbname=app_production # host=localhost user=pqotest password=... sslmode=... dbname=app_production
# #
# All connection parameters are optional. By default, the host is localhost # All connection parameters are optional. By default, the host is localhost
# and the user is the currently running user. For localhost, we default # and the user is the currently running user. For localhost, we default
# to sslmode=disable as well. # to sslmode=disable as well.
# #
# Without the dbname parameter, the driver will default to a database # Without the dbname parameter, the driver will default to a database
# with the same name as the user. This dbname is just for instantiating a # with the same name as the user. This dbname is just for instantiating a
# connection with the server and doesn't restrict the databases we are trying # connection with the server and doesn't restrict the databases we are trying
# to grab metrics for. # to grab metrics for.
# #
address = "sslmode=disable" address = "sslmode=disable"
# A list of databases to pull metrics about. If not specified, metrics for all # A list of databases to pull metrics about. If not specified, metrics for all
# databases are gathered. # databases are gathered.
# databases = ["app_production", "blah_testing"] # databases = ["app_production", "blah_testing"]
# [[postgresql.servers]] # [[postgresql.servers]]
# address = "influx@remoteserver" # address = "influx@remoteserver"
` `
func (p *Postgresql) SampleConfig() string { func (p *Postgresql) SampleConfig() string {

View File

@ -29,12 +29,12 @@ func NewProcstat() *Procstat {
} }
var sampleConfig = ` var sampleConfig = `
[[procstat.specifications]] [[procstat.specifications]]
prefix = "" # optional string to prefix measurements prefix = "" # optional string to prefix measurements
# Use one of pid_file or exe to find process # Use one of pid_file or exe to find process
pid_file = "/var/run/nginx.pid" pid_file = "/var/run/nginx.pid"
# executable name (used by pgrep) # executable name (used by pgrep)
# exe = "nginx" # exe = "nginx"
` `
func (_ *Procstat) SampleConfig() string { func (_ *Procstat) SampleConfig() string {

View File

@ -17,8 +17,8 @@ type Prometheus struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of urls to scrape metrics from. # An array of urls to scrape metrics from.
urls = ["http://localhost:9100/metrics"] urls = ["http://localhost:9100/metrics"]
` `
func (r *Prometheus) SampleConfig() string { func (r *Prometheus) SampleConfig() string {

View File

@ -69,16 +69,16 @@ type Node struct {
} }
var sampleConfig = ` var sampleConfig = `
# Specify servers via an array of tables # Specify servers via an array of tables
[[rabbitmq.servers]] [[rabbitmq.servers]]
# name = "rmq-server-1" # optional tag # name = "rmq-server-1" # optional tag
# url = "http://localhost:15672" # url = "http://localhost:15672"
# username = "guest" # username = "guest"
# password = "guest" # password = "guest"
# A list of nodes to pull metrics about. If not specified, metrics for # A list of nodes to pull metrics about. If not specified, metrics for
# all nodes are gathered. # all nodes are gathered.
# nodes = ["rabbit@node1", "rabbit@node2"] # nodes = ["rabbit@node1", "rabbit@node2"]
` `
func (r *RabbitMQ) SampleConfig() string { func (r *RabbitMQ) SampleConfig() string {

View File

@ -18,15 +18,15 @@ type Redis struct {
} }
var sampleConfig = ` var sampleConfig = `
# specify servers via a url matching: # specify servers via a url matching:
# [protocol://][:password]@address[:port] # [protocol://][:password]@address[:port]
# e.g. # e.g.
# tcp://localhost:6379 # tcp://localhost:6379
# tcp://:password@192.168.99.100 # tcp://:password@192.168.99.100
# #
# If no servers are specified, then localhost is used as the host. # If no servers are specified, then localhost is used as the host.
# If no port is specified, 6379 is used # If no port is specified, 6379 is used
servers = ["tcp://localhost:6379"] servers = ["tcp://localhost:6379"]
` `
func (r *Redis) SampleConfig() string { func (r *Redis) SampleConfig() string {

View File

@ -15,12 +15,12 @@ type RethinkDB struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of URI to gather stats about. Specify an ip or hostname # An array of URI to gather stats about. Specify an ip or hostname
# with optional port add password. ie rethinkdb://user:auth_key@10.10.3.30:28105, # with optional port add password. ie rethinkdb://user:auth_key@10.10.3.30:28105,
# rethinkdb://10.10.3.33:18832, 10.0.0.1:10000, etc. # rethinkdb://10.10.3.33:18832, 10.0.0.1:10000, etc.
# #
# If no servers are specified, then 127.0.0.1 is used as the host and 28015 as the port. # If no servers are specified, then 127.0.0.1 is used as the host and 28015 as the port.
servers = ["127.0.0.1:28015"] servers = ["127.0.0.1:28015"]
` `
func (r *RethinkDB) SampleConfig() string { func (r *RethinkDB) SampleConfig() string {

View File

@ -104,35 +104,35 @@ type cachedtimings struct {
} }
func (_ *Statsd) Description() string { func (_ *Statsd) Description() string {
return "Statsd listener" return "Statsd Server"
} }
const sampleConfig = ` const sampleConfig = `
# Address and port to host UDP listener on # Address and port to host UDP listener on
service_address = ":8125" service_address = ":8125"
# Delete gauges every interval (default=false) # Delete gauges every interval (default=false)
delete_gauges = false delete_gauges = false
# Delete counters every interval (default=false) # Delete counters every interval (default=false)
delete_counters = false delete_counters = false
# Delete sets every interval (default=false) # Delete sets every interval (default=false)
delete_sets = false delete_sets = false
# Delete timings & histograms every interval (default=true) # Delete timings & histograms every interval (default=true)
delete_timings = true delete_timings = true
# Percentiles to calculate for timing & histogram stats # Percentiles to calculate for timing & histogram stats
percentiles = [90] percentiles = [90]
# templates = [ # templates = [
# "cpu.* measurement*" # "cpu.* measurement*"
# ] # ]
# Number of UDP messages allowed to queue up, once filled, # Number of UDP messages allowed to queue up, once filled,
# the statsd server will start dropping packets # the statsd server will start dropping packets
allowed_pending_messages = 10000 allowed_pending_messages = 10000
# Number of timing/histogram values to track per-measurement in the # Number of timing/histogram values to track per-measurement in the
# calculation of percentiles. Raising this limit increases the accuracy # calculation of percentiles. Raising this limit increases the accuracy
# of percentiles but also increases the memory usage and cpu time. # of percentiles but also increases the memory usage and cpu time.
percentile_limit = 1000 percentile_limit = 1000
` `
func (_ *Statsd) SampleConfig() string { func (_ *Statsd) SampleConfig() string {

View File

@ -26,12 +26,12 @@ func (_ *CPUStats) Description() string {
} }
var sampleConfig = ` var sampleConfig = `
# Whether to report per-cpu stats or not # Whether to report per-cpu stats or not
percpu = true percpu = true
# Whether to report total system cpu stats or not # Whether to report total system cpu stats or not
totalcpu = true totalcpu = true
# Comment this line if you want the raw CPU time metrics # Comment this line if you want the raw CPU time metrics
drop = ["cpu_time"] drop = ["cpu_time"]
` `
func (_ *CPUStats) SampleConfig() string { func (_ *CPUStats) SampleConfig() string {

View File

@ -17,10 +17,10 @@ func (_ *DiskStats) Description() string {
} }
var diskSampleConfig = ` var diskSampleConfig = `
# By default, telegraf gather stats for all mountpoints. # By default, telegraf gather stats for all mountpoints.
# Setting mountpoints will restrict the stats to the specified ones. # Setting mountpoints will restrict the stats to the specified ones.
# mountpoints. # mountpoints.
# Mountpoints=["/"] # Mountpoints=["/"]
` `
func (_ *DiskStats) SampleConfig() string { func (_ *DiskStats) SampleConfig() string {

View File

@ -19,11 +19,11 @@ func (_ *NetIOStats) Description() string {
} }
var netSampleConfig = ` var netSampleConfig = `
# By default, telegraf gathers stats from any up interface (excluding loopback) # By default, telegraf gathers stats from any up interface (excluding loopback)
# Setting interfaces will tell it to gather these explicit interfaces, # Setting interfaces will tell it to gather these explicit interfaces,
# regardless of status. # regardless of status.
# #
# interfaces = ["eth0", ... ] # interfaces = ["eth0", ... ]
` `
func (_ *NetIOStats) SampleConfig() string { func (_ *NetIOStats) SampleConfig() string {

View File

@ -19,12 +19,12 @@ type Zookeeper struct {
} }
var sampleConfig = ` var sampleConfig = `
# An array of address to gather stats about. Specify an ip or hostname # An array of address to gather stats about. Specify an ip or hostname
# with port. ie localhost:2181, 10.0.0.1:2181, etc. # with port. ie localhost:2181, 10.0.0.1:2181, etc.
# If no servers are specified, then localhost is used as the host. # If no servers are specified, then localhost is used as the host.
# If no port is specified, 2181 is used # If no port is specified, 2181 is used
servers = [":2181"] servers = [":2181"]
` `
var defaultTimeout = time.Second * time.Duration(5) var defaultTimeout = time.Second * time.Duration(5)