diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2018-01-24 17:59:53 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-01-25 20:21:27 +0000 |
commit | 38211c83410f610aa889a687fdecebb3fed53f02 (patch) | |
tree | 17c46fdd2a49c97ae87641b7d940f4e998edb08b /sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks | |
parent | 62ae83d66ecdc04ee722f5219aba687873d76760 (diff) |
ES OOM alignment
Change-Id: I986fc13f8e32a103e3868f4da9ffb41631c70201
Issue-ID: SDC-912
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks')
5 files changed, 1 insertions, 386 deletions
diff --git a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb index 854898c1b7..b93ca7310b 100644 --- a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb +++ b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb @@ -1,5 +1,4 @@ clusterName = node['elasticsearch'][:cluster_name]+node.chef_environment -node_name = node[:hostname] template "/usr/share/elasticsearch/config/elasticsearch.yml" do source "ES-elasticsearch.yml.erb" @@ -8,7 +7,7 @@ template "/usr/share/elasticsearch/config/elasticsearch.yml" do mode "0755" variables({ :cluster_name => "#{clusterName}", - :node_name => node_name, + :node_name => node[:hostname], :ES_IP => node['Nodes']['ES'], :num_of_shards => node['elasticsearch'][:num_of_shards], :num_of_replicas => node['elasticsearch'][:num_of_replicas] diff --git a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_3_create_audit_template.rb b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_3_create_audit_template.rb deleted file mode 100644 index 4e8136c626..0000000000 --- a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_3_create_audit_template.rb +++ /dev/null @@ -1,245 +0,0 @@ -ruby_block "check_ElasticSearch_Cluster_Health" do - block do - #tricky way to load this Chef::Mixin::ShellOut utilities - Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - #curl_command = "http://#{node['ipaddress']}:9200/_cluster/health?pretty=true" - curl_command = "http://localhost:9200/_cluster/health?pretty=true" - resp = Net::HTTP.get_response URI.parse(curl_command) - stat = JSON.parse(resp.read_body)['status'] - - case stat - when "green" - printf("\033[32m%s\n\033[0m", " ElasticSearch Cluster status is green.") - when "yellow" - printf("\033[33m%s\n\033[0m", " ElasticSearch Cluster status is yellow...") - when "red" - printf("\033[31m%s\n\033[0m", " ElasticSearch Cluster status is red!") - end - end - retries 10 - retry_delay 2 -end - - -bash "create audit mapping" do - code <<-EOH - curl -i -X PUT -d '{ "order": 1, "template": "auditingevents-*", "settings": {}, "mappings": - { - "distributiondownloadevent": { - "properties": { - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "RESOURCE_URL": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CONSUMER_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" } - }, - "_all": { "enabled": true } - }, - "auditinggetuebclusterevent": { - "properties": { - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CONSUMER_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" } - }, - "_all": { "enabled": true } - }, - "distributionstatusevent": { - "properties": { - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "RESOURCE_URL": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "TOPIC_NAME":{ "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CONSUMER_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" } - }, - "_all": { "enabled": true } - }, - "distributionengineevent": { - "properties": { - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "TOPIC_NAME":{ "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ROLE": { "include_in_all": true, "type": "string" }, - "API_KEY": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "D_ENV": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CONSUMER_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" } - }, - "_all": { "enabled": true } - }, - "useraccessevent": { - "properties": { - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "USER": { "include_in_all": true, "type": "string" } - }, - "_all": { "enabled": true } - }, - "resourceadminevent": { - "properties": { - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "INVARIANT_UUID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CURR_VERSION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CURR_STATE": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "MODIFIER": { "include_in_all": true, "type": "string" }, - "PREV_VERSION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "PREV_STATE": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "RESOURCE_NAME": { "include_in_all": true, "type": "string" }, - "RESOURCE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DPREV_STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DCURR_STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "TOSCA_NODE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "COMMENT": { "include_in_all": true, "type": "string" }, - "ARTIFACT_DATA": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "PREV_ARTIFACT_UUID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CURR_ARTIFACT_UUID": { "include_in_all": true, "index": "not_analyzed", "type": "string" } - }, - "_all": { "enabled": true } - }, - "useradminevent": { - "properties": { - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "USER_AFTER": { "include_in_all": true, "type": "string" }, - "USER_BEFORE": { "include_in_all": true, "type": "string" }, - "MODIFIER": { "include_in_all": true, "type": "string" } - }, - "_all": { "enabled": true } - }, - "distributionnotificationevent": { - "properties": { - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CURR_STATE": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CURR_VERSION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "MODIFIER": { "include_in_all": true, "type": "string" }, - "RESOURCE_NAME": { "include_in_all": true, "type": "string" }, - "RESOURCE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "TOPIC_NAME":{ "include_in_all": true, "index": "not_analyzed", "type": "string" } - }, - "_all": { "enabled": true } - }, - "categoryevent": { - "properties": { - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "MODIFIER": { "include_in_all": true, "type": "string" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CATEGORY_NAME": { "include_in_all": true, "type": "string" }, - "SUB_CATEGORY_NAME": { "include_in_all": true, "type": "string" }, - "GROUPING_NAME": { "include_in_all": true, "type": "string" }, - "RESOURCE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" } - }, - "_all": { "enabled": true } - }, - "authevent": { - "properties": { - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" }, - "DESC": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "URL": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "USER": { "include_in_all": true, "type": "string" }, - "AUTH_STATUS": { "include_in_all": true, "index": "not_analyzed","type": "string" } , - "REALM": { "include_in_all": true, "index": "not_analyzed","type": "string" } - }, - "_all": { "enabled": true } - }, - "consumerevent": { - "properties": { - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "MODIFIER": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "ECOMP_USER": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" } - }, - "_all": { "enabled": true } - }, - "getuserslistevent": { - "properties": { - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "MODIFIER": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DETAILS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" } - }, - "_all": { "enabled": true } - }, - "getcategoryhierarchyevent": { - "properties": { - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "MODIFIER": { "include_in_all": true, "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DETAILS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" } - }, - "_all": { "enabled": true } - }, - "distributiondeployevent": { - "properties": { - "ACTION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "CURR_VERSION": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "DESC": { "include_in_all": true, "type": "string" }, - "DID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "MODIFIER": { "include_in_all": true, "type": "string" }, - "REQUEST_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "RESOURCE_NAME": { "include_in_all": true, "type": "string" }, - "RESOURCE_TYPE": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "SERVICE_INSTANCE_ID": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "STATUS": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "TIMESTAMP": { "include_in_all": true, "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" } - }, - "_all": { "enabled": true } } - }, - "aliases": { "last_3_months": {}}}' http://localhost:9200/_template/audit_template - EOH -end - -bash "set default index for Kibana" do - code <<-EOH - curl -XPUT http://localhost:9200/.kibana/index-pattern/auditingevents-* -d '{"title" : "events-*", "timeFieldName": "TIMESTAMP"}' - curl -XPUT http://localhost:9200/.kibana/config/4.3.3 -d '{"defaultIndex" : "auditingevents-*"}' - EOH -end diff --git a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_4_create_resources_template.rb b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_4_create_resources_template.rb deleted file mode 100644 index 4dc264153d..0000000000 --- a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_4_create_resources_template.rb +++ /dev/null @@ -1,37 +0,0 @@ -ruby_block "check_ElasticSearch_Cluster_Health" do - block do - #tricky way to load this Chef::Mixin::ShellOut utilities - Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - #curl_command = "http://#{node['ipaddress']}:9200/_cluster/health?pretty=true" - curl_command = "http://localhost:9200/_cluster/health?pretty=true" - resp = Net::HTTP.get_response URI.parse(curl_command) - stat = JSON.parse(resp.read_body)['status'] - - case stat - when "green" - printf("\033[32m%s\n\033[0m", " ElasticSearch Cluster status is green.") - when "yellow" - printf("\033[33m%s\n\033[0m", " ElasticSearch Cluster status is yellow...") - when "red" - printf("\033[31m%s\n\033[0m", " ElasticSearch Cluster status is red!") - end - end - retries 10 - retry_delay 2 -end - -bash "create resources mapping" do - code <<-EOH - curl -i -X PUT -d '{ "order": 1, "template": "resources", "settings": {}, "mappings": - { - "esartifactdata": { - "properties": { - "id": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "data": { "include_in_all": false, "type": "string" } - }, - "_all": { "enabled": true } - } - } - }' http://localhost:9200/_template/resources_template - EOH -end
\ No newline at end of file diff --git a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_5_create_monitoring_template.rb b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_5_create_monitoring_template.rb deleted file mode 100644 index 5b1f9f8180..0000000000 --- a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_5_create_monitoring_template.rb +++ /dev/null @@ -1,53 +0,0 @@ -ruby_block "check_ElasticSearch_Cluster_Health" do - block do - #tricky way to load this Chef::Mixin::ShellOut utilities - Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - #curl_command = "http://#{node['ipaddress']}:9200/_cluster/health?pretty=true" - curl_command = "http://localhost:9200/_cluster/health?pretty=true" - resp = Net::HTTP.get_response URI.parse(curl_command) - stat = JSON.parse(resp.read_body)['status'] - - case stat - when "green" - printf("\033[32m%s\n\033[0m", " ElasticSearch Cluster status is green.") - when "yellow" - printf("\033[33m%s\n\033[0m", " ElasticSearch Cluster status is yellow...") - when "red" - printf("\033[31m%s\n\033[0m", " ElasticSearch Cluster status is red!") - end - end - retries 10 - retry_delay 2 -end - -bash "echo status" do - code <<-EOH - echo "DOCKER STARTED" - EOH -end - -bash "create monitoring mapping" do - code <<-EOH - curl -i -X PUT -d '{ "order": 1, "template": "monitoring_events-*", "settings": {}, "mappings": - { - "monitoringevent": { - "properties": { - "hostid": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "hostcpu": { "include_in_all": true, "type": "long" }, - "hostmem": { "include_in_all": true, "type": "double" }, - "hostdisk": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "jvmid": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "jvmcpu": { "include_in_all": true,"type": "long" }, - "jvmmem": { "include_in_all": true, "type": "long" }, - "jvmtnum": { "include_in_all": true, "type": "integer" }, - "appid": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "appstat": { "include_in_all": true, "index": "not_analyzed", "type": "string" }, - "timestamp": { "include_in_all": true, "index": "not_analyzed", "ignore_malformed": false, "format": "yyyy-MM-dd HH:mm:ss.SSS z", "precision_step": 4, "type": "date" } - }, - "_all": { "enabled": true } - } - }, - "aliases": { "last_3_months": {} } - }' http://localhost:9200/_template/monitoring_template - EOH -end diff --git a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_6_create_kibana_dashboard_virtualization.rb b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_6_create_kibana_dashboard_virtualization.rb deleted file mode 100644 index a35c9bec40..0000000000 --- a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_6_create_kibana_dashboard_virtualization.rb +++ /dev/null @@ -1,49 +0,0 @@ -ruby_block "check_ElasticSearch_Cluster_Health" do - block do - #tricky way to load this Chef::Mixin::ShellOut utilities - Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - #curl_command = "http://#{node['ipaddress']}:9200/_cluster/health?pretty=true" - curl_command = "http://localhost:9200/_cluster/health?pretty=true" - resp = Net::HTTP.get_response URI.parse(curl_command) - stat = JSON.parse(resp.read_body)['status'] - - case stat - when "green" - printf("\033[32m%s\n\033[0m", " ElasticSearch Cluster status is green.") - when "yellow" - printf("\033[33m%s\n\033[0m", " ElasticSearch Cluster status is yellow...") - when "red" - printf("\033[31m%s\n\033[0m", " ElasticSearch Cluster status is red!") - end - end - retries 10 - retry_delay 2 -end - -bash "create Kibana dashboard" do - code <<-EOH - for file in /root/chef-solo/cookbooks/sdc-elasticsearch/files/default/dashboard_*.json; do - name=`basename $file .json | awk -F"_" '{print $2}'` - echo "Loading dashboard $name:" - curl -XPUT http://localhost:9200/.kibana/dashboard/$name -d @$file || exit 1 - echo - done - EOH -end - -bash "create Kibana visualization" do - code <<-EOH - for file in /root/chef-solo/cookbooks/sdc-elasticsearch/files/default/visualization_*.json; do - name=`basename $file .json | awk -F"_" '{print $2}'` - echo "Loading visualization $name:" - curl -XPUT http://localhost:9200/.kibana/visualization/$name -d @$file || exit 1 - echo - done - EOH -end - -bash "echo status" do - code <<-EOH - echo "DOCKER STARTED" - EOH -end
\ No newline at end of file |