Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadman trigger error on lambda statement #718

Closed
bowdenandrew opened this issue Jul 17, 2016 · 3 comments
Closed

Deadman trigger error on lambda statement #718

bowdenandrew opened this issue Jul 17, 2016 · 3 comments
Assignees

Comments

@bowdenandrew
Copy link

I am hoping that someone can point me in the right direction for this, I have been working on this problem for a number of days and can't seem to make the deadman trigger adhere to a lambda statement in the 3rd parameter call.

I have only used the pre-built binaries but have tried 0.13.1, the nightly and 1.0.0-beta2 versions with differing errors. I have written the script as both a batch and a stream and both appear to have the same errors. I'm really hoping that I'm just doing this wrong but I have exhausted all the permutations that I can think of and I'm not getting very far.

Please note that the deadman switch works without the lambda statement for me.

batch script:

> var adt = batch
>         |query('SELECT count("messagecount") from "messages"."default"."messagestats"')
>         .period(1m)
>         .every(1m)
>         .groupBy(time(1m))
> 
> adt
>         |deadman(100.0, 1m, lambda: hour("time") > 20)
>                 .id('TESTING')
>                 .log('/tmp/testing.log')

stream script:

> var adt = stream
>         |from()
>                 .database('messages')
>                 .where(lambda: "server"=='JCPP01' AND "domain"=='ADT_PROD01_19100'
>                         AND "messageto" == 'medipath' AND "messagegenerictype" == 'ADT')
>         .groupBy(time(1m))
> adt
>         |deadman(0.0, 1m, lambda: hour("time") >= 20)
>                 .message('''Detection status update for ADT to Medipath between 7am and 5pm.   We {{ if eq .Level "OK" }}HAVE{{ else }}HAVEN'T{{ end }} sent ADT to Medipath in the last 5 minutes''')
>                 .log('/tmp/medipath2.log')

In the 0.13.1 version, for both of these scrits the kapacitor log shows:
[medipath4:alert5] 2016/07/17 22:37:02 E! error evaluating expression: Failed to handle 1 argument: expression returned unexpected type invalid type

every minute

In both the nightly and the 1.0.0-beta2 versions, the log shows:

[medipath4:alert5] 2016/07/17 23:00:00 E! error evaluating expression: Failed to handle 1 argument: name "time" is undefined. Names in scope: emitted

Again, this is also every minute

Please let me know if there is any further information needed. Any and all help is appreciated.

Andrew

@bowdenandrew
Copy link
Author

bowdenandrew commented Jul 21, 2016

I have done some further investigation and tried to boil the problem down to the simplest form:

Database:

Using database messages
> select last(messagecount) from messagestats
name: messagestats
------------------
time            last
1469062074541792612 1

Working Tick script:

stream
        |from()
                .measurement('messagestats')
      |deadman(1000.0, 1s)
                .log('/tmp/deadman.log')

Output in /tmp/deadman.log
{"id":"node 'from1' in task 'temp3'","message":"node 'from1' in task 'temp3' is dead: %!f(MISSING) points/1s.","details":"{\u0026#34;Name\u0026#34;:\u0026#34;stats\u0026#34;,\u0026#34;TaskName\u0026#34;:\u0026#34;temp3\u0026#34;,\u0026#34;Group\u0026#34;:\u0026#34;nil\u0026#34;,\u0026#34;Tags\u0026#34;:null,\u0026#34;ID\u0026#34;:\u0026#34;node \u0026#39;from1\u0026#39; in task \u0026#39;temp3\u0026#39;\u0026#34;,\u0026#34;Fields\u0026#34;:{\u0026#34;emitted\u0026#34;:0},\u0026#34;Level\u0026#34;:\u0026#34;CRITICAL\u0026#34;,\u0026#34;Time\u0026#34;:\u0026#34;2016-07-21T00:47:32Z\u0026#34;,\u0026#34;Message\u0026#34;:\u0026#34;node \u0026#39;from1\u0026#39; in task \u0026#39;temp3\u0026#39; is dead: %!f(MISSING) points/1s.\u0026#34;}\n","time":"2016-07-21T00:47:32Z","duration":11000000000,"level":"CRITICAL","data":{"series":[{"name":"stats","columns":["time","emitted"],"values":[["2016-07-21T00:47:32Z",0]]}]}}

Failing Tick Script

stream
        |from()
                .measurement('messagestats')
        |deadman(1000.0, 1s, lambda: hour("time") >=8 AND hour("time") <= 17)
                .log('/tmp/deadman.log')

Output in /var/log/kapacitor/kapacitor.log (no output in /tmp/deadman.log)

[temp3:alert5] 2016/07/21 10:51:49 E! error evaluating expression: Failed to handle 1 argument: name "time" is undefined. Names in scope: emitted

InfluxDB v0.13.0 (git: 0.13 e57fb88a051ee40fd9277094345fbd47bb4783ce)
Kapacitor 1.1.0~n201607170812 (git: master 8fc0603)

@nathanielc
Copy link
Contributor

@bowdenandrew Thanks for the details report. I'll take a look at this.

@nathanielc nathanielc self-assigned this Jul 21, 2016
@bowdenandrew
Copy link
Author

Thanks @nathanielc , I look forward to hearing from you about this. The kapacitor product is great and it would be excellent to be able to get this threshold alerting working for different times.

Alternatively, is there any other way that you can think of that I can get the time on an eval node and I can try to setup a .crit alert instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants