neuralfraud / grafana-prtg

A PRTG Datasource plugin for Grafana
177 stars 75 forks source link

Incorrectly formatted table data with "Blah" added as field name #176

Closed craftzneko closed 10 months ago

craftzneko commented 3 years ago

when creating a table panel using an example listed here before

Query mode - Raw table.json and content=sensors&columns=objid,downtimesince,device,sensor,lastvalue,status,message,priority&filter_status=5&filter_status

returns 3 fields each called "Blah" and inside each of these is the data i need. Grafana wont format it correctly into a table im assuming because of the above. I looked at the query inspector and the "blah" doesnt appear in the data returned, could this be introduced by the plugin unintentionally or by grafana? 1

joachimd90 commented 3 years ago

Want to follow this, is one of the stoppers on my dashboard project! Can't see to find an solution for this :(

Attached a screendump on how far I came! Grafana-Blah

craftzneko commented 3 years ago

Looking at the raw data that gets passed to grafana, this is something the plugin is doing. This data is shown in the Panel Data section of query inspector. Notice the "Blah" added in "name" and "refid" im guessing "blah" is a placeholder for something that should be passed?

{ "state": "Done", "series": [ { "name": "blah", "refId": "blah", "meta": { "json": true, "transformations": [ "calculateField", "calculateField" ] }, "fields": [ { "name": "blah", "type": "other", "config": {}, "values": [ { "objid": 2410, "objid_raw": 2410, "downtimesince": "10 h 6 m", "downtimesince_raw": 36399, "device": "Lansweeper", "device_raw": "Lansweeper", "sensor": "Service Lansweeper Server", "sensor_raw": "Service Lansweeper Server", "lastvalue": "", "lastvalue_raw": "", "status": "Down", "status_raw": 5, "message": "<div class=\"status\">This service is either not installed on the target system or it is stopped. To monitor a service and make sure that it is NOT running, see https://kb.paessler.com/en/topic/64529. (code: PE207)<div class=\"moreicon\">

", "message_raw": "This service is either not installed on the target system or it is stopped. To monitor a service and make sure that it is NOT running, see https://kb.paessler.com/en/topic/64529. (code: PE207)", "priority": "3", "priority_raw": 3 } ], "state": { "displayName": "blah", "scopedVars": { "series": { "text": "Series", "value": { "name": "blah" } }, "field": { "text": "Field", "value": {} } } } } ], "length": 1 },

joachimd90 commented 3 years ago

I have now tried to use Grafana V7.2.0-beta1 with PRTG plugin 4.0.4, and this time I get another error in Grana..

bilde

angela-d commented 3 years ago

If you have any fields with null data, it will break the whole panel.

Adjust your "Last x hours" at the top. I find between 3 and 6 hours selection is a sweet spot for the data not getting mangled.

7.2 appears to have options to handle empty data, but I've not tested it to see if the panel still breaks.

joachimd90 commented 3 years ago

After 1 week of different testing, I went over to test different grafana versions to see who could serve me the best solution as today.. I got all my dashs to work with Grafana v6.3.0 and with plugin 4.0.4.. So far so good.. The auto refresh are working, it's shows metrics and table data.. I am missing some panel options, but that's just "nice2have"...

AImXOo0o commented 3 years ago

Any news of this? :O

craftzneko commented 3 years ago

Realize this is not going to be a suitable solution for everyone and would love the plugin to work, but its clear its not an active development and hasnt been for along time. In the future with newer version's of grafana your only going to end up with more breaking bugs. A solution I have moved to is to use SQL as the middle man between PRTG and Grafana. It works really well and gives us much more control. You can configure PRTG to run a custom script on changes or just when a sensor is down. Just use a powershell script to write details to a SQL table and then query that in grafana.

AImXOo0o commented 3 years ago

@pr1malc0de Hey. How is your setup now? Do you have a short guide or something like this?

Thanks in advance.

atilanomontero commented 3 years ago

Hi. Has this problem solved? table headers still show as blah for any table.json query. I use version 7.15 of grafana and version 4.04 of the prtg plugin

EYEVO commented 3 years ago

Same issue here, i did find out if you use outer join under transform does display the rows but for the columns i just see 1 named blah. image

joachimd90 commented 3 years ago

The solve the issue I think Grafana need to bring back the solution on how you want to display the data.

In earlier releases you are able to choose JSON data and some other options, I can’t see this options anywhere after v6.0.0

//JD

On 5 Mar 2021, at 15:17, Ivo notifications@github.com wrote:



Same issue here, i did find out if you use outer join under transform does display the rows but for the columns i just see 1 named blah. [image]https://user-images.githubusercontent.com/16328089/110127263-b85c0600-7dc5-11eb-9371-edb94ece7073.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/neuralfraud/grafana-prtg/issues/176#issuecomment-791446275, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM52OET34XN3MSZYUON4GKDTCDRVZANCNFSM4RFGIAGA.

joachimd90 commented 3 years ago

A solution that works!

After a lot of Googling, I came across someone who had the problem with their table view, and there they had solved the problem by changing Panel JSON.

They replaced

"type": "table"

with

"type": "table-old"

Tested this and then got back the option by choosing which data to display, and everything was no longer sorted by "BLAH" as before.

This supports my theory that Grafana has made some changes in how they retrieve JSON data and has nothing to do with the PRTG Plugin for grafana (I think) .. But I encountered a new problem, and that is that the text now comes from right instead of coming from the left .. But here I think it's a simple solution, somewhere ..

Feel free to look at the screenshot I have added, some censorship was needed!

By the way, I am currently running version 7.5.0-Beta1 with Grafana PRTG plugin 4.0.3

(Note to myself: Looks like Transform aren't working after changing table-type) Type-Table-Old

yurividal commented 3 years ago

"type": "table-old" does not work anymore on grafana 8.... Any other options to display the json as a proper table?

Melladay88 commented 2 years ago

If you set "Outer Join" & "Extract Fields" & "Filter by Name". This is the latest version of grafana

image