Eurydike是一个简单的事件检测。对高于阈值、低于阈值和外部值带作出反应。
Eurydike的Python项目详细描述
_ρΨδ_κη/eurydike [wiki] 是一个简单的事件检测。对高于阈值,低于阈值, 以及外部价值带。
PELOPS概述
Eurydike是基于mqtt的微服务集合的一部分 pelops。微服务概述 架构和示例可以在 (http://gitlab.com/pelops/pelops)。
对于用户
安装核心功能
核心功能的先决条件是:
sudo apt install python3 python3-pip sudo pip3 install paho-mqtt pyyaml pelops
通过PIP安装:
sudo pip3 install eurydike
若要更新到最新版本,请将--upgrade作为前缀添加到 pip3行以上。
通过Gitlab安装(可能需要其他软件包):
git clone git@gitlab.com:pelops/eurydike.git cd eurydike sudo python3 setup.py install
这将安装以下shell脚本:*eurydike
脚本cli参数是:*'-c'/'-config'-config文件 (必需)*'-v'-详细输出(可选)*'-版本'-显示 版本号和退出
yaml配置
yaml[1]文件必须包含四个根块:*mqtt-mqtt地址, MQTT端口和凭据文件的路径凭据文件(文件 包含两个条目:mqtt user,mqtt password)*logger- 日志级别和要使用的文件*事件检测器-参数 控制器和嵌入式pid
mqtt: mqtt-address: localhost mqtt-port: 1883 credentials-file: ~/credentials.yaml log-level: INFO logger: log-level: DEBUG # DEBUG, INFO, WARNING, ERROR, CRITICAL log-file: test_eurydike.log eventdetectors: - name: above # unqiue name for event detector type: onthreshold # detector type identifier comparator: gt # GREATERTHAN/GT/>, LOWERTHAN/LT/<, EQUALTO/== threshold: 7 # threshold in combintation with comparator and value from topic-sub topic-sub: /test/value topic-pub: /test/above responses: # leave value empty or remove line for no response # on-violation: event_detected # on detection of a threshold violation send this value to topic-pub on-restoration: event_ended # on the event of returning to valid values send this value to topic-pub active: False # entry ignored if set to False - name: below # unqiue name for event detector type: onthreshold # detector type identifier comparator: lowerthan # GREATERTHAN/GT/>, LOWERTHAN/LT/<, EQUALTO/== threshold: 7 # threshold in combintation with comparator and value from topic-sub topic-sub: /test/value topic-pub: /test/below responses: # leave value empty or remove line for no response on-violation: event_detected # on detection of a threshold violation send this value to topic-pub on-restoration: event_ended # on the event of returning to valid values send this value to topic-pub active: True # entry ignored if set to False - name: equal # unqiue name for event detector type: onthreshold # detector type identifier comparator: == # GREATERTHAN/GT/>, LOWERTHAN/LT/<, EQUALTO/== threshold: 7 # threshold in combintation with comparator and value from topic-sub topic-sub: /test/value topic-pub: /test/equal responses: # leave value empty or remove line for no response on-violation: event_detected # on detection of a threshold violation send this value to topic-pub on-restoration: # on the event of returning to valid values send this value to topic-pub active: False # entry ignored if set to False - name: outside # unqiue name for event detector type: onband # detector type identifier upper-threshold: 8 # upper threshold for on band detection lower-threshold: 7 # lower threshold for on band detection topic-sub: /test/value topic-pub: /test/band responses: # leave value empty or remove line for no response on-violation: event_detected # on detection of a threshold violation send this value to topic-pub on-restoration: event_ended # on the event of returning to valid values send this value to topic-pub active: True # entry ignored if set to False
系统d
- 添加systemd示例。
对于开发人员
开始
该项目由两个主要模块组成:
- eventdetectionmanager-管理所有配置的事件检测器
- abstracteventdetector-所有事件检测器的基类
待办事项
- …?
其他
代码是为python3编写的(并在 覆盆子皮零与覆盆子伸展)。
Merge requests/ bug reports总是 欢迎。
[1] | Currently, pyyaml is yaml 1.1 compliant. In pyyaml On/Off and Yes/No are automatically converted to True/False. This is an unwanted behavior and deprecated in yaml 1.2. In copreus this autoconversion is removed. Thus, On/Off and Yes/No are read from the yaml file as strings (see module baseclasses.myconfigtools). |