grafana / metrictank

metrics2.0 based, multi-tenant timeseries store for Graphite and friends.
GNU Affero General Public License v3.0
622 stars 104 forks source link

mt-index-cat help mangled up #1036

Closed Dieterbe closed 4 years ago

Dieterbe commented 6 years ago
kubemt exec $pod -- mt-index-cat -h
mt-index-cat

Retrieves a metrictank index and dumps it in the requested format
In particular, the vegeta outputs are handy to pipe requests for given series into the vegeta http benchmark tool

Usage:

  mt-index-cat [global config flags] <idxtype> [idx config flags] output 

global config flags:

tags filter:
     ''        no filtering based on tags
     'none'    only show metrics that have no tags
     'some'    only show metrics that have one or more tags
     'valid'   only show metrics whose tags (if any) are valid
     'invalid' only show metrics that have one or more invalid tags

idxtype: only 'cass' supported for now

cass config flags:

output: either presets like dump|list|vegeta-render|vegeta-render-patterns
output: or custom templates like '{{.Id}} {{.OrgId}} {{.Name}} {{.Metric}} {{.Interval}} {{.Unit}} {{.Mtype}} {{.Tags}} {{.LastUpdate}} {{.Partition}}'

You may also use processing functions in templates:
pattern: transforms a graphite.style.metric.name into a pattern with wildcards inserted
age: subtracts the passed integer (typically .LastUpdate) from the query time
roundDuration: formats an integer-seconds duration using aggressive rounding. for the purpose of getting an idea of overal metrics age
EXAMPLES:
mt-index-cat -from 60min cass -hosts cassandra:9042 list
mt-index-cat -from 60min cass -hosts cassandra:9042 'sumSeries({{.Name | pattern}})'
mt-index-cat -from 60min cass -hosts cassandra:9042 'GET http://localhost:6060/render?target=sumSeries({{.Name | pattern}})&from=-6h\nX-Org-Id: 1\n\n'
mt-index-cat cass -hosts cassandra:9042 -timeout 60s '{{.LastUpdate | age | roundDuration}}\n' | sort | uniq -c
  -addr string
        graphite/metrictank address (default "http://localhost:6060")
  -from string
        for vegeta outputs, will generate requests for data starting from now minus... eg '30min', '5h', '14d', etc. or a unix timestamp (default "30min")
  -limit int
        only show this many metrics.  use 0 to disable
  -max-age string
        max age (last update diff with now) of metricdefs.  use 0 to disable (default "6h30min")
  -prefix string
        only show metrics that have this prefix
  -substr string
        only show metrics that have this substring
  -suffix string
        only show metrics that have this suffix
  -tags string
        tag filter. empty (default), 'some', 'none', 'valid', or 'invalid'
  -verbose
        print stats to stderr
  -auth
        enable cassandra user authentication
  -ca-path string
        cassandra CA certficate path when using SSL (default "/etc/metrictank/ca.pem")
  -consistency string
        write consistency (any|one|two|three|quorum|all|local_quorum|each_quorum|local_one (default "one")
  -create-keyspace
        enable the creation of the index keyspace and tables, only one node needs this (default true)
  -disable-initial-host-lookup
        instruct the driver to not attempt to get host info from the system.peers table
  -enabled
         (default true)
  -host-verification
        host (hostname and server cert) verification when using SSL (default true)
  -hosts string
        comma separated list of cassandra addresses in host:port form (default "localhost:9042")
  -keyspace string
        Cassandra keyspace to store metricDefinitions in. (default "metrictank")
  -max-stale duration
        clear series from the index if they have not been seen for this much time.
  -num-conns int
        number of concurrent connections to cassandra (default 10)
  -password string
        password for authentication (default "cassandra")
  -protocol-version int
        cql protocol version to use (default 4)
  -prune-interval duration
        Interval at which the index should be checked for stale series. (default 3h0m0s)
  -schema-file string
        File containing the needed schemas in case database needs initializing (default "/etc/metrictank/schema-idx-cassandra.toml")
  -ssl
        enable SSL connection to cassandra
  -timeout duration
        cassandra request timeout (default 1s)
  -update-cassandra-index
        synchronize index changes to cassandra. not all your nodes need to do this. (default true)
  -update-interval duration
        frequency at which we should update the metricDef lastUpdate field, use 0s for instant updates (default 3h0m0s)
  -username string
        username for authentication (default "cassandra")
  -write-queue-size int
        Max number of metricDefs allowed to be unwritten to cassandra (default 100000)

global flags and cass config flags are not printed where they should be. probably because of mixed stderr/stdout printing

Dieterbe commented 6 years ago

many of our tools have this problem. in flag.Usage we often print to stdout instead of stderr. (whereas we often call flag.PrintDefaults() which prints to stderr by default)

we can solve it by just writing to stderr in all usage output.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.