Misunderstanding of basic data recording

Hi,
I have a centron server that sends data to influxDB and it works well.
On the other hand, there’s one thing I don’t understand.
In my server centreon I have two hosts (server1 and server2) with the service “service1” which returns performance data for each of my clients on the server.
Example :

    • Host1 - service1
  • metric 1 (name,value): client1,12345
  • metric 2 (name,value): client2,23456
  • metric 3 (name,value): client3,34567
    • Host2 - service1
  • metric 1 (name,value): client4,98765
  • metric 2 (name,value): client5,87654
  • metric 3 (name,value): client6,76543

Here is how the centreon server is configured to generate the data sent to influxdb

Measurement Name: metrics.ServiceName
Tag (name, value): host,Host_name
Values (name,value): Metrics_name,Metrics_value

On the influxDB server, if I do a “show measurements”, I find an entry called “metrics.service1”
Then, if I do a “show entries”, I find two entries here:

  • metrics.service1,host=Host1
  • metrics.service1,host=Host2

My difficulty is now: If I want to retrieve (for use in a grafana) the metrics for a particular host, I also retrieve the metrics of the other host with null values.

select LAST(*) FROM “metrics.service1” WHERE (“host” = ‘Host1’)
result:
time client1 client2 client3 client4 client5 client6
0 12345 23456 34556

select LAST(*) FROM “metrics.service1” WHERE (“host” = ‘Host2’)
result:
time client1 client2 client3 client4 client5 client6
0 98765 87654 76543

I was hoping to get this result
select LAST(*) FROM “metrics.service1” WHERE (“host” = ‘Host1’)
result:
time client1 client2 client3
0 12345 23456 34556

I think this behaviour should be normal, but then how can I do it?
I was thinking of including the host name in the service name and thus the measure in influxdb. Then, in my “from” I could filter by host but it makes my centreon configuration and my grafana requests heavier.
How can I tell in “influxql” do not to keep null fields?

Bailleul Matthieu