从mqtt消息创建round robind数据库文件。
mqttorrd的Python项目详细描述
就像是叉子一样, mqttorrd从mqtt消息创建循环数据库文件。
工具守护进程基于poho-mqtt和python-daemon包。全部 依赖项列在requirements.txt文件中。作为python 2.x 不推荐使用,该工具仅适用于Python3.5或更高版本。例如 signal.Signals类正在使用。
用法
usage: $(prog)s [options] command Create round robind database files form MQTT. positional arguments: command Daemon action (start|stop|restart|status) optional arguments: -h, --help show this help message and exit -c <file>, --config <file> Path to config file. -f, --foreground Run as script on foreground
安装
~# pip3 install mqttorrd
配置
[守护进程]
data_dir: | Directory to store round robin database files. Default value is ^{tt5}$. |
---|---|
pid_file: | Path of file with pid. Default value is ^{tt6}$. |
user: | Daemon user, default ^{tt7}$. |
group: | Daemon group, default ^{tt8}$. |
数据目录必须是用户或组为pid文件的writer。每个值来自 mqtt-broker存储到它的rrd文件,路径来自主题。例如: /var/lib/mqttorrd/garden/pool/temperature.rrd。
[记录]
handler: | Python logging handler. Possible values are ^{tt10}$ or ^{tt11}$. When tool is run at foreground, ^{tt12}$ handler is use. On UNIX like systems, WatchedFileHandler is used. Defaults to ^{tt11}$. |
---|---|
syslog: | Syslog connection, ^{tt14}$ by default. ^{tt15}$ facility is used. |
file: | Path to log file if ^{tt10}$ handler is used. Defaults to ^{tt17}$. |
level: | One of Python logging level: ^{tt18}$. Default value is ^{tt19}$. |
format: | Logging format. Default value is ^{tt20}$. |
[mqtt]
client_id: | MQTT client id. If is not defined, it is generate automatically. |
---|---|
hostname: | Broker hostname, ^{tt21}$ by default. |
port: | Broker port, ^{tt22}$ is allways default. |
keepalive: | The keepalive timeout value for the client. Defaults to ^{tt23}$ seconds. |
tls: | TLS connection, default ^{tt24}$. |
ca_certs: | Path to the Certificate Authority certificate. If is not set, system certs path is use. |
certfile: | Client public certificate file. |
keyfile: | Client primary key file. |
username: | Client username |
password: | Client password |
subscriptions: | Coma separated topics to subscribe. Default value is ^{tt25}$. |
[/]
对于任何主题都可以定义自己的rrd参数。像^{tt26}这样的mqtt字符$ 可以使用+。如果接收到新主题消息,则首先定义, 使用匹配的。如果数据库文件还存在,则只更新值。 有关详细信息,请参见https://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html。
step: | Round Robin Database step. Defaults to ^{tt23}$ seconds. |
---|---|
DS: | Data source definition. Default value is ^{tt29}$, where ^{tt30}$ is replaced with file name as last topics part. |
RRA: | Value archive definition. Default value is |
RRA:AVERAGE:0.5:2:30, RRA:AVERAGE:0.5:5:288, RRA:AVERAGE:0.5:30:336, RRA:AVERAGE:0.5:60:1488, RRA:AVERAGE:0.5:720:744, RRA:AVERAGE:0.5:1440:265