Monitor urls with Windows Authentication

Hi,

I am using heartbeat 6.4.0
I am trying to monitor an https url, below is my configuration:

heartbeat.monitors:
- type: http
  urls:
    - https://myurl.company.com/
  schedule: '@every 5m'
  username: user
  password: pass

In the kibana, I can see I am getting monitor.status as down since error.message is 401 Unauthorized

Above url asks for username and password after I load it in the browser. But the username and password option is not working or may be I am not configuring it correctly.

Can anyone guide here?

Hi @aviral_srivastava, can you cURL the url with the creds and check if they work there?

I curled the url and this is what I got.

curl --user "user:pass" https://myurl.company.com/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>401 - Unauthorized: Access is denied due to invalid credentials.</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}
fieldset{padding:0 15px 10px 15px;}
h1{font-size:2.4em;margin:0;color:#FFF;}
h2{font-size:1.7em;margin:0;color:#CC0000;}
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;
background-color:#555555;}
#content{margin:0 0 0 2%;position:relative;}
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
 <div class="content-container"><fieldset>
  <h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
  <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>
 </fieldset></div>
</div>
</body>
</html>

Also, I made one mistake, it is windows Authentication not basic Authentication.

We currently don't support NTLM authentication in heartbeat.

There have been few requests to support NTLM and other enterprise auths but not enough to include the feature request in the roadmap. A similar discussion can be found here.

If it's possible to upgrade the stack to 7.17 or better 8.2, a browser monitor (which uses Elastic Synthetics Agent) could be used to get through such authentication by writing a simple javascript. Please see.

Also worth reading the blog post on synthetics monitoring.