Kapacitor安装及使用
生活随笔
收集整理的這篇文章主要介紹了
Kapacitor安装及使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 安裝
1.1 Tar包安裝
??(1)下載
wget https://dl.influxdata.com/kapacitor/releases/kapacitor-1.5.5_linux_amd64.tar.gz??(2)安裝
$ tar xvfz /opt/package/kapacitor-1.5.5-static_linux_amd64.tar.gz -C /home/tigk/.local/ $ mv /home/tigk/.local/kapacitor-1.5.5-1/ /home/tigk/.local/kapacitor??(3)可執行文件路徑為:{influxdb目錄}/kapacitor
??默認配置文件所在路徑:{influxdb目錄}/kapacitor.conf
$ mkdir /data/tigk/kapacitor/conf $ cp /home/tigk/.local/kapacitor/kapacitor.conf /data/tigk/kapacitor/conf/ $ cd /data/tigk/kapacitor/ $ mkdir data $ mkdir logs??然后進行修改配置文件
??(4)編輯配置文件
??/data/tigk/kapacitor/conf/kapacitor.conf,定位到[[influxdb]]
$ vim /data/tigk/kapacitor/conf/kapacitor.conf data_dir = "/data/tigk/kapacitor/data" # https-certificate = "/etc/ssl/kapacitor.pem" [logging]file = "/data/tigk/kapacitor/logs/kapacitor.log" [load]dir = "/data/tigk/kapacitor/load" [replay]dir = "/data/tigk/kapacitor/replay" [task]# Where to store the tasks database# DEPRECATED: This option is not needed for new installations.# It is only used to determine the location of the task.db file# for migrating to the new `storage` service.dir = "/data/tigk/kapacitor/tasks" [storage]# Where to store the Kapacitor boltdb databaseboltdb = "/data/tigk/kapacitor/boltdb/kapacitor.db" [[influxdb]]name = "fbi-local-02"urls = ["http://localhost:8085"]??(4)啟動服務
$ cd /home/tigk/.local/kapacitor/ $ ./kapacitord -config /data/tigk/kapacitor/conf/kapacitor.conf??或者后臺啟動
$ nohup ./kapacitord -config /data/tigk/kapacitor/conf/kapacitor.conf &1.2 RPM包安裝
??(1)下載
wget https://dl.influxdata.com/kapacitor/releases/kapacitor-1.5.5-1.x86_64.rpm??(2)安裝
sudo yum localinstall kapacitor-1.5.5-1.x86_64.rpm??(3)修改配置文件
/etc/kapacitor/kapacitor.conf??(4)啟動服務
sudo systemctl start kapacitor2 使用
2.1 Kapacitor 常用命令
??Kapacitor 是數據處理引擎,主要用來作為報警使用。使用TICKscript來定義任務,腳本定義了kapacitor處理的數據來源及處理過程。
??kapacitor常用命令
??如果Kapacitor啟動并運行,您將看到一個空的任務列表,如下所示:
$ ./kapacitor list tasks ID Type Status Executing Databases and Retention Policies2.2 CPU告警案例
??(1)編寫tick文件,當cpu閑置率小于70%則告警
??vi cpu_alert.tick
??(2)Kapacitor任務定義,到Kapacitor的安裝目錄下
./kapacitor define cpu_alert -type stream -tick /data/tigk/kapacitor/tick/cpu_alert.tick -dbrp telegraf.autogen??define:定義任務名,-tpye:指定任務類型,-tick:指定腳本名,-dprp:指定數據保留策略
??(3)查詢已定義任務
??(4)查詢任務詳細信息
$ ./kapacitor show cpu_alert ID: cpu_alert Error: Template: Type: stream Status: disabled Executing: false Created: 05 Jul 20 20:33 CST Modified: 05 Jul 20 20:33 CST LastEnabled: 01 Jan 01 00:00 UTC Databases Retention Policies: ["telegraf"."autogen"] TICKscript: stream|from().measurement('cpu')|alert().crit(lambda: "usage_idle" < 70).log('/data/tigk/kapacitor/alerts/cpu_alert.log')DOT: digraph cpu_alert { stream0 -> from1; from1 -> alert2; }??(5)腳本監控生效
$ ./kapacitor enable cpu_alert??(6)腳本監控關閉
$ ./kapacitor disable cpu_alert總結
以上是生活随笔為你收集整理的Kapacitor安装及使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: postman怎么导出测试用例_利用Ch
- 下一篇: oracle xe 最大连接数,解决Or