TaosKeeper
TDengine Metrics Exporter, you can obtain the running status of TDengine version 3.0 by performing several simple configurations.
This tool uses TDengine RESTful API, so you could just build it without TDengine client.
Build
Get the source codes
git clone https://github.com/taosdata/taoskeeper
cd taoskeeper
compile
go mod tidy
go build
Install
If you build the tool by your self, just copy the taoskeeper
binary to your PATH
.
sudo install taoskeeper /usr/bin/
Start
Before start, you should configure some options like database IP, port or the prefix and others for exported metrics.
in /etc/taos/taoskeeper.toml
.
# Start with debug middleware for gin
debug = false
# Listen port, default is 6043
port = 6043
# log level
loglevel = "info"
# go pool size
gopoolsize = 50000
# interval for TDengine metrics
RotationInterval = "15s"
[tdengine]
host = "127.0.0.1"
port = 6041
username = "root"
password = "taosdata"
# list of taosAdapter that need to be monitored
[taosAdapter]
address = ["127.0.0.1:6041"]
[metrics]
# metrics prefix in metrics names.
prefix = "taos"
# database for storing metrics data
database = "log"
# export some tables that are not super table
tables = []
[environment]
# Whether running in cgroup.
incgroup = false
Now you could run the tool:
taoskeeper
If you use systemd
, copy the taoskeeper.service
to /lib/systemd/system/
and start the service.
sudo cp taoskeeper.service /lib/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start taoskeeper
To start taoskeeper whenever OS rebooted, you should enable the systemd service:
sudo systemctl enable taoskeeper
So if use systemd
, you'd better install it with these lines all-in-one:
go mod tidy
go build
sudo install taoskeeper /usr/bin/
sudo cp taoskeeper.service /lib/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start taoskeeper
sudo systemctl enable taoskeeper
Docker
Here is an example to show how to build this tool in docker:
Before building, you should configure ./config/taoskeeper.toml
with proper parameters and edit Dockerfile. Take following as example.
FROM golang:1.17.2 as builder
WORKDIR /usr/src/taoskeeper
COPY ./ /usr/src/taoskeeper/
ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct
RUN go mod tidy && go build
FROM alpine:3
RUN mkdir -p /etc/taos
COPY --from=builder /usr/src/taoskeeper/taoskeeper /usr/bin/
COPY ./config/taoskeeper.toml /etc/taos/taoskeeper.toml
EXPOSE 6043
CMD ["taoskeeper"]
If you already have taosKeeper binary file, you can build this tool like:
FROM ubuntu:18.04
RUN mkdir -p /etc/taos
COPY ./taoskeeper /usr/bin/
COPY ./taoskeeper.toml /etc/taos/taoskeeper.toml
EXPOSE 6043
CMD ["taoskeeper"]
FAQ
-
Error occurred: Connection refused, while taosKeeper was starting
Answer: taoskeeper relies on restful interfaces to query data. Check whether the taosAdapter is running or whether
the taosAdapter address in taoskeeper.toml is correct.
-
Why detection metrics displayed by different TDengine's inconsistent with taoskeeper monitoring?
Answer: If a metric is not created in TDengine, taoskeeper cannot get the corresponding test results.
-
Cannot receive log from TDengine server.
Answer: Modify /etc/taos/taos.cfg
file and add parameters like:
monitor 1 // start monitor
monitorInterval 30 // send log interval (s)
monitorFqdn localhost
monitorPort 6043 // taosKeeper port
monitorMaxLogs 100