Really poor title... Sorry
On Friday, 27 January 2017 10:36:41 UTC-5, Kristopher Cieplak wrote:
>
> I have a tick task that monitors memory usage by host.
>
> If said tick script groups by the "host" tag, then then creates a window,
> alert chain.
>
> My understanding is that it will create a unique chain for each "host".
>
> -Will that chain remain in existence forever? I.e. hosts come and go and
> are named dynamically.
> -Will I have memory and threading issues, when I have 20K hosts?
> -Is there a better way to handle this.
>
> Tick script is as follows:
>
> //This task will check to see if the average memory usage is above a
> threshold for a period of 2 minute,
> //indicating that a host has memory issues.
>
> var data = stream
> |from()
> .database(database)
> .retentionPolicy(retention_policy)
> .measurement('mem')
> .groupBy('host')
> |where(lambda: "deployment" == deployment)
> //|log() //Uncomment to debug
>
> //Criteria Check
> data
> |window()
> .period(memory_used_window_period)
> .every(memory_used_window_every)
> |mean('used_percent')
> .as('_value')
> //Slack
> |alert()
> .stateChangesOnly()
> .message('\'{{.TaskName}}\' --> \'{{ .Level }}\'
> Host \'{{ index .Tags "host" }}\'
> Used memory percentage is at {{ index .Fields "_value" |
> printf "%0.2f" }}% -- Expecting < {{ if eq .Level "CRITICAL" }}' +
> string(memory_used_critical_level) + '{{ else }}' +
> string(memory_used_warn_level) + '{{ end }}%')
> .warn(lambda: "_value" > memory_used_warn_level)
> .crit(lambda: "_value" > memory_used_critical_level)
> .slack()
> .channel(slack_channel)
>
> //OpsGenie
> |alert()
> .stateChangesOnly()
> .message('\'{{.TaskName}}\' --> \'{{ .Level }}\'
> Host \'{{ index .Tags "host" }}\'
> Used memory percentage is at {{ index .Fields "_value" |
> printf "%0.2f" }}% -- Expecting < {{ if eq .Level "CRITICAL" }}' +
> string(memory_used_critical_level) + '{{ else }}' +
> string(memory_used_warn_level) + '{{ end }}%')
> .crit(lambda: "_value" > memory_used_critical_level AND callout ==
> TRUE)
> .slack()
> .channel(slack_channel)
> .opsGenie()
> .teams(opsgenie_team)
> .recipients([ opsgenie_recipients ])
>
>
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/a70dc917-8960-46ad-8283-9808d600480e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.