rb2db 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exe/rb2db +12 -8
- data/lib/rb2db/version.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 578e7889974c217b5c48860b189e5e16092053eb
|
4
|
+
data.tar.gz: a9d06572e8e9ec59800a34d0c7cf12a53eff3d64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dd2b2f7e59426a63cb4fbad12612eb9a46e7585eb6582416ce499ba2d4d0c061c35cd8753af040abcc3d784d8a2cf4f6f5af0268ccf184692c1d4afc2c9ec5d
|
7
|
+
data.tar.gz: a714d0db029bd139e651d09879cfb7386158468316698f97aa86ecf4b73498ec7af31d8e048ece50456a0f2f26f466a62fd91371e8c3d947cfde702db3e6cc15
|
data/exe/rb2db
CHANGED
@@ -4,10 +4,13 @@ require 'influxdb'
|
|
4
4
|
|
5
5
|
# CONFIG #
|
6
6
|
# InfluxDB Server:
|
7
|
-
influx_host = ENV['INFLUX_HOST'] ||
|
7
|
+
influx_host = ENV['INFLUX_HOST'] || 'localhost'
|
8
|
+
|
9
|
+
# InfluxDB Database:
|
10
|
+
influx_db = ENV['INFLUX_DB'] || 'rb2db'
|
8
11
|
|
9
12
|
# Local Hostname
|
10
|
-
|
13
|
+
influx_localhost = ENV['INFLUX_LOCALHOST'] || `hostname`.strip
|
11
14
|
|
12
15
|
# Create Database for this host if it doesn't already exist
|
13
16
|
InfluxDB::Client.new(host: influx_host).create_database(influx_db)
|
@@ -19,11 +22,12 @@ puts "Logging Started: #{influx_db} => #{influx_host}"
|
|
19
22
|
Process.daemon
|
20
23
|
|
21
24
|
while sleep 1
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
data = [
|
26
|
+
{ series: 'cpu_percent', tags: { host: influx_localhost }, values: { value: Duffy::System.cpu_percent } },
|
27
|
+
{ series: 'mem_total', tags: { host: influx_localhost }, values: { value: Duffy::System.mem_total } },
|
28
|
+
{ series: 'mem_used', tags: { host: influx_localhost }, values: { value: Duffy::System.mem_used } },
|
29
|
+
{ series: 'mem_available', tags: { host: influx_localhost }, values: { value: Duffy::System.mem_available } }
|
30
|
+
]
|
31
|
+
influxdb.write_points(data)
|
28
32
|
end
|
29
33
|
|
data/lib/rb2db/version.rb
CHANGED