# Grafana count entry

**URL:** <https://discourse.nodered.org/t/grafana-count-entry/46572>\
**Category:** General\
**Created:** [1 June 2021 20:41 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572 "2021-06-01T20:41:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikozo](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@vikozo](https://discourse.nodered.org/u/vikozo)\
**Post date:** [1 June 2021 20:41 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572/1 "2021-06-01T20:41:27Z")

</div>

Hello  
i have again a Grafana Problem

imagine

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  
Vinc

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 07:30 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572/2 "2021-06-02T07:30:25Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![vikozo](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@vikozo](https://discourse.nodered.org/u/vikozo)\
**Post date:** [2 June 2021 13:37 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572/3 "2021-06-02T13:37:46Z")

</div>

ok i will have to read some other sources too.

basicly stored into influxDB \>1.8  
Visualizes in Grafana

---

<div class="post-metadata">

**Author:** ![vikozo](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@vikozo](https://discourse.nodered.org/u/vikozo)\
**Post date:** [4 June 2021 19:35 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572/4 "2021-06-04T19:35:33Z")

</div>

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;

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 June 2021 20:09 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572/5 "2021-06-04T20:09:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 June 2021 20:28 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572/6 "2021-06-04T20:28:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vikozo](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@vikozo](https://discourse.nodered.org/u/vikozo)\
**Post date:** [5 June 2021 09:19 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572/7 "2021-06-05T09:19:18Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 June 2021 09:58 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572/8 "2021-06-05T09:58:43Z")

</div>

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](https://docs.influxdata.com/influxdb/v1.8/concepts/key_concepts/)  
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).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 August 2021 09:58 UTC](https://discourse.nodered.org/t/grafana-count-entry/46572/9 "2021-08-04T09:58:52Z")

</div>

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