noxdafox / rabbitmq-cloudwatch-exporter

RabbitMQ Plugin for publishing cluster metrics to AWS CloudWatch
Mozilla Public License 2.0
41 stars 9 forks source link

Call to undefined function crypto:hmac #34

Closed Sonic0 closed 3 years ago

Sonic0 commented 3 years ago

Hello everyone! I'm trying this awesome RabbitMQ Plugin, but I have been having a problem with a call to undefined function crypto:hmac.

RabbitMQ version: 3.8.18 Erlang/OTP version: 24 rabbitmq-cloudwatch-exporter version: 1.0.0

Plugin section in rabbitmq.conf:

cloudwatch_exporter.aws.access_key_id = "ACCESS_KEY_XXXXX"
cloudwatch_exporter.aws.secret_access_key = "SECRET_KEY_XXXXX"
cloudwatch_exporter.aws.region="eu-west-1"
cloudwatch_exporter.metrics.overview.enable = true
cloudwatch_exporter.metrics.vhost.enable = true
cloudwatch_exporter.metrics.node.enable = false

The error in rabbitmq log:

2021-06-30 [error] <0.734.0> ** Generic server rabbitmq_cloudwatch_exporter terminating
** Last message in was export_metrics
** When Server state == [{aws,[{secret_access_key,<<"SECRET_KEY_XXXXXX">>},{access_key_id,<<"ACCESS_KEY_XXXXXX">>},{region,<<"eu-west-1">>}]},{period,60},{resolution,60},{namespace,<<"RabbitMQ">>},{collectors,[{overview,[]},{vhost,[]}]}]
** Reason for termination ==
** {'function not exported',[{crypto,hmac,[sha256,[<<"AWS4">>,<<"SECRET_KEY_XXXXXX">>],[<<"2021">>,<<"06">>,<<"30">>]],[]},{'Elixir.ExAws.Auth.Signatures',signing_key,3,[{file,"lib/ex_aws/auth/signatures.ex"},{line,14}]},{'Elixir.ExAws.Auth.Signatures',generate_signature_v4,4,[{file,"lib/ex_aws/auth/signatures.ex"},{line,7}]},{'Elixir.ExAws.Auth',auth_header,7,[{file,"lib/ex_aws/auth.ex"},{line,129}]},{'Elixir.ExAws.Auth',headers,6,[{file,"lib/ex_aws/auth.ex"},{line,45}]},{'Elixir.ExAws.Request',request_and_retry,7,[{file,"lib/ex_aws/request.ex"},{line,29}]},{'Elixir.ExAws.Operation.ExAws.Operation.Query',perform,2,[{file,"lib/ex_aws/operation/query.ex"},{line,33}]},{'Elixir.RabbitMQCloudWatchExporter.Exporter','-export_metrics/3-fun-0-',3,[{file,"lib/rabbitmq_cloudwatch_exporter/exporter.ex"},{line,146}]}]}

2021-06-30 [error] <0.734.0> CRASH REPORT Process <0.734.0> with 1 neighbours crashed with reason: call to undefined function crypto:hmac(sha256, [<<"AWS4">>,<<"SECRET_KEY_XXXXXX">>], [<<"2021">>,<<"06">>,<<"30">>])

2021-06-30 [error] <0.728.0> Supervisor 'Elixir.Singleton.Supervisor' had child 'Elixir.Singleton.Manager' started with 'Elixir.Singleton.Manager':start_link('Elixir.RabbitMQCloudWatchExporter.Exporter', [], rabbitmq_cloudwatch_exporter, 'singleton_0bpF3SXqPATXc25tAf+lu5E9sgN') at <0.733.0> exit with reason call to undefined function crypto:hmac(sha256, [<<"AWS4">>,<<"SECRET_KEY_XXXXXX">>], [<<"2021">>,<<"06">>,<<"30">>]) in context child_terminated

2021-06-30 [error] <0.731.0> CRASH REPORT Process <0.731.0> with 0 neighbours exited with reason: call to undefined function crypto:hmac(sha256, [<<"AWS4">>,<<"SECRET_KEY_XXXXXX">>], [<<"2021">>,<<"06">>,<<"30">>]) in application_master:terminate/2 line 236

2021-06-30 [info] <0.44.0> Application rabbitmq_cloudwatch_exporter exited with reason: call to undefined function crypto:hmac(sha256, [<<"AWS4">>,<<"SECRET_KEY_XXXXXX">>], [<<"2021">>,<<"06">>,<<"30">>])

Thanks for the help.

Sonic0 commented 3 years ago

I found the problem, that is Erlang 24. Installing Erlang 23.3.1 this plugin work. At this time no problem installing Erlang 23, but in the future might be problems. Thanks

noxdafox commented 3 years ago

Apologies for the late reply.

It seems Erlang deprecated a series of crypto functions in release 24. https://erlang.org/doc/general_info/deprecations.html#otp-23

As ex_aws already fixed the issue in v2.1.7 I will make soon a new release.

Sonic0 commented 3 years ago

Apologies for the late reply.

No problem, this is the OpenSource :satisfied: . I have been using Erlang 23.3.X and this plugin working fine.

As ex_aws already fixed the issue in v2.1.7 I will make soon a new release.

:heart_eyes: Thank you very much.

Ciao

pbudzon commented 3 years ago

It would be great if we could have the new release please, we only have erlang 24 in the repository and cannot use this plugin as such :(

noxdafox commented 3 years ago

Updated ez_aws binary in the release (1.0.0) assets. This should fix the issue. Please re-open this ticket if not.

soro1987 commented 2 years ago

@Sonic0 Thanks bro you'r a Boss !!!