intelsdi-x / snap-plugin-collector-elasticsearch

Collects Elasticsearch cluster and nodes statistics
http://snap-telemetry.io/
Apache License 2.0
3 stars 14 forks source link

snap-plugin-collector-elasticsearch will not load with snapctl plugin load #16

Closed zachary-trudo closed 8 years ago

zachary-trudo commented 8 years ago

Problem: Built snap-plugin-collector-elasticsearch from latest commit When attempting to load snap-plugin-collector-elasticsearch into snap with snapctl plugin load I receive the following error:

<029-zwzca:/go/bin# snapctl plugin load snap-plugin-collector-elasticsearch
Error loading plugin:
unexpected EOF

Environment:

NAME             VERSION         TYPE            SIGNED          STATUS          LOADED TIME
heapster         1               publisher       false           loaded          Fri, 09 Sep 2016 17:09:50 UTC
docker           8               collector       false           loaded          Fri, 09 Sep 2016 17:09:56 UTC
cassandra        3               collector       false           loaded          Fri, 09 Sep 2016 17:10:01 UTC
passthru         1               processor       false           loaded          Fri, 09 Sep 2016 17:09:41 UTC
influx           15              publisher       false           loaded          Fri, 09 Sep 2016 17:09:46 UTC
candysmurf commented 8 years ago

@zachary-trudo, thanks for showing me how you ran into this error. I think the current plugin requires a global config and when it's not specified, it gave you this. I'll change it to use task manifest and let you know by the early next week.

obourdon commented 8 years ago

@zachary-trudo your problem is indeed that there is no server defined in the config file

time="2016-09-10T08:21:36+02:00" level=debug msg="2016/09/10 08:21:36 Cannot find server in Global Config" _module=plugin-exec io=stderr plugin=snap-plugin-collector-elasticsearch time="2016-09-10T08:21:36+02:00" level=error msg="error in getting metric types" _block=load-plugin _module=control-plugin-mgr error="unexpected EOF" plugin-type=collector

the other problem is that this is not explicitly exposed as an error message from the plugin due to this issue in the snap framework but I have had the issue a few months back when I first tried the elasticsearch collector plugin and when plugins had their own log files

I think that it is wrong to require a plugin to be somehow "configured" at load time, meaning having to specify remote endpoint even though I understand this is a way to retrieve exposed metrics In order to solve your issue, please adapt the example file examples/cfg/snap-config-sample.json in this repository, the use it or merge it into your snapd configuration file and re-launch snapd using the --config es.cfg additional cmd line option. Plugin should load properly after this

HTH

candysmurf commented 8 years ago

@obourdon, thanks for the confirmation. The metric types are dynamically collected instead of statically hardcoded that's why it needs the config at the load time. As types most likely won't be changed for a giving version, I'll push an enhancement for it today. You all are welcome to review it. thanks.