I am using Kapacitor OSS version 1.5.9 with InfluxDB 2.0.4
I have two tick scripts enabled, both are simple test scripts, but with two different dbrp. One is working and other is not.
kapacitor.conf
is as follows:
[http]
bind-address = ":9092"
auth-enabled = false
log-enabled = true
write-tracing = false
pprof-enabled = true
https-enabled = false
https-certificate = "/etc/ssl/kapacitor.pem"
https-private-key = ""
shutdown-timeout = "10s"
shared-secret = ""
[[influxdb]]
enabled = true
name = "localhost"
default = true
urls = ["http://localhost:8086"]
username = "mydb"
password = "myorg123"
ssl-ca = ""
ssl-cert = ""
ssl-key = ""
insecure-skip-verify = false
timeout = "0s"
disable-subscriptions = true
subscription-protocol = "http"
subscription-mode = "cluster"
kapacitor-hostname = ""
http-port = 0
udp-bind = ""
udp-buffer = 1000
udp-read-buffer = 0
startup-timeout = "5m0s"
subscriptions-sync-interval = "1m0s"
subscription-path = ""
compression = "none"
[influxdb.subscriptions]
[influxdb.excluded-subscriptions]
_kapacitor = ["autogen"]
I have created my second user and dbrp using the following commands:
# influx v1 auth create --org myorg --username mydb --password myorg123 --write-bucket 3ebfdcb741a55841 --read-bucket 3ebfdcb741a55841
ID Description Name / Token User Name User ID Permissions
077b2047993fa000 mydb admin 07629ab16d4f6000 [read:orgs/1fbb239dff290f87/buckets/3ebfdcb741a55841 write:orgs/1fbb239dff290f87/buckets/3ebfdcb741a55841]
# influx v1 dbrp create --db mydb --rp autogen --bucket-id 3ebfdcb741a55841 --org myorg --default
ID Database Bucket ID Retention Policy Default Organization ID
077b208d57bfa000 mydb 3ebfdcb741a55841 autogen true 1fbb239dff290f87
Previously I had defined another user for connecting to telegraf db using this command:
$ influx v1 dbrp create --org myorg --db telegraf --rp 30days --bucket-id d3d999f5ba713ad3
ID Database Bucket ID Retention Policy Default Organization ID
07738569db7fa000 telegraf d3d999f5ba713ad3 30days false 1fbb239dff290f87
$ influx v1 auth create --org myorg --username kapacitorv1 --password myorg123 --write-bucket d3d999f5ba713ad3 --read-bucket d3d999f5ba713ad3
ID Description Name / Token User Name User ID Permissions
077385be08bfa000 kapacitorv1 admin 07629ab16d4f6000 [read:orgs/1fbb239dff290f87/buckets/d3d999f5ba713ad3 write:orgs/1fbb239dff290f87/buckets/d3d999f5ba713ad3]
The non working tickscript is
dbrp "mydb"."autogen"
stream
|from()
.measurement('nodeexporter09')
.groupBy('host.name')
|alert()
.id('{{ index .Tags "host"}}-cpu-usage')
.message('{{ .ID}} is {{ .Level}} has CPU usage of: {{ index .Fields "system.cpu.idle.norm.pct" | printf "%0.2f"}}')
.info(lambda: ("system.cpu.idle.norm.pct") < 50.0)
.warn(lambda: ("system.cpu.idle.norm.pct") > 70.0)
.crit(lambda: ("system.cpu.idle.norm.pct") > 85.0)
.log('/tmp/alerts.log')
and working is:
dbrp "telegraf"."autogen"
stream
|from()
.measurement('disk')
.groupBy('host', 'device')
|alert()
.id('{{ index .Tags "host"}}/disk-usage/{{ index .Tags "device" }}')
.message('{{ .ID}}:{{ .Level}} has **usage** of: {{ index .Fields "used_percent" | printf "%0.2f"}}')
.info(lambda: "used_percent" > 36.0)
.warn(lambda: "used_percent" > 70.0)
.crit(lambda: "used_percent" > 85.0)
.stateChangesOnly()
.topic('systems')
$ kapacitor stats ingress
Database Retention Policy Measurement Points Received
_kapacitor autogen edges 952
_kapacitor autogen ingress 1778
_kapacitor autogen kapacitor 119
_kapacitor autogen load 119
_kapacitor autogen nodes 714
_kapacitor autogen runtime 119
_kapacitor autogen topics 833
telegraf autogen cpu 4080
telegraf autogen disk 240
telegraf autogen diskio 960
telegraf autogen kernel 120
telegraf autogen mem 240
telegraf autogen processes 120
telegraf autogen swap 240
telegraf autogen system 360
# kapacitor list tasks
ID Type Status Executing Databases and Retention Policies
cpualert stream enabled true ["mydb"."autogen"]
disk-alert stream enabled true ["telegraf"."autogen"]
Not sure why its not working, any help is much appreciated.