custom querying in graphite

前端 未结 1 1560
予麋鹿
予麋鹿 2021-01-05 04:39

We need to collect timeseries information on multiple server and business processes and consider to use graphite. It seems good if we want to display the raw data. But what

相关标签:
1条回答
  • 2021-01-05 05:24

    Graphite definitely allows you to query your data, both graphically and returning csv or json. The queries in graphite aren't done with a language like sql. They're done with functions that apply to one metric at a time. Each metric is it's own database, which is just a series of time, value pairs.

    The most common thing you're likely to want is summarize data over different time periods. Here's an example of what the url would look like for a graph where the data is summarized daily for a week:

    http://graphite.example.com/render/?width=586&height=308&_salt=1355992522.674&target=summarize(stats_counts.mystat.subname%2C%20'1day')&from=-7days
    

    If you wanted to get back csv instead of a graph, you would just add format=json to the url. And if you're looking at the data through graphite's web interface you'd just be putting the following in to view the same graph.

    summarize(stats_counts.mystat.subname, '1day')
    

    Most of the querying of data you do will at first be in the graphite composer, which is just a web interface that lets you click on the metrics you want to add to the graph, and apply the various functions to them.

    As for adding the data to Postgres, you're probably not going to want to do that to query it. The data isn't really structured in a way that's great for relational databases.

    0 讨论(0)
提交回复
热议问题