sshpoller.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:sshpoller 作者: slemire 项目源码 文件源码
def output_influxdb(self):
        """ Writes data to the InfluxDB """

        client = InfluxDBClient(self.db_host, self.db_port, self.db_user, self.db_password, self.db_name)

        # TODO: Refactor to batch to optimize writes to the DB
        for data in self.data_list:

            measurement = data['command']

            # Build JSON body for the REST API call
            json_body = [
                {
                    'measurement': measurement,
                    'tags': data['tag'],
                    'fields': data['fields'],
                    'time': data['timestamp']
                }
            ]

            client.write_points(json_body, time_precision='s')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号