NatelEnergy / grafana-plotly-panel

Show plotly graph in grafana panel
MIT License
145 stars 58 forks source link

Metric Value #12

Closed lmatheney closed 6 years ago

lmatheney commented 7 years ago

Hello, I am using elastic search data.

I am trying to create a graph with a Y-axis of temperatures, X-axis of dates, and Z( color scale) axis of times. When I tried to do this on a regular graph from grafana it allowed me to select the temperature and time for my two axises, but not color scale of course. However when I changed over to the plotly plugin, the color scale appears, but I cannot get my x or y axises to accept ( or even show) the correct metric I need. It shows @time and @index, and I want the metric 'value' . Is there something very basic I am missing? Thank you in advance!

screen shot 2017-07-17 at 2 54 09 pm screen shot 2017-07-17 at 2 53 44 pm screen shot 2017-07-17 at 2 53 19 pm

ryantxu commented 7 years ago

it looks like you have '@index' as you Y axis -- is that what you want?

Did you try setting a value field for the colorscale? That is in the 'Plot' tab above where it says 'X Axis'?

Can you attach the panel json?

lmatheney commented 7 years ago

No, I want to change the y to be 'value' which is a temperature between 60-120 deg c

Value doesn't even show up in metric for markers, X or Y axis. { "annotations": { "list": [] }, "editMode": false, "editable": true, "gnetId": null, "graphTooltip": 0, "hideControls": false, "id": 140, "links": [], "refresh": false, "rows": [ { "collapse": false, "height": 250, "panels": [ { "alert": { "conditions": [ { "evaluator": { "params": [ 80 ], "type": "gt" }, "operator": { "type": "and" }, "query": { "params": [ "A", "5m", "now" ] }, "reducer": { "params": [], "type": "avg" }, "type": "query" } ], "executionErrorState": "alerting", "frequency": "60s", "handler": 1, "name": "K & L CPU Temp alert", "noDataState": "no_data", "notifications": [] }, "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": "Cori SEDC", "fill": 1, "id": 3, "legend": { "alignAsTable": true, "avg": false, "current": false, "max": true, "min": false, "rightSide": false, "show": true, "total": false, "values": true }, "lines": false, "linewidth": 1, "links": [], "nullPointMode": "null", "percentage": false, "pointradius": 2, "points": true, "renderer": "flot", "seriesOverrides": [ { "alias": "{{cname}} Temp0", "color": "#DEDAF7" } ], "spaceLength": 10, "span": 12, "stack": false, "steppedLine": false, "targets": [ { "alias": "{{cname}} Temp0", "bucketAggs": [ { "fake": true, "field": "cname", "id": "3", "settings": { "min_doc_count": 1, "order": "desc", "orderBy": "_term", "size": "10" }, "type": "terms" }, { "field": "@timestamp", "id": "2", "settings": { "interval": "auto", "min_doc_count": 0, "trimEdges": 0 }, "type": "date_histogram" } ], "dsType": "elasticsearch", "metrics": [ { "field": "value", "id": "1", "meta": {}, "settings": {}, "type": "max" } ], "query": "sensor_unit: degC AND NOT cname: c?-0c AND NOT cname: c7-5c AND NOT cname: c5-5c AND NOT c6-5c", "refId": "A", "timeField": "@timestamp" } ], "thresholds": [ { "colorMode": "critical", "fill": true, "line": true, "op": "gt", "value": 80 } ], "timeFrom": null, "timeShift": null, "title": "K & L CPU Temp", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "format": "celsius", "label": "CPU Temp", "logBase": 1, "max": "100", "min": "60", "show": true }, { "format": "h", "label": null, "logBase": 1, "max": null, "min": null, "show": true } ] } ], "repeat": null, "repeatIteration": null, "repeatRowId": null, "showTitle": false, "title": "Dashboard Row", "titleSize": "h6" }, { "collapse": false, "height": 250, "panels": [ { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": "Cori SEDC", "fill": 1, "id": 5, "legend": { "alignAsTable": true, "avg": false, "current": false, "max": true, "min": false, "rightSide": false, "show": true, "total": false, "values": true }, "lines": false, "linewidth": 1, "links": [], "nullPointMode": "null", "percentage": false, "pointradius": 2, "points": true, "renderer": "flot", "seriesOverrides": [ { "alias": "{{cname}} Temp0", "color": "#DEDAF7" } ], "spaceLength": 10, "span": 12, "stack": false, "steppedLine": false, "targets": [ { "alias": "{{cname}} Temp0", "bucketAggs": [ { "fake": true, "field": "cname", "id": "3", "settings": { "min_doc_count": 1, "order": "desc", "orderBy": "_term", "size": "10" }, "type": "terms" }, { "field": "@timestamp", "id": "2", "settings": { "interval": "auto", "min_doc_count": 0, "trimEdges": 0 }, "type": "date_histogram" } ], "dsType": "elasticsearch", "metrics": [ { "field": "value", "id": "1", "meta": {}, "settings": {}, "type": "max" } ], "query": "sensor_unit: degC AND NOT cname: c?-0c AND NOT cname: c7-5c AND NOT cname: c9-4c2s7 AND NOT cname: c5-5c AND NOT c6-5c WHERE values IS NULL", "refId": "A", "timeField": "@timestamp" } ], "thresholds": [], "timeFrom": null, "timeShift": null, "title": "K & L CPU Temp", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "format": "celsius", "label": "CPU Temp", "logBase": 1, "max": "100", "min": "55", "show": true }, { "format": "h", "label": null, "logBase": 1, "max": null, "min": null, "show": true } ] } ], "repeat": null, "repeatIteration": null, "repeatRowId": null, "showTitle": false, "title": "Dashboard Row", "titleSize": "h6" }, { "collapse": false, "height": 250, "panels": [ { "datasource": "Cori SEDC BC", "id": 6, "links": [], "pconfig": { "layout": { "autosize": false, "dragmode": "zoom", "font": { "color": "#D8D9DA", "family": "\"Open Sans\", Helvetica, Arial, sans-serif" }, "hovermode": "closest", "legend": { "orientation": "v" }, "margin": { "b": 45, "l": 65, "r": 20, "t": 0 }, "paper_bgcolor": "rgba(0,0,0,0)", "plot_bgcolor": "#1f1d1d", "scene": { "xaxis": { "title": "X AXIS" }, "yaxis": { "title": "Y AXIS" }, "zaxis": { "title": "Z AXIS" } }, "showlegend": false, "xaxis": { "gridcolor": "#444444", "range": null, "rangemode": "normal", "showgrid": true, "type": "date", "zeroline": false }, "yaxis": { "gridcolor": "#444444", "range": [ 60, 120 ], "rangemode": "between", "showgrid": true, "type": "linear", "zeroline": false } }, "mapping": { "color": "@index", "size": null, "x": "@time", "y": "@index", "z": "c9-4c2s7 Temp0123" }, "settings": { "color_option": "ramp", "displayModeBar": false, "line": { "color": "#005f81", "dash": "solid", "shape": "linear", "width": 6 }, "marker": { "color": "#33B5E5", "colorscale": "Greens", "line": { "color": "#DDD", "width": 0 }, "showscale": true, "size": 5, "sizemin": 3, "sizemode": "diameter", "sizeref": 0.2, "symbol": "circle" }, "mode": "markers", "type": "scatter" } }, "span": 12, "targets": [ { "alias": "{{cname}} Temp0", "bucketAggs": [ { "fake": true, "field": "cname", "id": "3", "settings": { "min_doc_count": 1, "order": "desc", "orderBy": "_term", "size": "0" }, "type": "terms" }, { "field": "@timestamp", "id": "2", "settings": { "interval": "auto", "min_doc_count": 0, "trimEdges": 0 }, "type": "date_histogram" } ], "dsType": "elasticsearch", "metrics": [ { "field": "value", "id": "1", "meta": {}, "settings": {}, "type": "max" } ], "query": "sensor_type: BC_T_NODE0_CPU1_TEMP AND sensor_unit: degC AND NOT cname: c?-0c AND NOT cname: c7-5c AND NOT cname: c5-5c AND NOT c6-5c AND value: [60 TO 120]", "refId": "A", "timeField": "@timestamp" },

