# Some questions about Uptime ML Integration

**URL:** <https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622>\
**Category:** Synthetics\
**Tags:** elastic-stack-machine-learning\
**Created:** [September 23, 2020, 8:40am UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622 "2020-09-23T08:40:01Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 23, 2020, 8:40am UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/1 "2020-09-23T08:40:01Z")

</div>

Hello,

Really like the Uptime ML integration, but:

- Requiring us to enable ML for each uptime monitor separately is kind of a lot of manual work and clicking / verifying when you have 100's of monitors.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/9/89a4f77c91b27f2dc26d45e70a69cdfe5eddac13.png)

Is there a way to enable the ML integration for all monitors (or all monitors with a certain tag) at once?

- Currently the Uptime ML integration is one of the few where it is not possible to set a prefix for the job. The result is the uptime ml jobs kind of clutter up the ML job management overview. Again, I could clone each job separately and configure a prefix myself, but this too is a long manual process.

Pls let me know the above features are worthy of a GH feature request and I'll make them.

Grtz

Willem

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 23, 2020, 9:14am UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/2 "2020-09-23T09:14:11Z")

</div>

@willemdh i am glad you like it. Yes we are looking for some feedback on the feature actually, and would be glad to consider a GH feature request.

Both the features, enabling job for all monitors and setting prefix are interesting and we have considered them, it's just a matter of priority.

Regards

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 23, 2020, 10:05am UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/3 "2020-09-23T10:05:56Z")

</div>

@shahzad31See:

> <https://github.com/elastic/kibana/issues/78263>
>
> Enabling ML for each uptime monitor separately is kind of a lot of manual work and clicking / verifying when you...

  

> <https://github.com/elastic/kibana/issues/78264>
>
> Currently enabling ML for Uptime monitors does not provide a way to add a custom job name prefix. Most other ML...

Thanks!

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 24, 2020, 3:14pm UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/4 "2020-09-24T15:14:28Z")

</div>

@shahzad31

More questions 🙂

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/6/a6cba45a7b86f41edeffb449ff2cf04274f7b68a.png)

I seem unable to clone the uptime jobs? Datafeed is stopped and job is closed. Is this expected?

Other stopped / closed jobs are clonable. How is the relationship between Uptime and their ML jobs created? Could I manually create an ml job which is linked to an uptime monitor?

Grtz

Willem

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 24, 2020, 3:56pm UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/5 "2020-09-24T15:56:04Z")

</div>

@willemdh  
The most common reason for not being able to clone an ML job is that we cannot find a matching kibana index pattern.

Can you create an index pattern for heartbeat-\* manually, i mentioned the method in another issue. [Missing index pattern heartbeat-\*](https://discuss.elastic.co/t/missing-index-pattern-heartbeat/247394/3)

After that you should be able to clone it. Btw why you want to clone it? if job is stopped, you can delete it and recreate it from uptime UI again.

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 24, 2020, 4:29pm UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/6 "2020-09-24T16:29:59Z")

</div>

@shahzad31 I'm trying to finetune these uptime ml jobs a bit and giving them the correct prefix in the meantime. Also I might try to script creation of the Uptime ML jobs. I can clone other (non-uptime- jobs without an issue. I definitely have a heartbeat-\* index pattern, so that shouldn't be the issue.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/8/58abb04f69d042fd64316f343e6ddb57e2aeef95.png)

How does Uptime know there is an ml job for the related uptime monitor?

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 24, 2020, 4:43pm UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/7 "2020-09-24T16:43:15Z")

</div>

I will have to take a look at code to give you a definite answer but I think uptime monitor Id is used in ml job id.

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 24, 2020, 4:48pm UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/8 "2020-09-24T16:48:41Z")

</div>

@willemdh ok so monitorId is inserted in prefix

 ![Screenshot_20200924-184609_GitHub](https://us1.discourse-cdn.com/elastic/original/3X/1/e/1e0ca27d9ae31afa7b30853d25ce7a15f48d34e1.jpeg)

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 24, 2020, 4:50pm UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/9 "2020-09-24T16:50:46Z")

</div>

Hmm the id of the ml job seems to be the name with https stripped and dots replaced with underscores.

For example one monitor:

> **[Zoek een rustplaats | begraafplaatsen.gent.be](https://begraafplaatsen.stad.gent)**

has `begraafplaatsen_stad_gent_high_latency_by_geo`

as ml job id.

Does this imply I cannot create an Uptime ML job with a custom prefix or the Uptime monitor would never pick it up?

Still can't clone, is it possible the Uptime ML jobs have been made 'immutable' in some way?

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 24, 2020, 5:04pm UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/10 "2020-09-24T17:04:51Z")

</div>

Yes you are right, it's not a simple monitorID there is a special function which formats it a bit to remove special characters etc

I don't know how much JavaScript is you know this might be helpful

> <https://github.com/elastic/kibana/blob/master/x-pack/plugins/uptime/common/lib/ml.ts>

Also job should be created inside uptime ml module in ml app. Because that's how it queries the jobs and then matches job id against formatting monitorId again

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 25, 2020, 6:53am UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/11 "2020-09-25T06:53:16Z")

</div>

Thanks for clarifying @shahzad31

> Also job should be created inside uptime ml module in ml app

I guess automating the process won't be easy if this needs to be done with Javascript from inside uptime ml module. I was hoping to just use the rest api [Create anomaly detection jobs API | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html)

They way it's currently implemented is not very automatable.. 🙃

Which imho is kind of weird in these times.

Grtz

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 25, 2020, 8:09am UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/12 "2020-09-25T08:09:09Z")

</div>

No i didn't meant to say that @willemdh i just meant that it should use preconfigured uptime ml job

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/4/c45f7ea7961287e4ef3cd82bdfcea0aa7540270e.png)

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 25, 2020, 8:33am UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/13 "2020-09-25T08:33:06Z")

</div>

@willemdh i think i figured out a reason why you can't clone uptime jobs, you need to create a more specific index pattern for heartbeat. Like it should be `heartbeat-7*` instead of `heartbeat-*`

let me know if that helps, also check this jsfilled [https://jsfiddle.net/zx7ogybp/](https://jsfiddle.net/zx7ogybp/)

you can use this to get ml job id from monitorid, that's what uptime ui will expect as ML Job Id.  
Just end monitor name at end like 'android-homepage' and hit run.

Also once you clone job, make sure to add these filters for a specific monitor data, otherwise job will run on whole index

```
    filter: [
      { term: { 'monitor.id': monitorId } },
      { range: { 'monitor.duration.us': { gt: 0 } } },
    ],

```

Regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 23, 2020, 8:33am UTC](https://discuss.elastic.co/t/some-questions-about-uptime-ml-integration/249622/14 "2020-10-23T08:33:08Z")

</div>

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