0
votes

okay, this is not a simple PromQL query that i want to run. this is my input data:

accessPoint_numClients{mac="00:11:22:33:44:55"} 11
accessPoint_numClients{mac="00:11:22:33:44:AA"} 12
accessPoint_numClients{mac="00:11:22:33:44:BB"} 5

accessPoints{mac="00:11:22:33:44:55", groupId="1"} 1
accessPoints{mac="00:11:22:33:44:AA", groupId="1"} 1
accessPoints{mac="00:11:22:33:44:BB", groupId="2"} 1

controller_zone_groups{groupId="1", groupName="Foo"} 1
controller_zone_groups{groupId="2", groupName="Bar"} 1
controller_zone_groups{groupId="3", groupName="Baz"} 1

so, i want generate an grafana graph that group client-count by groups and also print out the related groupNames.

so this is my current try, but this is far away from an working query:

sum by (groupId) (accessPoint_numClients * on (mac) group_left(groupId) accessPoints * on (groupId) group_left(groupName) controller_zone_groups)

is there any chance to get this working?

thx, volker...

================ UPDATE ===============

okay, maybe some sample querys with response:

sum by (apGroupId) ((smartzone_accessPoint_numClients * on (mac) group_left(apGroupId) smartzone_accessPoints) or (groupId) group_left(groupName) smartzone_controller_zone_groups)

==> "parse error at char 125: unexpected in aggregation, expected \")\""

sum by (apGroupId) (smartzone_accessPoint_numClients * on (mac) group_left(apGroupId) smartzone_accessPoints) * on (apGroupId) group_left(groupName) smartzone_controller_zone_groups

==> "many-to-many matching not allowed: matching labels must be unique on one side"

sum by (groupName) (smartzone_accessPoint_numClients * on (mac) group_left(apGroupId) smartzone_accessPoints) * on (apGroupId) group_left(groupName) smartzone_controller_zone_groups

==> "many-to-many matching not allowed: matching labels must be unique on one side"

2

2 Answers

0
votes

Your question is a little unclear, but I think what you're asking for is why groupName isn't in the output. The answer is that the sum aggregates it away, which adding groupName to the by will fix.

0
votes

Try using something like the following:

sum by (groupName) (
  sum by (groupId) (
    accessPoint_numClients * on(mac) group_right(groupId) accessPoints
  ) * on(groupId) group_right(groupName) controller_zone_groups
)