Ankit Kulkarni
Ankit Kulkarni

Reputation: 1335

Creating simple line chart in kibana 4

Kibana 4 is very cool , however creating a line chart for the data I have below seems very confusing . Here's the problem . So I have to watch the cpu usage over time on a specified date (or say a date range ) for the below kind of data

 {
  "_index": "demo-index-01-10-2016",
  "_type": "mapping1",
  "_id": "AVOJL8SAfhtnGcHBklKt",
  "_score": 1,
  "_source": {
    "my_custom_id ": 165,
    "MEM": 89.12,
    "TIME": "2016-01-10T15:22:35",
    "CPU": 68.99
  }

Find bigger sample here .

On the x axis however we can select date histogram but the problem with Y Axis is the aggregate function . It has count which shows the item count for the above kind of json fields . Selecting sum in Y axis (as per this answer suggests do not works for me) and then Selecting 'CPU' gives the sum of the cpu field which is ofcourse not desired . I want to plot for individual cpu field against individual timestamp which is the most basic graph I expect . How can I get that ?

Upvotes: 1

Views: 901

Answers (1)

Sandy Cox
Sandy Cox

Reputation: 21

I hope I've understood your question - that you want to plot CPU usage against time, showing each sample. With a Date Histogram, Kibana looks for an aggregation for each time bucket, whereas you want to plot samples.

One way would be to use a date histogram, but ensure that the "interval" is less than your sample period. Then use the "Average", "Min" or "Max" aggregation on the Y axis. Note that the sample timestamp will be adjusted to the histogram.

Generally, I'd suggest using a date histogram with the "Average" or "Max" aggregation on the Y, and not worry too much about plotting individual samples, as you're looking for a trend. (Using "Max" is good for spotting outliers) Setting the interval to "Auto" will pick a decent level of granularity, and then you can zoom in to get more detail if you need it.

Also, ensure your mapping is correct, CPU usage should be a float or a double I believe.

Hope this helps

Upvotes: 1

Related Questions