etichy / grafana-swis-datasource

DataSource plugin for grafana to access SolarWinds data via SWIS REST API
MIT License
52 stars 11 forks source link

Addind String to Output #12

Closed mjs2012 closed 3 years ago

mjs2012 commented 3 years ago

Hey Edward,

Thanks for creating this plugin for Grafana, it is very cool and helps a lot.

I have created teh following query:

SELECT downsample(d.DateTime) as time,
  d.FullName,
  AVG(d.InPercentUtil) as InPercentUtil
FROM (
SELECT 
 i.Fullname,
 i.Traffic.DateTime,
 i.Traffic.InPercentUtil 
 as InPercentUtil
FROM Orion.NPM.Interfaces as i
WHERE InterfaceID IN ($Interface)
) as d
WHERE d.DateTime BETWEEN $from AND $to
GROUP BY downsample(d.DateTime), d.Fullname
ORDER BY time DESC

I get now the following output for example: grafik

Is it possible to add an string to the output, for example "SW-CENTRAL - 9 out" instead of only "SW-CENTRAL - 9". If that can be done, so can I combine "in" and "out" traffic in one graph.

Thanks a lot and best Regards, Matthias

etichy commented 3 years ago

SWQL supports string operators + other functions, so for your case you can write something like this

d.FullName + ' out' as FullName