Code Monkey home page Code Monkey logo

elasticsearch-watcher-net's Introduction

Deprecation Notice

Since 12-April-2018, this repository has been integrated into the main .NET client repository and is no longer being maintained.

We consider this repo to be DEPRECATED and give notice of our plans to remove access to this repository after 30-June-2018.

elasticsearch-watcher-net's People

Contributors

gmarz avatar mpdreamz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elasticsearch-watcher-net's Issues

Watcher not working

  1. Below is the watcher config put through sense

PUT watcher/watch/Email_watch
{
"trigger": {
"schedule": {
"interval": "1m"
}
},
"input": {
"search": {
"request": {
"indices": "logstash-2017.02.20",
"body": {
"size": 0,
"query": {
"range": {
"syslog_sev_level": {
"lte": "6 "
}
}
}
}
}
}
},
"condition": {
"script": "return ctx.payload.hits.total > 0"
},
"actions": {
"send_email": {
"throttle_period": "60m",
"email": {
"to": "[email protected]",
"from": "[email protected]",
"subject": "Syslog_sev_level less than or equal to 5",
"body": "Syslog_sev_level less than or equal to 5",
"attachments": {
"attached_data": {
"data": {
"format": "json"
}
}
},
"priority": "high"
}
}
}
}


  1. Below is the Curl output

XXXX@ubuntu:/usr/share/elasticsearch/config$ curl -XGET 'http://localhost:9200/_watcher/stats?pretty'
{
"watcher_state" : "started",
"watch_count" : 2,
"execution_thread_pool" : {
"queue_size" : 0,
"max_size" : 15
},
"manually_stopped" : false
}


  1. Elasticsearch.yml config

watcher.index.rest.direct_access : true
watcher.actions.email.service.account:
exchange_account:
profile: outlook
email_defaults:
from: [email protected]
smtp:
auth: false
starttls.enable: false
host: Smtp.1bank.XXX.com
port: 25
user: [email protected]
password:


Below is the versions been used ..

Kibana Version 4.5.4
elasticsearch 2.4.2
Logstash 2.3.4
Watcher 2.4.4.

Email for some reason is not been initiated ..Anyone can help if possible

Trying to add activate/deactivate functionality

Hi,

I'm trying to add activate/deactivate functionality (https://www.elastic.co/guide/en/watcher/current/api-rest.html#api-rest-activate-watch) to this project and running into a bit of a roadblock. Apparently the Code Generation tools read from a specification folder -

private readonly static string _specFolder = @"..\..\..\..\..\..\elasticsearch-watcher\rest-api-spec\api\";

I can't find this folder or any info on how to create/get it. Is it possible to re-run the code generation stuff for the current version of the Watcher API?

Thanks!
Nick

Search WatchRecord with FieldDescriptors doesn't generate correct JSON

Having a hard time figuring out what's wrong, but can demonstrate:
This works via strings for fields

            var result = Client.Search<WatchRecord>(x => x
                .Index(".watch_history-*")
                .AllTypes()
                .Query(q => q
                    .Filtered(f1 => f1
                        .Filter(f2 => f2.Term("watch_id", alertId))))
                .SortDescending("trigger_event.triggered_time"));

This does not when using FieldDescriptors

            var result = Client.Search<WatchRecord>(x => x
                .Index(".watch_history-*")
                .AllTypes()
                .Query(q => q
                    .Filtered(f1 => f1
                        .Filter(f2 => f2.Term(fd => fd.WatchId, alertId))))
                .SortDescending(fd => fd.TriggerEvent.TriggeredTime));

Results in this (camelCased triggerEvent, triggeredTime, and watchId):

{
  "sort": [
    {
      "triggerEvent.triggeredTime": {
        "order": "desc"
      }
    }
  ],
  "query": {
    "filtered": {
      "filter": {
        "bool": {
          "must": [
            {
              "term": {
                "watchId": "9f008093-5fc4-4b26-9792-8b60c78812c2"
              }
            }
          ]
        }
      }
    }
  }
}

Any thoughts?

Watcher Put problem webhook and Interval

Hello, thanks for the library.

I'm creating a new watcher in Elasticsearch and 2 things, don't seem to work.

The webhook adds a Request item to the Json body which causes an validation error.
The interval trigger is missing.

Greetings Damien

Here's the Json body which I want to produce:

{
  "trigger" : {
    "schedule" : {
      "interval" : "10s"
    }
  },
  "input": {
    "search": {
      "request": {
        "body": {
          "query": {
            "term": {
              "alarmType": {
                "value": "critical"
              }
            }
          }
        }
      }
    }
  },
  "condition": {
    "always": {}
  },
  "actions": {
    "webAction": {
      "webhook": { 
          "port": 5000,
          "host": "localhost",
          "path": "/api/WatcherEvents/CriticalAlarm",
          "method": "post",
          "headers": {
            "Content-Type": "application/json;charset=utf-8"
          },
          "body": "\"{{ctx.payload.hits.total}}\""       
      }
    }
  }
}

Here's the NEST watcher code with the 2 problems mentioned above:

  var response = client.PutWatch("critical-alarm-watch", p => p
                .Trigger(t => t
                    .Schedule(s => s
                        .Hourly(h => h
                            .Minute(0, 20)
                        )
                    )
                )
                .Input(i => i
                    .Search(s => s
                        .Request(r => r
                            .Body<AlarmMessage>(b => b
                                .Query(q => q.Term(qt => qt.AlarmType, "critical"))
                            )
                        )
                    )
                )
                .Condition(c => c.Always())
                .Actions(a => a.Add("webAction", 
                    new WebhookAction
                    {
                        Request = new WatcherHttpRequest
                        {
                            Method = HttpMethod.Post,
                            Host= "localhost",
                            Port= 5000,
                            Path= "/api/WatcherEvents/CriticalAlarm",
                            Headers= header,
                            Body= "\"{{ctx.payload.hits.total}}\""
                        }
                    }
                ))

Greetings Damien

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.