Grafana count entry

i have again a Grafana Problem


time | status | Name
solved John
NOK vera
solved John
NOK John
solved John
solved vera

so i would like to count on my database
how many time
John Solved (3)
John NOK (1)
Vera solved (1)
Vera NOK (1)
This with more name too, and different status too

have a nice time

That isn't a Grafana question, it is an Influx question (assuming that you are using Influx). Are status and name fields or tags? If you don't know the difference or the implications then I think a good tutorial on Influx would be worthwhile (make sure that the tutorial is for the correct Influx version, 1.8 or 2.0).

ok i will have to read some other sources too.

basicly stored into influxDB >1.8
Visualizes in Grafana

not easy to find and understand it

my node has this and

msg.payload = {

Name: msg.payload[0][4],
Status: msg.payload[4][4]

return msg;

What has that got to do with the question? I thought you wanted to run an Influx query that returns a count of each combination of status and name. You need to work out what influx queries to run, which isn't anything to do with node red. Once you know the queries then you can work out how to do that in node-red. I don't know the exact query, I would have to look that up myself.

I think you may need to run a separate query to get the count for each combination, but I am not sure about that.

Perhaps I have misinterpreted your last post. Were you trying to answer the question about whether they are fields or tags? If the function you posted is passing a message to an Influx Out node then, since the help for the node states
" If msg.payload is an object containing multiple properties, the fields will be written to the measurement." then that means you are writing them as fields. I think possibly that, for efficiency, they should be tags, if you are going to run WHERE clauses against them in order to count them. I am not certain about that though.

@Colin thanks this helps
yes they are put into measurement this is true.
So i should find out how to tag them correct.

i belived
Name: msg.payload[0][4],
the Name would be the Tag

I don't think you understand what is meant by an influx tag. Read this which explains the basic concepts of influxdb and what is stored in the database. InfluxDB key concepts | InfluxDB OSS 1.8 Documentation
It is that sort of thing that I suggested that you needed to find out about.

Then look again at the help text for the Influx Out node, particularly the section starting " If msg.payload is an array containing two objects ..." which tells you how to write tag values as well as field values. Assuming that you decide they should be tags.

[Edit] In fact I suspect that name should be a tag and status should be a field. Fields should contain what are effectively data values (the status of John) and Tags should contain what the data refers to (John).

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.