Dears ,
Am using influx + Grafana and trying to collect some data in which i need Filter some feild based on first 3 digit of Name field (srting)

As in the snapshot i need the results starting with name for eg staring with “AJB”. But am not able to filter it . Can someone please help me to achive this
Can you please give me example with my query am new to this
This is the query currently am running
SELECT last(“SiteStatus”) as STATE FROM “idirect” WHERE “agent_host” = ‘91.151.164.6’ AND ( SiteStatus = 2 OR SiteStatus = 3) AND time >= now() -1m GROUP BY NodeName
So maybe this? I don’t know what your field key is.
SELECT last(“SiteStatus”) as STATE FROM “idirect” WHERE “agent_host” = ‘91.151.164.6’ AND ( SiteStatus = 2 OR SiteStatus = 3) AND "your_field_key"=~ /AJB/ AND time >= now() -1m GROUP BY NodeName
Also If that doesn’t yield what you want, I suggest playing with you system stats to see how this query works. It might help you gain a better understanding of InfluxQL.
SELECT mean("usage_system") AS "mean_usage_system", mean("usage_steal") AS "mean_usage_steal" FROM "telegraf"."autogen"."cpu" WHERE time > :dashboardTime: AND "cpu"=~ /cpu/ GROUP BY time(:interval:) FILL(null)
Query used:
SELECT last(“SiteStatus”) as STATE FROM “idirect” WHERE “agent_host” = ‘91.151.164.6’ AND ( SiteStatus = 2 OR SiteStatus = 3) AND “NodeName” =~ /AJB/ AND time >= now() -1m GROUP BY NodeName
Since am using Grafana i tried to add my tag value “NodeName” as variable and tried below query but still am not able to fetch any data
Query Used:
SELECT last(“SiteStatus”) FROM “idirect” WHERE (“agent_host” = ‘91.151.164.6’ AND “NodeName” =~ /^$cust$/) AND time >= now() -1m GROUP BY “NodeName”
@danishv,
I’m not a grafana user, so I’m not sure how helpful I can be on that end. However, if you are able to share some data with me in line protocol, then I can create the query you’re looking for. Have you tried the similar system stats query yet?/been able to understand how that works?