Git Product home page Git Product logo

api_sql_to_influxdb's Introduction

这是个从postgresql数据库表中读取数据,再插入influxdb以在grafana看板展示数据的小脚本。

有如下功能:

sql_to_influxdb

  1. 生成sql查询语句
  2. 用ssh证书连接远程sql数据库后,再向数据库端口5432发送查询语句,返回查询结果的字典
  3. 格式化插入influxdb的数据后插入influxdb
  4. 插入成功后给slack发送通知

api_to_influxdb

  1. 把请求的接口和请求体都放在yml文件中,解析yml文件并发送http请求
  2. 格式化接口结果后插入influxdb
  3. 插入成功后给slack和企业微信发送通知

如何运行

直接在目录下运行 python sql_to_influxdb.pypython api_to_influxdb.py。也可以在crontab添加定时作业。

#every day 7:10
#10 07 * * * bash -c 'PYTHONPATH=. python sql_to_influxdb.py'

api_sql_to_influxdb's People

Contributors

maxwellxx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.