Skip to content

Commit

Permalink
Use Prmetheus naming standards
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamad Arab committed Aug 30, 2018
1 parent 80c6abc commit d8fad1b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Squid Prometheus exporter

Exports squid metrics in Prometheus format

**NOTE**: From release 1.0 metric names and some parameters has changed. Make sure you check the docs and update your deployments accordingly!

Usage:
------
Simple usage:
Expand Down
64 changes: 33 additions & 31 deletions collector/counters.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,41 @@ import (
type squidCounter struct {
Section string
Counter string
Suffix string
Description string
}

var squidCounters = []squidCounter{
{"client_http", "requests", "The total number of client requests"},
{"client_http", "hits", "The total number of client cache hits"},
{"client_http", "errors", "The total number of client http errors"},
{"client_http", "kbytes_in", "The total number of client kbytes recevied"},
{"client_http", "kbytes_out", "The total number of client kbytes transferred"},
{"client_http", "hit_kbytes_out", "The total number of client kbytes cache hit"},

{"server.http", "requests", "The total number of server http requests"},
{"server.http", "errors", "The total number of server http errors"},
{"server.http", "kbytes_in", "The total number of server http kbytes recevied"},
{"server.http", "kbytes_out", "The total number of server http kbytes transferred"},

{"server.all", "requests", "The total number of server all requests"},
{"server.all", "errors", "The total number of server all errors"},
{"server.all", "kbytes_in", "The total number of server kbytes recevied"},
{"server.all", "kbytes_out", "The total number of server kbytes transferred"},

{"server.ftp", "requests", "The total number of server ftp requests"},
{"server.ftp", "errors", "The total number of server ftp errors"},
{"server.ftp", "kbytes_in", "The total number of server ftp kbytes recevied"},
{"server.ftp", "kbytes_out", "The total number of server ftp kbytes transferred"},

{"server.other", "requests", "The total number of server other requests"},
{"server.other", "errors", "The total number of server other errors"},
{"server.other", "kbytes_in", "The total number of server other kbytes recevied"},
{"server.other", "kbytes_out", "The total number of server other kbytes transferred"},

{"swap", "ins", "The total number of server other requests"},
{"swap", "outs", "The total number of server other errors"},
{"swap", "files_cleaned", "The total number of server other kbytes recevied"},
{"client_http", "requests", "total", "The total number of client requests"},
{"client_http", "hits", "total", "The total number of client cache hits"},
{"client_http", "errors", "total", "The total number of client http errors"},
{"client_http", "kbytes_in", "kbytes_total", "The total number of client kbytes recevied"},
{"client_http", "kbytes_out", "kbytes_total", "The total number of client kbytes transferred"},
{"client_http", "hit_kbytes_out", "bytes_total", "The total number of client kbytes cache hit"},

{"server.http", "requests", "total", "The total number of server http requests"},
{"server.http", "errors", "total", "The total number of server http errors"},
{"server.http", "kbytes_in", "kbytes_total", "The total number of server http kbytes recevied"},
{"server.http", "kbytes_out", "kbytes_total", "The total number of server http kbytes transferred"},

{"server.all", "requests", "total", "The total number of server all requests"},
{"server.all", "errors", "total", "The total number of server all errors"},
{"server.all", "kbytes_in", "kbytes_total", "The total number of server kbytes recevied"},
{"server.all", "kbytes_out", "kbytes_total", "The total number of server kbytes transferred"},

{"server.ftp", "requests", "total", "The total number of server ftp requests"},
{"server.ftp", "errors", "total", "The total number of server ftp errors"},
{"server.ftp", "kbytes_in", "kbytes_total", "The total number of server ftp kbytes recevied"},
{"server.ftp", "kbytes_out", "kbytes_total", "The total number of server ftp kbytes transferred"},

{"server.other", "requests", "total", "The total number of server other requests"},
{"server.other", "errors", "total", "The total number of server other errors"},
{"server.other", "kbytes_in", "kbytes_totla", "The total number of server other kbytes recevied"},
{"server.other", "kbytes_out", "kbytes_total", "The total number of server other kbytes transferred"},

{"swap", "ins", "total", "The total number of server other requests"},
{"swap", "outs", "total", "The total number of server other errors"},
{"swap", "files_cleaned", "total", "The total number of server other kbytes recevied"},
}

func generateSquidCounters() descMap {
Expand All @@ -53,7 +54,8 @@ func generateSquidCounters() descMap {
counter := squidCounters[i]

counters[fmt.Sprintf("%s.%s", counter.Section, counter.Counter)] = prometheus.NewDesc(
prometheus.BuildFQName(namespace, strings.Replace(counter.Section, ".", "_", -1), counter.Counter),
prometheus.BuildFQName(namespace, strings.Replace(counter.Section, ".", "_", -1),
fmt.Sprintf("%s_%s", counter.Counter, counter.Suffix)),
counter.Description,
[]string{}, nil,
)
Expand Down

0 comments on commit d8fad1b

Please sign in to comment.