pjhampton/kibana-prometheus-exporter

OpenSearch Dashboards

Closed this issue · 1 comments

Hi,

Sorry to bother you about this -- as a follow up to #235

I'm mostly testing this out of curiosity, having seen that ticket: I think there's an issue with the 7.10.2-opensearch release.
When trying to install it, I would get the following error:

+ ./bin/opensearch-dashboards-plugin list
+ grep prometheus-exporter
+ ./bin/opensearch-dashboards-plugin install https://github.com/pjhampton/kibana-prometheus-exporter/releases/download/7.10.2-opensearch/opensearch-kibanaPrometheusExporter-7.10.2.zip
Attempting to transfer from https://github.com/pjhampton/kibana-prometheus-exporter/releases/download/7.10.2-opensearch/opensearch-kibanaPrometheusExporter-7.10.2.zip
Transferring 144739 bytes....................
Transfer complete
Retrieving metadata from plugin archive
Plugin installation was unsuccessful due to error "No opensearch-dashboards plugins found in archive"
+ echo WARNING: failed to install OpenSearch Dashboards exporter plugin
WARNING: failed to install OpenSearch Dashboards exporter plugin

I started looking into fixing that zip ... Eventually managed to install a copy moving things around:
At which point, restarting opensearch-dashboards, we would see the following logs:

{"type":"log","@timestamp":"2021-09-07T01:57:59Z","tags":["error","plugins-service"],"pid":7,"message":"{ Error: Manifest for plugin \"kibanaPrometheusExporter\" contains the following unrecognized properties: owner,kibanaVersion. (invalid-manifest, /usr/share/opensearch-dashboards/plugins/.plugin.installing/opensearch_dashboards.json)\n    at Function.invalidManifest (/usr/share/opensearch-dashboards/src/core/server/plugins/discovery/plugin_discovery_error.js:68:12)\n    at parseManifest (/usr/share/opensearch-dashboards/src/core/server/plugins/discovery/plugin_manifest_parser.js:164:56)\n  type: 'invalid-manifest',\n  path:\n   '/usr/share/opensearch-dashboards/plugins/.plugin.installing/opensearch_dashboards.json',\n  cause:\n   Error: Manifest for plugin \"kibanaPrometheusExporter\" contains the following unrecognized properties: owner,kibanaVersion.\n       at parseManifest (/usr/share/opensearch-dashboards/src/core/server/plugins/discovery/plugin_manifest_parser.js:164:86) }"}
{"type":"log","@timestamp":"2021-09-07T01:57:59Z","tags":["error","plugins-service"],"pid":7,"message":"{ Error: Manifest for plugin \"kibanaPrometheusExporter\" contains the following unrecognized properties: owner,kibanaVersion. (invalid-manifest, /usr/share/opensearch-dashboards/plugins/kibanaPrometheusExporter/opensearch_dashboards.json)\n    at Function.invalidManifest (/usr/share/opensearch-dashboards/src/core/server/plugins/discovery/plugin_discovery_error.js:68:12)\n    at parseManifest (/usr/share/opensearch-dashboards/src/core/server/plugins/discovery/plugin_manifest_parser.js:164:56)\n  type: 'invalid-manifest',\n  path:\n   '/usr/share/opensearch-dashboards/plugins/kibanaPrometheusExporter/opensearch_dashboards.json',\n  cause:\n   Error: Manifest for plugin \"kibanaPrometheusExporter\" contains the following unrecognized properties: owner,kibanaVersion.\n       at parseManifest (/usr/share/opensearch-dashboards/src/core/server/plugins/discovery/plugin_manifest_parser.js:164:86) }"}
{"type":"log","@timestamp":"2021-09-07T01:57:59Z","tags":["fatal","root"],"pid":7,"message":"Error: Failed to initialize plugins:\n\tManifest for plugin \"kibanaPrometheusExporter\" contains the following unrecognized properties: owner,kibanaVersion. (invalid-manifest, /usr/share/opensearch-dashboards/plugins/.plugin.installing/opensearch_dashboards.json)\n\tManifest for plugin \"kibanaPrometheusExporter\" contains the following unrecognized properties: owner,kibanaVersion. (invalid-manifest, /usr/share/opensearch-dashboards/plugins/kibanaPrometheusExporter/opensearch_dashboards.json)\n    at PluginsService.handleDiscoveryErrors (/usr/share/opensearch-dashboards/src/core/server/plugins/plugins_service.js:122:13)"}

 FATAL  Error: Failed to initialize plugins:
	Manifest for plugin "kibanaPrometheusExporter" contains the following unrecognized properties: owner,kibanaVersion. (invalid-manifest, /usr/share/opensearch-dashboards/plugins/.plugin.installing/opensearch_dashboards.json)
	Manifest for plugin "kibanaPrometheusExporter" contains the following unrecognized properties: owner,kibanaVersion. (invalid-manifest, /usr/share/opensearch-dashboards/plugins/kibanaPrometheusExporter/opensearch_dashboards.json)

