I did some asking around on the subject, and there was a valid reason initially (though I haven't been able to determine what that reason was).
Today, the reason is that all of the code that touches performance data expects that format. This isn't user-configurable and there's no handy page or config file where it can be altered. Changing the format of performance metrics would require a re-write to numerous pieces of code throughout several different sections of the product.
. Do you know if you can replace the device ID with a
Michael J. Rogers
Subject: |
RE: Querying OpenTSDB for one metric across multiple devices |
Author: |
Michael Ermino |
Posted: |
2020-02-13 18:23 |
Thanks for doing the legwork and trying to figure this out.
Setting up a query variable to pull just the device id's still isn't possible with the way the metric data is saved by Zenoss 6 and the existing OpenTSDB api endpoints. Even with the api/suggest endpoint I cannot pull devices that have an arbitrary prefix (ie. 01_server_a, 02_server_a, etc...) as the string match value only matches metrics that
start with the given value.
I was afraid that it wasn't going to be a straightforward fix, so I've been working on a "Plan B" which is a process that reads metrics from OpenTSDB every 5 minutes and writes them back to OpenTSDB without the device ID prefixed to the metric name. Using those rewritten metrics I can now perform a single query to one metric (ex. laLoadInt15_laLoadInt15) with a wildcard tag (ex. device=*prod_server*) that pulls all the metrics that contains "prod_server" in its name. It is definitely not the ideal solution I was looking for, but it works for now. I'm just not sure that this solution is sustainable and how it will affect performance on the OpenTSDB instance.
------------------------------
Mike
------------------------------
Subject: |
RE: Querying OpenTSDB for one metric across multiple devices |
Author: |
Michael Ermino |
Posted: |
2020-02-27 19:12 |
So my solution to read the metrics and rewrite them back to OpenTSDB in the recommended format as stated in the OpenTSDB documentation is proving to be more problematic as I'm seeing performance issues when just trying to read the metrics. Because of the way metrics are stored, I need to make individual requests for each device metric. The OpenTSDB API query endpoint starts failing and timing out. We've increased the number of opentsdb instances, but it doesn't seem to help.
From what was mentioned earlier in this thread, Zenoss expects metrics in its current format and that there would be major changes needed to change the format of how metrics are written...
Is it possible to modify the code of our Zenoss 6 instance so that when metrics are saved to OpenTSDB it is saved twice? Once in the format that Zenoss is expecting, and another in the standard OpenTSDB format where the device name is NOT prepended to the metric name? I'm assuming that the MetricShipper service is where the data is sent to OpenTSDB. Is this the right place? Can this be modified to save each metric twice?
------------------------------
Mike
------------------------------
Thanks for the response Michael. Unfortunately there is no raw query mode for the OpenTSDB data source in Grafana. I'm stuck with their query editor. We might have to look into an alternative solution for our monitoring. Grafana has been an integral part of our operations as it brings all our monitoring data into one central location.
Question about the way Zenoss 6 saves data into OpenTSDB... is there a technical requirement that Zenoss 6 doesn't save metric data as the OpenTSDB documentation recommends? Its very similar to the way data is sent to InfluxDB where tags are used as identifiers for the metric. If metric data was saved using tags instead of prepending the device id to the metric name, then this would make querying easier.
http://opentsdb.net/docs/build/html/user_guide/query/timeseries.html
If there is no technical requirement, is it possible for me to modify the logic that sends data to the OpenTSDB scollector so that the device id is no longer prepended to the metric name and instead added as a tag value? OR is there a way to modify the logic to write the data twice, where the second write would be in the recommended OpenTSDB format?
------------------------------
Mike
------------------------------
Mike