sentinl是一个免费的kibana预警与报告插件,与付费软件X-Pack功能相似。javascript
./kibana-plugin install file:./sentinl-v6.0.1.zip
安装完成后,要重启kibanahtml
fuser -n tcp 5601 ps -ef | grep node kill -9 pid ./kibana &
使用包括5个步骤java
give our Watcher a name and choose an execution frequencynode
es的搜索与聚合web
validate if the results received back are worth processingexpress
语法与x-pack script condition语法相似vim
至关于过滤条件tcp
"condition": { "script": { "script": "payload.hits.total>=1" //当报警条件为***出现的次数大于1 } } "condition": { "script": { "script": "payload.hits.hits[0]._source.responsetime > 0.01" // 检索条件 响应时间大于 0.01秒 } }
Our data might need adjustments or post processing. Process our payload using a javascript expression/scriptide
过后处理post
Let's form a notification using the mustache templating language。
能够采用多种方式发送通知。
How to Adapt or Post-Process data
Post Process过后的处理。
The transform script is the wild member of the family and can be used to inject simple or complex logic into the pipeline before delivery to actions using pure javascript.
From converting format types, through generating brand new payload keys and interpolating data, transform is the way up. The script expects a boolean condition to trigger actions. A false condition can be forced to stop the execution. BONUS: Transforms can be saved and used across Watchers! "transform": { "script": { "script": "payload.newvar = payload.aggs.some.values['95.0']" } }
kibana.yml
logging.verbose: true sentinl: settings: email: active: true host: smtp.exmail.qq.com ssl: false report: active: true tmp_path: /tmp/ 上面是官网的,下面是实践已OK sentinl: settings: email: active: true user: tanyk@huawangtech.com password: Dd@2016 host: smtp.exmail.qq.com ssl: true timeout: 10000 report: active: true tmp_path: /tmp/
先测试
mailx -S smtp=<smtp-server-address> -r <from-address> -s <subject> -v <to-address> < body.txt
yum -y install sendmail yum install -y sendmail-cf /etc/init.d/sendmail start chkconfig sendmail on yum install -y mailx
vim /etc/mail.rc(optional)
set from=tanyk@mail.com set smtp=smtp.exmail.qq.com set smtp-auth-user=tanyk@mail.com set smtp-auth-password=****** set smtp-auth=login set nss-config-dir="/etc/pki/nssdb/"
test
echo "This is the message body and contains the message" | mailx -v -r "tanyk@mail.com" -s "This is the subject" -S smtp="smtp.exmail.qq.com" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="tanyk@mail.com" -S smtp-auth-password="******" -S ssl-verify=ignore -S nss-config-dir="/etc/pki/nssdb/" tanyk@163.com