Heartbeat : Panic error using SSL Verification_mode None

Hi everyone,
I'm using Heartbeat 7.13.1 on Debian 9.13.
I setup monitors like this one :

heartbeat.monitors:
- type: http
  enabled: true
  id: anId
  name: aName
  urls: ["https//private.fr:59862"]
  schedule: '@every 10s'
  check.response.status: 200
  ssl.verification_mode: none

However, while starting Heartbeat with "heartbeat run -e" after the first event, i got this error and I don't understand why :

2021-06-18T15:53:56.395+0200    FATAL   [heartbeat]     instance/beat.go:171    
Failed due to panic.   
{
    "panic": "runtime error: invalid memory address or nil pointer dereference", 
    "stack": "github.com/elastic/beats/v7/libbeat/cmd/instance.Run.func1.1\n\t/go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:172\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:969\nruntime.panicmem\n\t/usr/local/go/src/runtime/panic.go:212\nruntime.sigpanic\n\t/usr/local/go/src/runtime/signal_unix.go:742\ngithub.com/elastic/beats/v7/heartbeat/monitors/active/http.
             (*Config).Validate.func1\n\t/go/src/github.com/elastic/beats/heartbeat/monitors/active/http/config.go:172\ngithub.com/elastic/beats/v7/heartbeat/monitors/active/http.
             (*Config).Validate\n\t/go/src/github.com/elastic/beats/heartbeat/monitors/active/http/config.go:185\ngithub.com/elastic/go-ucfg.tryValidate\n\t/go/pkg/mod/github.com/elastic/go-ucfg@v0.8.3/validator.go:127\ngithub.com/elastic/go-ucfg.reifyStruct\n\t/go/pkg/mod/github.com/elastic/go-ucfg@v0.8.3/reify.go:292\ngithub.com/elastic/go-ucfg.reifyInto\n\t/go/pkg/mod/github.com/elastic/go-ucfg@v0.8.3/reify.go:172\ngithub.com/elastic/go-ucfg.
             (*Config).Unpack\n\t/go/pkg/mod/github.com/elastic/go-ucfg@v0.8.3/reify.go:155\ngithub.com/elastic/beats/v7/libbeat/common.
             (*Config).Unpack\n\t/go/src/github.com/elastic/beats/libbeat/common/config.go:186\ngithub.com/elastic/beats/v7/heartbeat/monitors/active/http.create\n\t/go/src/github.com/elastic/beats/heartbeat/monitors/active/http/http.go:47\ngithub.com/elastic/beats/v7/heartbeat/monitors/plugin.
             (*PluginFactory).Create\n\t/go/src/github.com/elastic/beats/heartbeat/monitors/plugin/plugin.go:164\ngithub.com/elastic/beats/v7/heartbeat/monitors.newMonitorUnsafe\n\t/go/src/github.com/elastic/beats/heartbeat/monitors/monitor.go:160\ngithub.com/elastic/beats/v7/heartbeat/monitors.newMonitor\n\t/go/src/github.com/elastic/beats/heartbeat/monitors/monitor.go:105\ngithub.com/elastic/beats/v7/heartbeat/monitors.
             (*RunnerFactory).Create\n\t/go/src/github.com/elastic/beats/heartbeat/monitors/factory.go:79\ngithub.com/elastic/beats/v7/heartbeat/beater.
             (*Heartbeat).RunStaticMonitors\n\t/go/src/github.com/elastic/beats/heartbeat/beater/heartbeat.go:132\ngithub.com/elastic/beats/v7/heartbeat/beater.
             (*Heartbeat).Run\n\t/go/src/github.com/elastic/beats/heartbeat/beater/heartbeat.go:85\ngithub.com/elastic/beats/v7/libbeat/cmd/instance.
             (*Beat).launch\n\t/go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:479\ngithub.com/elastic/beats/v7/libbeat/cmd/instance.Run.func1\n\t/go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:196\ngithub.com/elastic/beats/v7/libbeat/cmd/instance.Run\n\t/go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:197\ngithub.com/elastic/beats/v7/libbeat/cmd.genRunCmd.func1\n\t/go/src/github.com/elastic/beats/libbeat/cmd/run.go:36\ngithub.com/spf13/cobra.
             (*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830\ngithub.com/spf13/cobra.
             (*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914\ngithub.com/spf13/cobra.
             (*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864\nmain.main\n\t/go/src/github.com/elastic/beats/x-pack/heartbeat/main.go:16\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:204"
} 

If I delete the line ssl.verification_mode: none this error disappear but since Heartbeat can't resolve of certificate, the service that I want to monitor is considered as "Down".

I did try to run Heartbeat test config to check the configuration, but it said "Config OK".

Does someone know what I'm doing wrong ?
Thanks you in advance for your help. :slight_smile:

You found a bug! I've opened an issue here: [Heartbeat] Fix null pointer in per-monitor SSL setting · Issue #26391 · elastic/beats · GitHub the fix should be pretty simple, see the PR linked to the issue.

In the meantime there is a workaround, simply add ssl.enabled: true to your monitor config.

Thanks for letting us know!

Thanks for your quick answer :slight_smile:

I will try your solution and keep you informed.

Thanks for your help ! :smiley:

It works perfectly :slight_smile:

This was fixed in https://github.com/elastic/beats/pull/25219 which will most likely land in 7.14.0

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.