MCPcopy Index your code
hub / github.com/influxdata/kapacitor

github.com/influxdata/kapacitor @v1.8.6 sqlite

repository ↗ · DeepWiki ↗ · release v1.8.6 ↗
8,581 symbols 31,886 edges 572 files 2,273 documented · 26%
README

Kapacitor Circle CI Docker pulls

Open source framework for processing, monitoring, and alerting on time series data

Installation

Kapacitor has two binaries:

  • kapacitor – a CLI program for calling the Kapacitor API.
  • kapacitord – the Kapacitor server daemon.

You can either download the binaries directly from the downloads page or go get them:

go get github.com/influxdata/kapacitor/cmd/kapacitor
go get github.com/influxdata/kapacitor/cmd/kapacitord

Configuration

An example configuration file can be found here

Kapacitor can also provide an example config for you using this command:

kapacitord config

Getting Started

This README gives you a high level overview of what Kapacitor is and what its like to use it. As well as some details of how it works. To get started using Kapacitor see this guide. After you finish the getting started exercise you can check out the TICKscripts for different Telegraf plugins.

Basic Example

Kapacitor uses a DSL named TICKscript to define tasks.

A simple TICKscript that alerts on high cpu usage looks like this:

stream
    |from()
        .measurement('cpu_usage_idle')
        .groupBy('host')
    |window()
        .period(1m)
        .every(1m)
    |mean('value')
    |eval(lambda: 100.0 - "mean")
        .as('used')
    |alert()
        .message('{{ .Level}}: {{ .Name }}/{{ index .Tags "host" }} has high cpu usage: {{ index .Fields "used" }}')
        .warn(lambda: "used" > 70.0)
        .crit(lambda: "used" > 85.0)

        // Send alert to hander of choice.

        // Slack
        .slack()
        .channel('#alerts')

        // VictorOps
        .victorOps()
        .routingKey('team_rocket')

        // PagerDuty
        .pagerDuty()

Place the above script into a file cpu_alert.tick then run these commands to start the task:

# Define the task (assumes cpu data is in db 'telegraf')
kapacitor define \
    cpu_alert \
    -type stream \
    -dbrp telegraf.default \
    -tick ./cpu_alert.tick
# Start the task
kapacitor enable cpu_alert

Extension points exported contracts — how you extend this code

UpdateTaskService (Interface)
UpdateTaskService provides an API to update the LatestScheduled time of a task [6 implementers]
task/backend/schedulable_task_service.go
WriteOperator (Interface)
WriteOperator provides an interface for performing write operations. [6 implementers]
services/storage/storage.go
Validator (Interface)
Validator is a type that can validate itself. If an element is a Validator, then Validate() is called whenever it is mod [62 …
services/config/override/override.go
Discoverer (Interface)
Discoverer represents a service that discovers hosts to scrape [12 implementers]
services/scraper/discoverer.go
Service (Interface)
Service represents a service attached to the server. [72 implementers]
server/server.go
Receiver (Interface)
Receiver handles messages as they arrive via a consumer. [31 implementers]
edge/consumer.go
ForwardReceiver (Interface)
ForwardReceiver handles messages as they arrive and can return a message to be forwarded to output edges. If a returned [31 …
edge/forwarding.go
Message (Interface)
Message represents data to be passed along an edge. Messages can be shared across many contexts. All messages implement [23 …
edge/messages.go

Core symbols most depended-on inside this repo

Errorf
called by 1687
services/diagnostic/handlers.go
Fatal
called by 1109
services/diagnostic/handlers.go
New
called by 821
task_master.go
Fatalf
called by 649
services/diagnostic/handlers.go
String
called by 315
tick/ast/node.go
Duration
called by 312
tick/ast/json.go
Error
called by 284
services/diagnostic/log.go
Add
called by 245
expvar/expvar.go

Shape

Method 5,073
Function 1,876
Struct 1,226
Interface 220
TypeAlias 139
FuncType 33
Class 14

Languages

Go99%
Python1%

Modules by API surface

udf/agent/udf.pb.go248 symbols
services/diagnostic/handlers.go218 symbols
client/v1/client.go207 symbols
tick/ast/node.go195 symbols
integrations/streamer_test.go190 symbols
edge/messages.go171 symbols
tick/stateful/functions.go163 symbols
server/server_test.go115 symbols
pipeline/json.go94 symbols
pipeline/alert.go93 symbols
server/server.go92 symbols
cmd/kapacitor/main.go81 symbols

Dependencies from manifests, versioned

cel.dev/exprv0.25.1 · 1×
cloud.google.com/gov0.123.0 · 1×
cloud.google.com/go/auth/oauth2adaptv0.2.8 · 1×
cloud.google.com/go/bigqueryv1.74.0 · 1×
cloud.google.com/go/bigtablev1.42.0 · 1×
cloud.google.com/go/compute/metadatav0.9.0 · 1×
cloud.google.com/go/longrunningv0.8.0 · 1×
cloud.google.com/go/monitoringv1.24.3 · 1×
collectd.orgv0.3.0 · 1×
github.com/99designs/go-keychainv0.0.0-2019100805025 · 1×

For agents

$ claude mcp add kapacitor \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact