All Projects → takuti → datadog-anomaly-detector

takuti / datadog-anomaly-detector

Licence: MIT license
🐶 Anomaly detection system for Datadog multiple metrics

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to datadog-anomaly-detector

LogiAM
基于日志模板构建,采集任务动态管控、数据质量精确度量,一站式日志采集平台
Stars: ✭ 199 (+947.37%)
Mutual labels:  fluentd
fluent-plugin-grok-parser
Fluentd's Grok parser
Stars: ✭ 100 (+426.32%)
Mutual labels:  fluentd
terraform-aws-datadog-integration
Terraform module to configure Datadog AWS integration
Stars: ✭ 26 (+36.84%)
Mutual labels:  datadog
ansible-role-fluentbit
Ansible role that install FluentBit
Stars: ✭ 18 (-5.26%)
Mutual labels:  fluentd
logging-operator
A golang based operator to create and manage EFK (Elasticsearch, Fluentd, and Kibana) stack on Kubernetes
Stars: ✭ 42 (+121.05%)
Mutual labels:  fluentd
Laravel-FluentLogger
fluent logger for laravel (with Monolog handler for Fluentd)
Stars: ✭ 55 (+189.47%)
Mutual labels:  fluentd
natchez-extras
Integrations between Natchez, Doobie, HTTP4s, Log4cats and Datadog. Formerly called effect-utils.
Stars: ✭ 24 (+26.32%)
Mutual labels:  datadog
fluent-plugin-gcs
Google Cloud Storage output plugin for Fluentd.
Stars: ✭ 39 (+105.26%)
Mutual labels:  fluentd
okra
Hot-swap Kubernetes clusters while keeping your service up and running.
Stars: ✭ 46 (+142.11%)
Mutual labels:  datadog
vault-consul-monitoring
Sample project to explore monitoring Vault and Consul with telegraf/influxdb/grafana
Stars: ✭ 52 (+173.68%)
Mutual labels:  datadog
libfluent
Library to send log as fluentd forwarding message
Stars: ✭ 24 (+26.32%)
Mutual labels:  fluentd
fluent-plugin-redis
Redis output plugin for Fluent event collector
Stars: ✭ 40 (+110.53%)
Mutual labels:  fluentd
fluent-plugin-irc
No description or website provided.
Stars: ✭ 16 (-15.79%)
Mutual labels:  fluentd
densratio py
A Python Package for Density Ratio Estimation
Stars: ✭ 112 (+489.47%)
Mutual labels:  anomalydetection
dns-collector
Aggregator, analyzer, transporter and logging for your DNS logs
Stars: ✭ 58 (+205.26%)
Mutual labels:  fluentd
statsd.cr
A statsd client library for Crystal.
Stars: ✭ 32 (+68.42%)
Mutual labels:  datadog
fluent-plugin-ec2-metadata
Fluentd output plugin to add Amazon EC2 metadata into messages
Stars: ✭ 43 (+126.32%)
Mutual labels:  fluentd
fluent-forward-go
A high-performance Go client for Fluentd and Fluent Bit
Stars: ✭ 26 (+36.84%)
Mutual labels:  fluentd
yake
A Rake-like DSL for writing AWS Lambda handlers
Stars: ✭ 146 (+668.42%)
Mutual labels:  datadog
fluent-plugin-anonymizer
Fluentd filter output plugin to anonymize records with MD5/SHA1/SHA256/SHA384/SHA512 algorithms. This data masking plugin protects privacy data such as ID, email, phone number, IPv4/IPv6 address and so on.
Stars: ✭ 52 (+173.68%)
Mutual labels:  fluentd

Datadog Anomaly Detector

Build Status

Get Datadog metrics and pass anomaly scores to Datadog itself via Fluentd.

By integrating CEP engines such as Esper and Norikra, you can implement more practical applications as the following picture illustrates. We introduce it in doc/norikra.md.

system

Minimal Requirements

System

  • Python 3.x (2.x is not supported)
  • Fluentd 0.12.x

Python packages

See requirements.txt

Basic Installation and Usage

1. Setup Fluentd (td-agent)

Note: You can replace td-agent with fluent depending on your system environment.

Follow Installation | Fluentd and configure /etc/td-agent/td-agent.conf as:

<match changefinder.**>
  @type copy
  deep_copy true

  <store>
    @type record_reformer
    renew_record true
    renew_time_key time

    tag datadog.${tag}
    <record>
      metric ${metric_outlier}
      value ${score_outlier}
      time ${record["time"]}
    </record>
  </store>

  <store>
    @type record_reformer
    renew_record true
    renew_time_key time

    tag datadog.${tag}
    <record>
      metric ${metric_change}
      value ${score_change}
      time ${record["time"]}
    </record>
  </store>
</match>

<match datadog.changefinder.**>
  @type dd
  dd_api_key YOUR_API_KEY
</match>

Since the configuration depends on fluent-plugin-dd and fluent-plugin-record-reformer, you need to install the plugins via td-agent-gem.

Finally, restart td-agent: $ sudo service restart td-agent.

2. Configure your detector

Clone this repository:

$ git clone [email protected]:takuti/datadog-anomaly-detector.git
$ cd datadog-anomaly-detector

Create config/datadog.ini as demonstrated in config/example.ini.

$ cat config/datadog.ini
[general]
pidfile_path: /var/run/changefinder.pid

; Datadog API access interval (in sec. range)
interval: 600

[datadog.cpu]
query: system.load.norm.5{chef_environment:production,chef_role:worker6-staticip} by {host}

; ChangeFinder hyperparameters
r: 0.02
k: 7
T1: 10
T2: 5

[datadog.queue]
query: avg:queue.system.running{*}

r: 0.02
k: 7
T1: 10
T2: 5

You can insert a new config for a different query (metric) by creating a new [datadog.xxx.yyy] section as:

[datadog.add1]
query: additional.metric.1{foo}

r: 0.02
k: 7
T1: 10
T2: 5

...

Here, the above Fluentd configuration enables to create a new Datadog metrics changefinder.outlier.xxx.yyy and changefinder.change.xxx.yyy* for a configured section [datadog.xxx.yyy]. Since the names are very important to monitor the anomaly scores, you have to decide it carefully.

Note that r, k, T1 and T2 are the parameters of our machine learning algorithm. You can set different parameters for each query if you want. In case that you do not write the parameters on the INI file, default parameters will be set. In particular, optimal k is chosen by a model selection logic as described in doc/changefinder.md#model-selection.

3. Start a detector daemon

In order to get Datadog metrics, we need to first set API and APP keys as environmental variables DD_APP_KEY and DD_API_KEY.

Now, we are ready to start a detector daemon as:

$ python daemonizer.py start

For the .pid file specified in config/datadog.ini, please make sure if the directories exist correctly and you have write permission for the path.

You can stop the daemon as follows.

$ python daemonizer.py stop

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].