On Mon, Jul 25, 2016 at 10:01 PM, Jason Hebron <[email protected]> wrote:
> Hello > I have a measurement called > snmp_index > > In that I have the following structure (this is the result of polling my > network routers for the ifalias and ifdescr fields - we also get traffic > stats but that goes into separate measurements and work fine) > name: snmp_index > ---------------- > time host type > type_instance value > 1469496589352653000 labswitch1 if_descr_name > GigabitEthernet0_1 2 > 1469496589233902000 labswitch1 if_alias_name Uplink to > labwp3ts1 G1_0_2 2 > 1469496592073919000 labswitch2 if_alias_name > Spare 10016 > 1469496592667708000 labswitch2 if_descr_name > FastEthernet1_0_16 10016 > > > So we have each ports ifdescr and ifalias included with the value being > the ifindex number > > At this point I am using grafana to graph the traffic stats on each port > using templated queries so a network engineer can select the router and > interface (if_desc_name) from a drop down and get traffic graphs > All well so far > > The problem I have is the engineers also want to see the if_alias_name for > the port too > > From my understanding I cant do a nested query in influxdb where I could > query the value (the ifindex) where the type=id_descr_name and > type_instance=<portname> then use that value to show the type_instance > where type=if_alias_name and value=<queried value> > > I have seen the idea of doing a CQ to perform this instead but I am a bit > at a loss to work out the best way of achieving this > Correct, there are no nested queries, sub-queries, or HAVING clause in InfluxQL, yet. I'm having trouble following what query results you want to pull out. Using actual values from your sample data, is this what you want to query? query the value (2) where type=id_descr_name and type_instance=GigaitEthernet0_1, then select the type_instance where type=if_alias_name and value=2 I can't think of a way to do that with a CQ, because it's a relational query. There's no time component at all, and the points are trying to join on a field value, not a tag, so we can't use a GROUP BY clause, either. > > As an alternate in Grafana we can use templates to query values but the > issue I have is if I perform a query like > select last(value) from snmp_index where host=labswitch1 and > type_instance=GigabitEthernet0_1 > the returned value is > name: snmp_index > ---------------- > time last > 1469496652075842000 10011 > > The problem here is that in Grafana the value it see is the timestamp , > not the value > So to that end is it possible to perform the select but only return the > value, not the timestamp, or even reorder the returned value so its value > first before timestamp? > > > I've been staring at the screen on this one for a couple of days and > getting nowhere so any help appreciated > Perhaps use the AS clause to rename the return value to what Grafana expects? SELECT LAST(value) AS value FROM snmp_index... Does that help? > > > > -- > Remember to include the InfluxDB version number with all issue reports > --- > You received this message because you are subscribed to the Google Groups > "InfluxDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/influxdb. > To view this discussion on the web visit > https://groups.google.com/d/msgid/influxdb/7d09149c-7b6e-45c8-a91b-a69720a94703%40googlegroups.com > <https://groups.google.com/d/msgid/influxdb/7d09149c-7b6e-45c8-a91b-a69720a94703%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Sean Beckett Director of Support and Professional Services InfluxDB -- Remember to include the InfluxDB version number with all issue reports --- You received this message because you are subscribed to the Google Groups "InfluxDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/influxdb. To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/CALGqCvMTL5NoS1b9spG8Uw9kTg9W7ReuthbD9auoNzv4%3DOmbJw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
