zabbix監(jiān)控端口狀態(tài) 如何插入數(shù)據(jù)到influxdb?
如何插入數(shù)據(jù)到influxdb?一、安裝要求:1、需要Linux的root權(quán)限進(jìn)行安裝。2、由于會(huì)默認(rèn)使用到8083和8086兩個(gè)端口,所以要保證這兩個(gè)端口沒有被占用。Onceinstallation
如何插入數(shù)據(jù)到influxdb?
一、安裝要求:
1、需要Linux的root權(quán)限進(jìn)行安裝。
2、由于會(huì)默認(rèn)使用到8083和8086兩個(gè)端口,所以要保證這兩個(gè)端口沒有被占用。
Onceinstallationiscompleteyoucanchangethoseportsandotheroptionsintheconfigurationfile,whichislocatedbydefaultin/etc/influxdb.
二、安裝:
這里使用的Centos操作系統(tǒng)。
1、首先在命令行執(zhí)行下面的腳本,生成所需的yum源:
cat
[influxdb]
name=InfluxDBRepository-RHEL$releasever
可以用javaapi
=====================建maven項(xiàng)目
maven
====================插入語句=============
pointpoint2=Point.measurement("disk")
.time(System.currentTimeMillis(),TimeUnit.MILLISECONDS)
.field("used",80L)
.field("free",1L)
.build()
influxDB.write(dbName,"default",point1)
C#如何連接InfluxDB數(shù)據(jù)庫?
它是有http接口的,不需要連接字符串,直接在C#中以訪問網(wǎng)頁的WebClient方式就可以了,可以搜索一下 influxDB 0.9 C# 讀寫類
如何用ansible python實(shí)現(xiàn)一個(gè)定時(shí)將數(shù)據(jù)插入influxdb數(shù)據(jù)庫?
class Buffer(object): MAXSIZE = 8192 def __init__(self, conn, sql): self.conn = conn self.sql = sql self.buffer = [] def append(self, data): self.buffer.append(data) if len(self.buffer) > self.MAXSIZE: self.flush() def flush(self): data, self.buffer = self.buffer, [] curr = self.conn.cursor() curr.executemany(self.sql, data) self.conn.commit() # here are your code for init database connect conn_src and conn_store...buff = Buffer(conn_store, "insert into sybase_user values (%s, %s)")sql_query = "select a.id, a.name from user_info a where a.id=%s"curr_src = conn_src.cursor()curr_src.execute(sql_query, "0001")for row in curr_src: buff.append(row)buff.flush()