Consul register script check via API not working
up vote
0
down vote
favorite
I am using chef to run a bash command that would register a script health check with consul and I am getting the below error with my example code. I tried looking at the docs but it will not seem to work out for me. Suggestions on what might be wrong?
I am wanting to iu
Error message
================================================================================
Error executing action `run` on resource 'bash[register_init_checks]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20181110-4847-1tg4kmv" ----
STDOUT:
STDERR: /tmp/chef-script20181110-4847-1tg4kmv: line 1: [/work-disk/consul/data/mem-check.sh],: No such file or directory
---- End output of "bash" "/tmp/chef-script20181110-4847-1tg4kmv" ----
Ran "bash" "/tmp/chef-script20181110-4847-1tg4kmv" returned 1
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/consul/recipes/default.rb
190: bash 'register_init_checks' do
191: code <<-EOH
192: curl --request PUT --data #mem_check http://127.0.0.1:8500/v1/agent/check/register
193: EOH
194: action :run
195: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/consul/recipes/default.rb:190:in `from_file'
bash("register_init_checks") do
action [:run]
default_guard_interpreter :default
command nil
backup 5
interpreter "bash"
declared_type :bash
cookbook_name "consul"
recipe_name "default"
user nil
code " curl --request PUT --data "check"=>"id"=>"mem-check", "name"=>"Memory utilization", "args"=>["/work-disk/consul/data/mem-check.sh"], "interval"=>"10s", "timeout"=>"1s" http://127.0.0.1:8500/v1/agent/check/registern"
domain nil
end
System Info:
------------
chef_version=14.7.17
platform=ubuntu
platform_version=16.04
ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
program_name=/usr/bin/chef-client
Chef code I am trying to use
cookbook_file consul_data + '/mem-check.sh' do
source 'mem-check.sh'
owner consul_user
group consul_user
mode '0755'
action :create
end
mem_check =
"check" =>
"id" => "mem-check",
"name" => "Memory utilization",
"args" => [consul_data + "/mem-check.sh"],
"interval" => "10s",
"timeout" => "1s"
bash 'register_init_checks' do
code <<-EOH
curl --request PUT --data #mem_check http://127.0.0.1:8500/v1/agent/check/register
EOH
action :run
end
consul
add a comment |
up vote
0
down vote
favorite
I am using chef to run a bash command that would register a script health check with consul and I am getting the below error with my example code. I tried looking at the docs but it will not seem to work out for me. Suggestions on what might be wrong?
I am wanting to iu
Error message
================================================================================
Error executing action `run` on resource 'bash[register_init_checks]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20181110-4847-1tg4kmv" ----
STDOUT:
STDERR: /tmp/chef-script20181110-4847-1tg4kmv: line 1: [/work-disk/consul/data/mem-check.sh],: No such file or directory
---- End output of "bash" "/tmp/chef-script20181110-4847-1tg4kmv" ----
Ran "bash" "/tmp/chef-script20181110-4847-1tg4kmv" returned 1
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/consul/recipes/default.rb
190: bash 'register_init_checks' do
191: code <<-EOH
192: curl --request PUT --data #mem_check http://127.0.0.1:8500/v1/agent/check/register
193: EOH
194: action :run
195: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/consul/recipes/default.rb:190:in `from_file'
bash("register_init_checks") do
action [:run]
default_guard_interpreter :default
command nil
backup 5
interpreter "bash"
declared_type :bash
cookbook_name "consul"
recipe_name "default"
user nil
code " curl --request PUT --data "check"=>"id"=>"mem-check", "name"=>"Memory utilization", "args"=>["/work-disk/consul/data/mem-check.sh"], "interval"=>"10s", "timeout"=>"1s" http://127.0.0.1:8500/v1/agent/check/registern"
domain nil
end
System Info:
------------
chef_version=14.7.17
platform=ubuntu
platform_version=16.04
ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
program_name=/usr/bin/chef-client
Chef code I am trying to use
cookbook_file consul_data + '/mem-check.sh' do
source 'mem-check.sh'
owner consul_user
group consul_user
mode '0755'
action :create
end
mem_check =
"check" =>
"id" => "mem-check",
"name" => "Memory utilization",
"args" => [consul_data + "/mem-check.sh"],
"interval" => "10s",
"timeout" => "1s"
bash 'register_init_checks' do
code <<-EOH
curl --request PUT --data #mem_check http://127.0.0.1:8500/v1/agent/check/register
EOH
action :run
end
consul
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using chef to run a bash command that would register a script health check with consul and I am getting the below error with my example code. I tried looking at the docs but it will not seem to work out for me. Suggestions on what might be wrong?
I am wanting to iu
Error message
================================================================================
Error executing action `run` on resource 'bash[register_init_checks]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20181110-4847-1tg4kmv" ----
STDOUT:
STDERR: /tmp/chef-script20181110-4847-1tg4kmv: line 1: [/work-disk/consul/data/mem-check.sh],: No such file or directory
---- End output of "bash" "/tmp/chef-script20181110-4847-1tg4kmv" ----
Ran "bash" "/tmp/chef-script20181110-4847-1tg4kmv" returned 1
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/consul/recipes/default.rb
190: bash 'register_init_checks' do
191: code <<-EOH
192: curl --request PUT --data #mem_check http://127.0.0.1:8500/v1/agent/check/register
193: EOH
194: action :run
195: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/consul/recipes/default.rb:190:in `from_file'
bash("register_init_checks") do
action [:run]
default_guard_interpreter :default
command nil
backup 5
interpreter "bash"
declared_type :bash
cookbook_name "consul"
recipe_name "default"
user nil
code " curl --request PUT --data "check"=>"id"=>"mem-check", "name"=>"Memory utilization", "args"=>["/work-disk/consul/data/mem-check.sh"], "interval"=>"10s", "timeout"=>"1s" http://127.0.0.1:8500/v1/agent/check/registern"
domain nil
end
System Info:
------------
chef_version=14.7.17
platform=ubuntu
platform_version=16.04
ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
program_name=/usr/bin/chef-client
Chef code I am trying to use
cookbook_file consul_data + '/mem-check.sh' do
source 'mem-check.sh'
owner consul_user
group consul_user
mode '0755'
action :create
end
mem_check =
"check" =>
"id" => "mem-check",
"name" => "Memory utilization",
"args" => [consul_data + "/mem-check.sh"],
"interval" => "10s",
"timeout" => "1s"
bash 'register_init_checks' do
code <<-EOH
curl --request PUT --data #mem_check http://127.0.0.1:8500/v1/agent/check/register
EOH
action :run
end
consul
I am using chef to run a bash command that would register a script health check with consul and I am getting the below error with my example code. I tried looking at the docs but it will not seem to work out for me. Suggestions on what might be wrong?
I am wanting to iu
Error message
================================================================================
Error executing action `run` on resource 'bash[register_init_checks]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20181110-4847-1tg4kmv" ----
STDOUT:
STDERR: /tmp/chef-script20181110-4847-1tg4kmv: line 1: [/work-disk/consul/data/mem-check.sh],: No such file or directory
---- End output of "bash" "/tmp/chef-script20181110-4847-1tg4kmv" ----
Ran "bash" "/tmp/chef-script20181110-4847-1tg4kmv" returned 1
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/consul/recipes/default.rb
190: bash 'register_init_checks' do
191: code <<-EOH
192: curl --request PUT --data #mem_check http://127.0.0.1:8500/v1/agent/check/register
193: EOH
194: action :run
195: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/consul/recipes/default.rb:190:in `from_file'
bash("register_init_checks") do
action [:run]
default_guard_interpreter :default
command nil
backup 5
interpreter "bash"
declared_type :bash
cookbook_name "consul"
recipe_name "default"
user nil
code " curl --request PUT --data "check"=>"id"=>"mem-check", "name"=>"Memory utilization", "args"=>["/work-disk/consul/data/mem-check.sh"], "interval"=>"10s", "timeout"=>"1s" http://127.0.0.1:8500/v1/agent/check/registern"
domain nil
end
System Info:
------------
chef_version=14.7.17
platform=ubuntu
platform_version=16.04
ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
program_name=/usr/bin/chef-client
Chef code I am trying to use
cookbook_file consul_data + '/mem-check.sh' do
source 'mem-check.sh'
owner consul_user
group consul_user
mode '0755'
action :create
end
mem_check =
"check" =>
"id" => "mem-check",
"name" => "Memory utilization",
"args" => [consul_data + "/mem-check.sh"],
"interval" => "10s",
"timeout" => "1s"
bash 'register_init_checks' do
code <<-EOH
curl --request PUT --data #mem_check http://127.0.0.1:8500/v1/agent/check/register
EOH
action :run
end
consul
consul
asked Nov 11 at 1:58
Josh Kirby
65
65
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245201%2fconsul-register-script-check-via-api-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown