1 ruby_block "check_ElasticSearch_Cluster_Health" do
3 #tricky way to load this Chef::Mixin::ShellOut utilities
4 Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
5 curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true"
6 resp = Net::HTTP.get_response URI.parse(curl_command)
7 stat = JSON.parse(resp.read_body)['status']
11 printf("\033[32m%s\n\033[0m", " ElasticSearch Cluster status is green.")
13 printf("\033[33m%s\n\033[0m", " ElasticSearch Cluster status is yellow...")
15 printf("\033[31m%s\n\033[0m", " ElasticSearch Cluster status is red!")
23 bash "create resources mapping" do
25 curl -i -X PUT -d '{ "order": 1, "template": "resources", "settings": {}, "mappings":
29 "id": { "include_in_all": true, "index": "not_analyzed", "type": "string" },
30 "data": { "include_in_all": false, "type": "string" }
32 "_all": { "enabled": true }
35 }' http://#{node['Nodes']['ES']}:9200/_template/resources_template