[18/50] [abbrv] metron git commit: METRON-1462: Separate ES and Kibana from Metron Mpack (mmiklavc via mmiklavc) closes apache/metron#943
METRON-1462: Separate ES and Kibana from Metron Mpack (mmiklavc via mmiklavc) closes apache/metron#943 Project: http://git-wip-us.apache.org/repos/asf/metron/repo Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/0ab39a32 Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/0ab39a32 Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/0ab39a32 Branch: refs/heads/feature/METRON-1090-stellar-assignment Commit: 0ab39a32b61104812a6a9e69e999e7053e3e7e90 Parents: 0d847cf Author: mmiklavcAuthored: Thu Apr 5 09:07:48 2018 -0600 Committer: Michael Miklavcic Committed: Thu Apr 5 09:07:48 2018 -0600 -- .../roles/ambari_master/defaults/main.yml | 2 + .../ambari_master/tasks/elasticsearch_mpack.yml | 26 ++ .../ansible/roles/ambari_master/tasks/main.yml | 3 +- .../roles/ambari_master/tasks/metron_mpack.yml | 26 ++ .../ansible/roles/ambari_master/tasks/mpack.yml | 26 -- .../roles/load_web_templates/tasks/main.yml | 2 +- .../manual-install/Manual_Install_CentOS6.md| 4 +- metron-deployment/packaging/ambari/README.md| 25 +- .../ambari/elasticsearch-mpack/README.md| 62 + .../ambari/elasticsearch-mpack/pom.xml | 95 +++ .../src/main/assemblies/elasticsearch-mpack.xml | 43 +++ .../ELASTICSEARCH/5.6.2/metainfo.xml| 29 ++ .../ELASTICSEARCH/5.6.2/repos/repoinfo.xml | 45 .../addon-services/KIBANA/5.6.2/metainfo.xml| 30 +++ .../KIBANA/5.6.2/quicklinks/quicklinks.json | 27 ++ .../KIBANA/5.6.2/repos/repoinfo.xml | 60 + .../5.6.2/configuration/elastic-env.xml | 86 ++ .../5.6.2/configuration/elastic-jvm-options.xml | 144 ++ .../5.6.2/configuration/elastic-site.xml| 198 ++ .../5.6.2/configuration/elastic-sysconfig.xml | 97 +++ .../5.6.2/configuration/elastic-systemd.xml | 30 +++ .../ELASTICSEARCH/5.6.2/metainfo.xml| 97 +++ .../5.6.2/package/scripts/elastic_commands.py | 266 +++ .../5.6.2/package/scripts/elastic_master.py | 72 + .../5.6.2/package/scripts/elastic_slave.py | 71 + .../5.6.2/package/scripts/params.py | 108 .../5.6.2/package/scripts/properties_config.py | 34 +++ .../5.6.2/package/scripts/service_check.py | 114 .../5.6.2/package/scripts/status_params.py | 27 ++ .../templates/elasticsearch.master.yaml.j2 | 77 ++ .../templates/elasticsearch.slave.yaml.j2 | 78 ++ .../templates/elasticsearch_limits.conf.j2 | 20 ++ .../5.6.2/quicklinks/quicklinks.json| 43 +++ .../ELASTICSEARCH/5.6.2/role_command_order.json | 8 + .../KIBANA/5.6.2/configuration/kibana-env.xml | 72 + .../KIBANA/5.6.2/configuration/kibana-site.xml | 113 .../common-services/KIBANA/5.6.2/metainfo.xml | 84 ++ .../KIBANA/5.6.2/package/scripts/common.py | 56 .../5.6.2/package/scripts/kibana_master.py | 81 ++ .../KIBANA/5.6.2/package/scripts/params.py | 50 .../KIBANA/5.6.2/quicklinks/quicklinks.json | 28 ++ .../src/main/resources/mpack.json | 76 ++ .../packaging/ambari/metron-mpack/README.md | 20 +- .../src/main/assemblies/metron-mpack.xml| 14 - .../ELASTICSEARCH/5.6.2/metainfo.xml| 29 -- .../ELASTICSEARCH/5.6.2/repos/repoinfo.xml | 45 .../addon-services/KIBANA/5.6.2/metainfo.xml| 30 --- .../KIBANA/5.6.2/quicklinks/quicklinks.json | 27 -- .../KIBANA/5.6.2/repos/repoinfo.xml | 60 - .../5.6.2/configuration/elastic-env.xml | 86 -- .../5.6.2/configuration/elastic-jvm-options.xml | 144 -- .../5.6.2/configuration/elastic-site.xml| 198 -- .../5.6.2/configuration/elastic-sysconfig.xml | 97 --- .../5.6.2/configuration/elastic-systemd.xml | 30 --- .../ELASTICSEARCH/5.6.2/metainfo.xml| 97 --- .../5.6.2/package/scripts/elastic_commands.py | 266 --- .../5.6.2/package/scripts/elastic_master.py | 72 - .../5.6.2/package/scripts/elastic_slave.py | 71 - .../5.6.2/package/scripts/params.py | 108 .../5.6.2/package/scripts/properties_config.py | 34 --- .../5.6.2/package/scripts/service_check.py | 114 .../5.6.2/package/scripts/status_params.py | 27 -- .../templates/elasticsearch.master.yaml.j2 | 77 -- .../templates/elasticsearch.slave.yaml.j2 | 78 -- .../templates/elasticsearch_limits.conf.j2 | 20 -- .../5.6.2/quicklinks/quicklinks.json| 43 --- .../ELASTICSEARCH/5.6.2/role_command_order.json | 8 - .../KIBANA/5.6.2/configuration/kibana-env.xml | 72 - .../KIBANA/5.6.2/configuration/kibana-site.xml | 113
[18/50] [abbrv] metron git commit: METRON-1462: Separate ES and Kibana from Metron Mpack (mmiklavc via mmiklavc) closes apache/metron#943
http://git-wip-us.apache.org/repos/asf/metron/blob/0ab39a32/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/dashboard/dashboardindex.py -- diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/dashboard/dashboardindex.py b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/dashboard/dashboardindex.py new file mode 100755 index 000..f0903ac --- /dev/null +++ b/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/dashboard/dashboardindex.py @@ -0,0 +1,95 @@ +#!/usr/bin/python +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from elasticsearch import Elasticsearch +from elasticsearch.helpers import bulk +import cPickle as pickle +import argparse, sys, os.path +import errno +import os + + +class DashboardIndex(object): + +def __init__(self, host='localhost', port=9200, url_prefix='', timeout=10, **kwargs): +""" +:arg host: hostname of the node (default: localhost) +:arg port: port to use (integer, default: 9200) +:arg url_prefix: optional url prefix for elasticsearch +:arg timeout: default timeout in seconds (float, default: 10) +""" +self.es = Elasticsearch([{'host':host,'port': port, 'url_prefix': url_prefix, 'timeout':timeout}]) + +def get(self): +""" +Get .kibana index from Elasticsearch +""" +dotkibana = self.es.search(index='.kibana', size = 100) +return dotkibana['hits']['hits'] + +def load(self,filespec): +""" +Save Index data on local filesystem +:args filespec: path/filename for saved file +""" +data=[] +with open(filespec,'rb') as fp: +data = pickle.load(fp) +return data + +def save(self,filename,data): +""" +Save Index data on local filesystem +:args filespec: path/filename for saved file +""" +with open(filename,'wb') as fp: +pickle.dump(data,fp) + +def put(self,data): +""" +Bulk write data to Elasticsearch +:args data: data to be written (note: index name is specified in data) +""" +bulk(self.es,data) + +def main(self,args): + +if args.save: +print("running save with host:%s on port %d, filespec: %s" % (args.hostname, args.port, args.filespec)) +self.save(filename=args.filespec,data=di.get()) +else: +""" +Loads Kibana Dashboard definition from disk and replaces .kibana on index +:args filespec: path/filename for saved file +""" +if not os.path.isfile(args.filespec): +raise IOError( +errno.ENOENT, os.strerror(errno.ENOENT), args.filespec) +self.es.indices.delete(index='.kibana', ignore=[400, 404]) +self.put(data=di.load(filespec=args.filespec)) + +if __name__ == '__main__': + +parser = argparse.ArgumentParser() +parser.add_argument("hostname", help="ES Hostname or IP", type=str) +parser.add_argument("port", help="ES Port", type=int) +parser.add_argument("filespec", help="file to be pushed from or saved to", type=str) +parser.add_argument("-s","--save", help="run in SAVE mode - .kibana will be read and saved to filespec",action="store_true") +args = parser.parse_args() +di = DashboardIndex(host=args.hostname,port=args.port) +di.main(args) http://git-wip-us.apache.org/repos/asf/metron/blob/0ab39a32/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/dashboard/kibana.template -- diff --git a/metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/dashboard/kibana.template