influxdb_events.py 文件源码

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

项目:enos 作者: BeyondTheClouds 项目源码 文件源码
def v2_playbook_on_stats(self, stats):
        """Connect to InfluxDB and commit events"""

        # Set InfluxDB host from an environment variable if provided
        _host = os.getenv('influx_vip') or self.host_vars['influx_vip']
        _port = "8086"
        _user = "None"
        _pass = "None"
        _dbname = "events"
        influxdb = InfluxDBClient(_host, _port, _user, _pass, _dbname)

        try:
            influxdb.write_points(self.events, time_precision='u')
        except Exception:
            # Disable the plugin if writes fail
            self.disabled = True
            self._display.warning(
                "Cannot write to InfluxDB, check the service state "
                "on %s." % _host)
            return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号