Comments (6)
@apsey How would you provide the other information a task needs, like dbrp, type, or possible vars?
from influxdata-docker.
Something similar to: https://github.com/rossmcdonald/kapacitor/blob/4db1c8c4dfe6dd9d383c2e15feaa357decf38eff/test.yml
from influxdata-docker.
Or maybe kapacitor could have another way of defining alerts at start-up that does not depend on running external commands.
from influxdata-docker.
@nathanielc do you think that's reasonable to build this feature directly into kapacitor or should we make a simple entrypoint script in python to do this?
from influxdata-docker.
@jsternberg Building this into Kapacitor itself is not a good idea, the daemon could be running in many different environments that would make doing this reliably difficult.
Adding a script to this docker conatiner would be much better since the environment is known.
from influxdata-docker.
I've added this to my dockerfile wrapper:
#!/bin/bash
# entrypoint.sh
set -ex
TICK_METADATA="/etc/kapacitor/tick_metadata.json"
TICK_ALARMS_FOLDER="/etc/kapacitor/alarms/"
function define_alarm {
`kapacitor define $1 -type $2 -tick $TICK_ALARMS_FOLDER$3 -dbrp $4`
}
export -f define_alarm
function enable_alarm {
`kapacitor enable $1`
}
export -f enable_alarm
function configure_all_alarms {
sleep 60
alarms=`jq -r '.[]|.name + " " + .type + " " + .tick + " " + .dbrp' $TICK_METADATA`
while read b; do
define_alarm $b
enable_alarm $b
done <<< "$alarms"
}
if [ "${1:0:1}" = '-' ]; then
set -- kapacitord "$@"
fi
exec "$@" &
pid="$!"
# configure alarms
configure_all_alarms
# wait indefinitely
while true; do
tail -f /dev/null & wait ${!}
done
ENV KAPACITOR_VERSION 1.0.0~beta3
RUN wget -q https://dl.influxdata.com/kapacitor/releases/kapacitor_${KAPACITOR_VERSION}_amd64.deb.asc && \
wget -q https://dl.influxdata.com/kapacitor/releases/kapacitor_${KAPACITOR_VERSION}_amd64.deb && \
gpg --batch --verify kapacitor_${KAPACITOR_VERSION}_amd64.deb.asc kapacitor_${KAPACITOR_VERSION}_amd64.deb && \
dpkg -i kapacitor_${KAPACITOR_VERSION}_amd64.deb && \
rm -f kapacitor_${KAPACITOR_VERSION}_amd64.deb*
RUN apt-get update --fix-missing && apt-get install -yq --no-install-recommends --force-yes \
sqlite3 \
vim \
jq \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
EXPOSE 9092
VOLUME /var/lib/kapacitor
COPY kapacitor.conf /etc/kapacitor/kapacitor.conf
COPY tick_metadata.json /etc/kapacitor
COPY alarms /etc/kapacitor/alarms
COPY entrypoint.sh /opt/local/kapacitor/entrypoint.sh
ENTRYPOINT ["/opt/local/kapacitor/entrypoint.sh"]
CMD ["kapacitord"]
Then I have a folder called alarms
with files, such as alarms/kafka_in_messages.tick
:
stream
|from()
.database('prod_kafka')
.retentionPolicy('default')
.measurement('in-message-count')
// Trigger critical alert if the throughput drops below 100 points per 300s and checked every 300s.
|deadman(100.0, 300s, lambda: hour("time") >= 4 AND hour("time") <= 23)
.slack()
.channel('#channel')
from influxdata-docker.
Related Issues (20)
- Telegraf container - logtarget/logfile not working when using input.docker with special user/group ID HOT 5
- [InfluxDBv2] Wrong Error Description for DOCKER_INFLUXDB_INIT_ADMIN_TOKEN
- [InfluxDBv2] Admin Token via `DOCKER_INFLUXDB_INIT_ADMIN_TOKEN_FILE` env var is not set in the container causing authorization errors HOT 1
- Automated Setup leaves a file behind preventing startup in influxdb:latest HOT 1
- Default directories
- Start Telegraf container with latest config from Influx Web UI [workaround] HOT 3
- Critical CVE-2018-12976 found in latest docker image HOT 6
- Influx DB 1.8 program will not open
- Chronograf 1.10.2 docker image critical vulnerability CVE-2023-45853
- Running in rootless docker is nonfunctional with host filesystem bind mounts due to overriden user ID inside container
- Telegraf: inputs.docker can no longer access Docker socket due to recent entrypoint.sh changes HOT 16
- InfluxDB won't load data after restart - Azure Blob storage
- Telegraf docker entrypoint script change needed to support deployment from compose script HOT 2
- InfluxDB hitting default port even after override with INFLUXD_HTTP_BIND_ADDRESS
- Starting a v2 container throws property not found: `tls-cert`, `tls-key` HOT 3
- influxdb:1.8.10 when deploy it on kubernetes don't create admin user
- Update all influx alpine images to 3.19 HOT 1
- Chronograf: error when upgrading from v1.10.3 to v1.10.4 HOT 3
- influxb image: platform in image-index and image-config do not match HOT 7
- kapacitor: missing documentation for backwards incompatible change to running kapacitor as non-root in v1.7.4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from influxdata-docker.