etichy / grafana-swis-datasource

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

Potential Bug in datasource or SWIS #15

Closed Atomicbeast101 closed 1 year ago

Atomicbeast101 commented 3 years ago

I came across an issue with a query that isn't returning any results in Grafana even though it did via SWQL Studio. Is this expected due to the limitation of SWIS as SWQL Studio seems to be using a different method to retrieve the data?

This is the query I used:

SELECT
  TOUPPER(NP.Nodes.Caption) AS Name,
  NP.EntityPhysical.Model,
  CONCAT(MONTH(NP.EndOfSoftware), '-', DAY(NP.EndOfSoftware), '-', YEAR(NP.EndOfSoftware)) AS EndOfSoftware,
  CONCAT(MONTH(NP.EndOfSales), '-', DAY(NP.EndOfSales), '-', YEAR(NP.EndOfSales)) AS EndOfSale,
  CONCAT(MONTH(NP.EndOfSupport), '-', DAY(NP.EndOfSupport), '-', YEAR(NP.EndOfSupport)) AS EndOfSupport
FROM NCM.NodeProperties NP
WHERE EndOfSupport IS NOT NULL AND NP.EntityPhysical.ContainedIn = 0 AND NP.EndOfSupport <= ADDYEAR(2, GETDATE())
GROUP BY NP.Nodes.Caption, NP.EntityPhysical.Model, NP.EndOfSoftware, NP.EndOfSales, NP.EndOfSupport
ORDER BY NP.EndOfSupport;

Grafana Query Inspector:

{
  "request": {
    "url": "api/datasources/proxy/8/Query",
    "method": "POST",
    "data": {
      "query": "SELECT\r\n  TOUPPER(NP.Nodes.Caption) AS Name,\r\n  NP.EntityPhysical.Model,\r\n  CONCAT(MONTH(NP.EndOfSoftware), '-', DAY(NP.EndOfSoftware), '-', YEAR(NP.EndOfSoftware)) AS EndOfSoftware,\r\n  CONCAT(MONTH(NP.EndOfSales), '-', DAY(NP.EndOfSales), '-', YEAR(NP.EndOfSales)) AS EndOfSale,\r\n  CONCAT(MONTH(NP.EndOfSupport), '-', DAY(NP.EndOfSupport), '-', YEAR(NP.EndOfSupport)) AS EndOfSupport\r\nFROM NCM.NodeProperties NP\r\nWHERE EndOfSupport IS NOT NULL AND NP.EntityPhysical.ContainedIn = 0 AND NP.EndOfSupport <= GETDATE()\r\nGROUP BY NP.Nodes.Caption, NP.EntityPhysical.Model, NP.EndOfSoftware, NP.EndOfSales, NP.EndOfSupport\r\nORDER BY NP.EndOfSupport;",
      "parameters": {
        "timeFrom": "2021-02-04T17:38:03.338Z",
        "timeTo": "2021-02-05T17:38:03.339Z",
        "granularity": 120
      }
    },
    "hideFromInspector": false
  },
  "response": {
    "results": []
  }
}
etichy commented 2 years ago

Hmm looks like query used in Grafana is different then you used in SWQL Studio. NP.EndOfSupport <= ADDYEAR(2, GETDATE()) versus NP.EndOfSupport <= GETDATE()

Can this be the difference?

etichy commented 1 year ago

Closing this one as there's no update. In case anything feel free to reopen