ryantxu commented 7 years ago

What happens when you select one of the value fields for the Y axis (they seem to show up fine for the x-axis)?

FYI -- i have never worked with the elasticsearch datasource, but it should work. Also, can you confirm that you are running version 0.0.3?

lmatheney commented 7 years ago

Works perfectly fine when just using the 'graph' instead of plotly plugin and yes I'm updated to 0.0.3. When I click on either the X, Y or Metric ( under 'Markers' ) it shows only @index, @ temp, but not @value. Thank you for trying to assist me!

ryantxu commented 7 years ago

In your first screenshot, you have a list of the possible metric values (@time, @index, and then c9-XXX Temp0) Have you tried using c9-XXX Temp0 for the Y axis?

Note that @time is just the time field -- it does not have a name, @index is a number 0-#of points, there is no @value, only the list of fields returned by your metric

lmatheney commented 7 years ago

Hey Ryan,

Yes I did try with a cx-xxx for the Y axis, nothing popped up on the graph. How would I choose a field to graph with?

screen shot 2017-07-19 at 8 34 27 am

On of the fields I would like to use is called 'value', in my case it reflects a percentage or a temperature.

So I selected 'value' for the metric: screen shot 2017-07-19 at 8 37 02 am

Should I be choosing a different metric?

BasilHall commented 6 years ago

Having a similar issue when attempting to use plotly as a drop-in replacement for the stock "graph" panel. I am using the PostgreSQL Data Source, and have brought my query over in the same form that was working in the graph panel. Is there something fundamentally different about the intended use of this plugin? I am not being presented with any of the metrics that I have defined in the metrics tab, just the '@time' and '@index'. Thanks!

petosegan commented 6 years ago

Same issue, it's really not clear how to bring in data from PostgreSQL. How can I adapt a query that works in the Graph panel to work in this plugin?

ryantxu commented 6 years ago

in latest 0.0.4, you should be able to do a single SQL query and have things work. Give that a try and let me know if there are still issues

AndyMender commented 6 years ago

I have a similar problem, except that in my case there is no possible selection for the Display->'-Metric' field. My query looks as follows:

SELECT avg("Normalized_Power"), time_bucket($__interval, time) AS "time"
FROM "devices"
WHERE $__timeFilter("time")
GROUP BY time
ORDER BY time ASC

Should I use SELECT column as metric in the statement for it to work?

EDIT: In the case of the regular Graph plugin, a SELECT avg("Normalized_Power") AS "Normalized_Power" seems to do the trick, but not here.

ryantxu commented 6 years ago

I'll close this now -- if this is still an issue, lets open it again with a more clear title