# Kapacitor: using other data from source measurement window

**URL:** <https://community.influxdata.com/t/kapacitor-using-other-data-from-source-measurement-window/1101>\
**Category:** Kapacitor\
**Created:** [May 30, 2017, 3:53am UTC](https://community.influxdata.com/t/kapacitor-using-other-data-from-source-measurement-window/1101 "2017-05-30T03:53:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![glenndavy](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@glenndavy](https://community.influxdata.com/u/glenndavy)\
**Post date:** [May 30, 2017, 3:53am UTC](https://community.influxdata.com/t/kapacitor-using-other-data-from-source-measurement-window/1101/1 "2017-05-30T03:53:14Z")

</div>

Hi

In the capacitor alert node, to construct a meaningful message. If I don’t use an aggregate or selector like mean, for example like this:

```auto
stream
    |from()
        .measurement(measurement)
        .groupBy(groups)
    |window()
        .period(period)
        .every(frequency)
    |alert()
         .id('{{ .TaskName }}/{{ .Name }}/{{index .Tags "role"}}/instance: {{index .Tags "instance_id"}}')
         .message('{{ .ID }} is at {{ .Level }} has {{ index .Fields "available_percent" }}% of memory available on role: {{ index .Tags "role" }}, on instance {{ index .Tags "instance_id" }}. There is {{ index .Fields "available" }}Mb out of {{ index .Fields "total" }}Mb')
         .crit(lambda: "available_percent" > 1.0)
         .victorOps()

```

I can get access to the other values. However, If I want say the mean over my window, I can’t see how to get this.  
I hoped I could ask for the mean of the stat that I want and then the mean of the other fields, and reference those, for e.g.

```auto
|mean('available')
  as('mean_available)
|mean('total')
  as('mean_total')
|mean('available_percent')
  as('available_percent')

```

but, chaining ‘mean’ doesn’t really make sense, and using ‘show’ I can see errors on the 2nd node, which might be expected.

Any hints?

---

<div class="post-metadata">

**Author:** ![glenndavy](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@glenndavy](https://community.influxdata.com/u/glenndavy)\
**Post date:** [May 30, 2017, 4:02am UTC](https://community.influxdata.com/t/kapacitor-using-other-data-from-source-measurement-window/1101/2 "2017-05-30T04:02:20Z")

</div>

also, forgive me for not picking up autocorrect’s s/kapacitor/capacitor/ above

---

<div class="post-metadata">

**Author:** ![nathaniel](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/nathaniel/32/9_2.png) [@nathaniel](https://community.influxdata.com/u/nathaniel)\
**Post date:** [May 31, 2017, 8:07pm UTC](https://community.influxdata.com/t/kapacitor-using-other-data-from-source-measurement-window/1101/3 "2017-05-31T20:07:32Z")

</div>

@glenndavy Have a look at the join node [JoinNode | InfluxData Documentation Archive](https://docs.influxdata.com/kapacitor/v1.3/nodes/join_node/), You can compute the mean of each of the fields and then join them back together into a single point and send that point to the alert node.

---

<div class="post-metadata">

**Author:** ![glenndavy](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@glenndavy](https://community.influxdata.com/u/glenndavy)\
**Post date:** [June 8, 2017, 4:13am UTC](https://community.influxdata.com/t/kapacitor-using-other-data-from-source-measurement-window/1101/4 "2017-06-08T04:13:17Z")

</div>

Thanks Nathaniel, sorry for delayed response. Makes sense, will give it a whirl.
