Open mikewhippsHarvest opened 4 months ago
This is a really interesting point, would you endeavour to make a PR?
For the time being, especially regarding json, check the third-party projects list, IIRC some emitters were there.
But having some out of the box was backlogged for a while...
I am wary of allowing arbitrary file access (especially with paths and not a filename exactly in configured resource directory), way too many attacks happen through such vectors historically. Probably a deployment's config file should list allowed filenames for templates, if such option were added.
By PR do you mean Pull Request? My skill level won't run to that, I'm afraid :( I last wrote C (not even C++) about 1984
I have a working JSON template set up as upsstats-single.html. The Content-type: header is wrong, but PRTG doesn't seem to care.
We're still evaluating so this would be nice in the future. I imagine others would find it useful, though.
I'm keen to understand the real timeline to this feature being added to the NUT package. Being able to retrieve the data shown on either the table or graph view of the cgi interface as JSON would be a major advantage allowing us to make a PRTG sensor to bring the data & monitoring into PRTG
Timeline? Rather, milestones: Somebody writes the code, posts a PR, it passes CI and works in fact and does not add regressions and errors / predictable flaws, it gets merged and eventually published as part of a release...
I'd like an option to select a template at runtime when running UPSSTATS.CGI.
Something like a query string element
upsstats.cgi?template=mytemplate.html
, or possibly evenupsstats.cgi?template=/path/to/mytemplate.html
It would be good to allow the use of
json
orxml
as an extension instead ofhtml
, as inupsstats.cgi?template=mytemplate.json
,The specific use case is to emit data in JSON format to import into PRTG for monitoring while leaving the friendlier HTML version alone for those wanting to query NUT directly in a browser.