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['ipaddress']}:9200/_cluster/health?pretty=true"
6 curl_command = "http://localhost:9200/_cluster/health?pretty=true"
7 resp = Net::HTTP.get_response URI.parse(curl_command)
8 stat = JSON.parse(resp.read_body)['status']
12 printf("\033[32m%s\n\033[0m", " ElasticSearch Cluster status is green.")
14 printf("\033[33m%s\n\033[0m", " ElasticSearch Cluster status is yellow...")
16 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://localhost:9200/_template/resources_template