diff --git a/alert/README.md b/alert/README.md index aa3738a3946b32b1fe16f07843943644cbda62a2..23179669349ebf94f3774c6101c06c2e375ef059 100644 --- a/alert/README.md +++ b/alert/README.md @@ -1,4 +1,4 @@ -# Alert [DRAFT] +# Alert The Alert application reads data from [TDEngine](https://www.taosdata.com/), calculating according to predefined rules to generate alerts, and pushes alerts to downstream applications like [AlertManager](https://github.com/prometheus/alertmanager). @@ -6,12 +6,16 @@ The Alert application reads data from [TDEngine](https://www.taosdata.com/), cal ### From Binary -TODO: 安装包具体位置 +Precompiled binaries is available at [taosdata website](https://www.taosdata.com/en/getting-started/), please download and unpack it by below shell command. -Precompiled binaries is available at [taosdata website](https://www.taosdata.com/), please download and unpack it by below shell command. +``` +$ tar -xzf tdengine-alert-$version-$OS-$ARCH.tar.gz +``` + +If you have no TDengine server or client installed, please execute below command to install the required driver library: ``` -$ tar -xzf alert-$version-$OS-$ARCH.tar.gz +$ ./install_driver.sh ``` ### From Source Code diff --git a/alert/README_cn.md b/alert/README_cn.md index 6d04bc5a2e1a2a8a9dd8999584aacf6c9ab8c372..ec6e4566c8eb9fa2142c37b2b3e1b1a04f783a9a 100644 --- a/alert/README_cn.md +++ b/alert/README_cn.md @@ -1,4 +1,4 @@ -# Alert [草稿] +# Alert 报警监测程序,从 [TDEngine](https://www.taosdata.com/) 读取数据后,根据预定义的规则计算和生成报警,并将它们推送到 [AlertManager](https://github.com/prometheus/alertmanager) 或其它下游应用。 @@ -6,12 +6,16 @@ ### 使用编译好的二进制文件 -TODO: 安装包具体位置 +您可以从 [涛思数据](https://www.taosdata.com/cn/getting-started/) 官网下载最新的安装包。下载完成后,使用以下命令解压: -您可以从 [涛思数据](https://www.taosdata.com/) 官网下载最新的安装包。下载完成后,使用以下命令解压: +``` +$ tar -xzf tdengine-alert-$version-$OS-$ARCH.tar.gz +``` + +如果您之前没有安装过 TDengine 的服务端或客户端,您需要使用下面的命令安装 TDengine 的动态库: ``` -$ tar -xzf alert-$version-$OS-$ARCH.tar.gz +$ ./install_driver.sh ``` ### 从源码安装 diff --git a/alert/cmd/alert/install_driver.sh b/alert/cmd/alert/install_driver.sh new file mode 100644 index 0000000000000000000000000000000000000000..1171a9953846475289531c2e07e89e5465c65959 --- /dev/null +++ b/alert/cmd/alert/install_driver.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# This file is used to install TDengine client library on linux systems. + +set -e +#set -x + +# -----------------------Variables definition--------------------- +script_dir=$(dirname $(readlink -f "$0")) +# Dynamic directory +lib_link_dir="/usr/lib" + +#install main path +install_main_dir="/usr/local/taos" + +# Color setting +RED='\033[0;31m' +GREEN='\033[1;32m' +GREEN_DARK='\033[0;32m' +GREEN_UNDERLINE='\033[4;32m' +NC='\033[0m' + +csudo="" +if command -v sudo > /dev/null; then + csudo="sudo" +fi + +function clean_driver() { + ${csudo} rm -f /usr/lib/libtaos.so || : +} + +function install_driver() { + echo -e "${GREEN}Start to install TDengine client driver ...${NC}" + + #create install main dir and all sub dir + ${csudo} mkdir -p ${install_main_dir} + ${csudo} mkdir -p ${install_main_dir}/driver + + ${csudo} rm -f ${lib_link_dir}/libtaos.* || : + ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/* + ${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 + ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so + + echo + echo -e "\033[44;32;1mTDengine client driver is successfully installed!${NC}" +} + +install_driver diff --git a/alert/release.sh b/alert/release.sh index 37fc0aeb3594253db7e87014df16310730cf4311..44b383a57e1bc0cd387cb2fefeb2d580f3b5e19e 100755 --- a/alert/release.sh +++ b/alert/release.sh @@ -1,11 +1,11 @@ set -e -# releash.sh -c [arm | arm64 | amd64 | 386] +# releash.sh -c [arm | arm64 | x64 | x86] # -o [linux | darwin | windows] # set parameters by default value -cpuType=amd64 # [arm | arm64 | amd64 | 386] -osType=linux # [linux | darwin | windows] +cpuType=x64 # [arm | arm64 | x64 | x86] +osType=linux # [linux | darwin | windows] while getopts "h:c:o:" arg do @@ -19,7 +19,7 @@ do osType=$(echo $OPTARG) ;; h) - echo "Usage: `basename $0` -c [arm | arm64 | amd64 | 386] -o [linux | darwin | windows]" + echo "Usage: `basename $0` -c [arm | arm64 | x64 | x86] -o [linux | darwin | windows]" exit 0 ;; ?) #unknown option @@ -42,4 +42,4 @@ echo "version=${version}" GOOS=${osType} GOARCH=${cpuType} go build -GZIP=-9 tar -zcf ${startdir}/alert-${version}-${osType}-${cpuType}.tar.gz alert alert.cfg +GZIP=-9 tar -zcf ${startdir}/tdengine-alert-${version}-${osType}-${cpuType}.tar.gz alert alert.cfg install_driver.sh driver/