{"action":"created","issue":{"url":"https://api.github.com/repos/influxdata/kapacitor/issues/134","labels_url":"https://api.github.com/repos/influxdata/kapacitor/issues/134/labels{/name}","comments_url":"https://api.github.com/repos/influxdata/kapacitor/issues/134/comments","events_url":"https://api.github.com/repos/influxdata/kapacitor/issues/134/events","html_url":"https://github.com/influxdata/kapacitor/issues/134","id":125041039,"number":134,"title":"Alerts and StateChange","user":{"login":"jgerschk","id":7864285,"avatar_url":"https://avatars.githubusercontent.com/u/7864285?v=3","gravatar_id":"","url":"https://api.github.com/users/jgerschk","html_url":"https://github.com/jgerschk","followers_url":"https://api.github.com/users/jgerschk/followers","following_url":"https://api.github.com/users/jgerschk/following{/other_user}","gists_url":"https://api.github.com/users/jgerschk/gists{/gist_id}","starred_url":"https://api.github.com/users/jgerschk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgerschk/subscriptions","organizations_url":"https://api.github.com/users/jgerschk/orgs","repos_url":"https://api.github.com/users/jgerschk/repos","events_url":"https://api.github.com/users/jgerschk/events{/privacy}","received_events_url":"https://api.github.com/users/jgerschk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-05T20:09:03Z","updated_at":"2016-01-05T20:22:19Z","closed_at":null,"body":"With regard to state change, I assume, based on my testing that state change is only valid for one tick script.  \r\n\r\nLet me explain with data.\r\n\r\ntick=30,metric=DN,symbol=GPSMDN94,component=SM\r\n\r\nthis will trigger an alarm (critical) as it matches the where below.\r\n\r\ntick=1,metric=DN,symbol=GSSMDN94,component=SM\r\n\r\nThe symbol tag is slightly different, and this produces and OK if after the above critical.  \r\n\r\nstream\r\n .from().measurement('metric')\r\n  .where(lambda: \"metric\" == 'DN' AND \"component\" == 'SM')\r\n  .alert()\r\n   .id ('{{ index .Tags \"symbol\" }} / {{ index .Tags \"location\" }}')\r\n   .message('{{.ID}} is {{.Level}} value: {{ index .Fields \"tick\"}}')\r\n   .crit(lambda: \"tick\" > 25)\r\n   .email('someone@work.com')\r\n   .log('/tmp/user_alerts.log')\r\n\r\nNow, my questions.\r\n\r\n1) Can state change be disabled ?\r\n2) Can we make state change unique to a tag or the id of the alert so that we don't get clears for data that really should not be OK util it is OK.\r\n\r\nLet me know what you guys think.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/influxdata/kapacitor/issues/comments/169120900","html_url":"https://github.com/influxdata/kapacitor/issues/134#issuecomment-169120900","issue_url":"https://api.github.com/repos/influxdata/kapacitor/issues/134","id":169120900,"user":{"login":"rossmcdonald","id":4060903,"avatar_url":"https://avatars.githubusercontent.com/u/4060903?v=3","gravatar_id":"","url":"https://api.github.com/users/rossmcdonald","html_url":"https://github.com/rossmcdonald","followers_url":"https://api.github.com/users/rossmcdonald/followers","following_url":"https://api.github.com/users/rossmcdonald/following{/other_user}","gists_url":"https://api.github.com/users/rossmcdonald/gists{/gist_id}","starred_url":"https://api.github.com/users/rossmcdonald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rossmcdonald/subscriptions","organizations_url":"https://api.github.com/users/rossmcdonald/orgs","repos_url":"https://api.github.com/users/rossmcdonald/repos","events_url":"https://api.github.com/users/rossmcdonald/events{/privacy}","received_events_url":"https://api.github.com/users/rossmcdonald/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T20:22:18Z","updated_at":"2016-01-05T20:22:18Z","body":"@jgerschk Do you observe the same behaviour if you alter your script to the following:\r\n\r\n```\r\nstream\r\n.from().measurement('metric')\r\n.where(lambda: \"metric\" == 'DN' AND \"component\" == 'SM').groupBy('symbol')\r\n.alert()\r\n.id ('{{ index .Tags \"symbol\" }} / {{ index .Tags \"location\" }}')\r\n.message('{{.ID}} is {{.Level}} value: {{ index .Fields \"tick\"}}')\r\n.crit(lambda: \"tick\" > 25)\r\n.email('someone@work.com')\r\n.log('/tmp/user_alerts.log')\r\n```\r\n\r\nWhere `.groupBy('symbol')` is added to the `.where()`? \r\n\r\nOtherwise you're just relying on the `tick` value alone for your alerting, which is why you're seeing the alert switch back and forth regardless of `symbol` value. I may be misunderstanding your intention, though."}}