luci-app-statistics: only graph data supported by APC UPS
Some graph definitions rely on data not supported across all APC UPSes.
Due to recent upstream changes in collectd, the daemon no longer creates
a NaN-filled .rrd file corresponding to any missing UPS data. Depending
on the connected UPS, this may result in some "broken" graphs on the Luci
Statistics page since rrdtool cannot find the expected .rrd file.
Include the add_supported() function to determine the UPS data available
at runtime and update any definitions of graphs to include only supported
data. For example, the whole chart stack of AC input and output voltages
will normally be "broken" if the UPS only measures AC input voltage. With
these changes, the output voltage graph definition is stripped out,
allowing the chart to render.
Make consistent use of data types and instances in graph definitions. All
definitions now use the same format with the 'instances' key. Unnecessary
'types' and 'sources' keys are removed.
Fix the definition of 'line frequency' graph, based on upstream collectd
apcups plugin code: type is 'frequency' but instance should be 'input'.
This also includes some code and whitespace cleanup.
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>