Still renaming stuff, I could eventually get a zip that does install, and won't result in OpenSearch-Dashboards crashing during startup. Basically, I would do:

DO_VERSION=7.10.2
OSD_VERSION=1.0.1
if ! test -s opensearch-kibanaPrometheusExporter-$DO_VERSION.zip; then
    wget https://github.com/pjhampton/kibana-prometheus-exporter/releases/download/$DO_VERSION-opensearch/opensearch-kibanaPrometheusExporter-$DO_VERSION.zip
fi
rm -fr opensearch-dashboards kibana
unzip opensearch-kibanaPrometheusExporter-$DO_VERSION.zip
mv kibana opensearch-dashboards
mv opensearch-dashboards/kibanaPrometheusExporter/kibana.json opensearch-dashboards/kibanaPrometheusExporter/opensearch_dashboards.json
#sed -i 's|kibana|opensearchDashboards|' opensearch-dashboards/kibanaPrometheusExporter/opensearch_dashboards.json
sed -i -e '/"owner"/,+3d' opensearch-dashboards/kibanaPrometheusExporter/opensearch_dashboards.json
sed -i -e '/kibanaVersion/,+3d' opensearch-dashboards/kibanaPrometheusExporter/opensearch_dashboards.json
sed -i "s|^  \"version\": .*|  \"version\": \"$OSD_VERSION\",|" opensearch-dashboards/kibanaPrometheusExporter/opensearch_dashboards.json
rm -f opensearch-kibanaPrometheusExporter-$DO_VERSION-1.zip
zip opensearch-kibanaPrometheusExporter-$DO_VERSION-1.zip -r opensearch-dashboards/
scp -p opensearch-kibanaPrometheusExporter-7.10.2-1.zip root@my-repo:/var/www/

And then, install plugin from my internal repo:

$ NODE_TLS_REJECT_UNAUTHORIZED=0 ./bin/opensearch-dashboards-plugin install http://my-repo/opensearch-kibanaPrometheusExporter-7.10.2-1.zip
Attempting to transfer from http://my-repo/opensearch-kibanaPrometheusExporter-7.10.2-1.zip
Transferring 151148 bytes....................
Transfer complete
Retrieving metadata from plugin archive
Extracting plugin archive
Extraction complete
Plugin installation complete
[ then, manually restart OpenSearch-Dashboards ]

Although it still does not work, I think.
We can confirm plugin was started:

{"type":"log","@timestamp":"2021-09-07T02:13:38Z","tags":["info","plugins-system"],"pid":6,"message":"Setting up [46] plugins: [alertingDashboards,usageCollection,opensearchDashboardsUsageCollection,mapsLegacy,opensearchDashboardsLegacy,share,opensearchUiShared,legacyExport,embeddable,expressions,data,home,console,apmOss,management,indexPatternManagement,advancedSettings,savedObjects,securityDashboards,anomalyDetectionDashboards,indexManagementDashboards,dashboard,notebooksDashboards,visualizations,visTypeVega,visTypeTimeline,timeline,visTypeMarkdown,visTypeTable,tileMap,regionMap,inputControlVis,ganttChartDashboards,visualize,traceAnalyticsDashboards,reportsDashboards,queryWorkbenchDashboards,kibanaPrometheusExporter,charts,visTypeVislib,visTypeTimeseries,visTypeTagcloud,visTypeMetric,discover,savedObjectsManagement,bfetch]"}

But when trying to query for my metrics, I'ld see 401s:

{"type":"response","@timestamp":"2021-09-07T02:13:53Z","tags":[],"pid":6,"method":"get","statusCode":401,"req":{"url":"/_prometheus/metrics","method":"get","headers":{"host":"127.0.0.1:5601","user-agent":"curl/7.64.0","accept":"*/*"},"remoteAddress":"127.0.0.1","userAgent":"curl/7.64.0"},"res":{"statusCode":401,"responseTime":4,"contentLength":9},"message":"GET /_prometheus/metrics 401 4ms - 9.0B"}

At which point ... maybe there's still another packaging fix to apply?! Though it's not obvious, comparing with another plugin ( https://github.com/opensearch-project/security-dashboards-plugin/releases ). Might as well be on opensearch-dashboards end.

Thanks, @faust64. I have decided to u-turn on the support. I have left my comments here: #235 (comment)