lmcadm 0.18.0 → 0.19.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca0dd10565f531737baa49a5fbfef88cd87428354379bfea56479b695f6a9447
4
- data.tar.gz: 057bef12dff7c5b8ec69b6f833343789c4682595b6bd99f4dbce64b1a740b6af
3
+ metadata.gz: 8e0ecc30a7bc65586b2e252af05a701c4facd81c950378d147ccdf1583ee4dac
4
+ data.tar.gz: a807ad57a2d8d40419b2cf28e0ba997ba800ce6113f496e950c8be6dfa5c95bd
5
5
  SHA512:
6
- metadata.gz: b4d94f44775a0c2bea6b8e0c7376af6e7b21268670f0bc119e83d1ea2de670e8477012e717eb52df18651af18c51186551e4c71f10bd1d78bf5b4838df486f4f
7
- data.tar.gz: f45285b9223ada9c9213f99e351335f59aff2e6f9ee0038b12efe14cec3e8f0bdc6564f87db76082efce72d36128de84e45d2d50ae4414a10170f779fa6edb91
6
+ metadata.gz: cc6a607055a7c4a02245df5eae5110ed7dc874a3cdd14dc16280082a9066a27f25563fd5a0b95dfc7afdd1a28eaf92531ae0dd1bc7fc776ce6e081693ce63606
7
+ data.tar.gz: 451a67308f2a0b4420e667019272e33f1a23ee4d2bcf07a56d8ff3d4ccc23fad364cca5a7928010b259ac81fd86db0e658ac3f3845b78672ffa7c0fb39a351a1
data/README.md CHANGED
@@ -83,7 +83,7 @@ Available types are
83
83
 
84
84
  Example use:
85
85
 
86
- lmcadm monitor -A "ExampleProject" raw --type scalar --period MINUTE10 \
86
+ $ lmcadm monitor -A "ExampleProject" raw --type scalar --period MINUTE10 \
87
87
  device_info cloud_rtt.max 3e19ada7-86fa-4809-a14e-7174b018603d
88
88
 
89
89
 
@@ -94,8 +94,23 @@ To further extract data, use something that can parse json, like `jq`[1].
94
94
 
95
95
  Example use:
96
96
 
97
- lmcadm monitor -A "SDN-DEMO (LANCOM Visitor)" raw --type json --period MINUTE1 \
98
- wan_info_json interfaces a6871a81-84f3-4c57-a20e-c3410b47e895 | jq ' .[]["DSL-CH-1"].rxRate'
97
+ $lmcadm monitor -A "ExampleProject" raw --type json --period MINUTE1 \
98
+ wan_info_json interfaces a6871a81-84f3-4c57-a20e-c3410b47e895 | jq ' .[]["DSL-CH-1"].rxRate'
99
+
100
+ ### --type table
101
+
102
+ Prints table data as one row per sample.
103
+ Empty row handling is shaky, as is error handling in general.
104
+
105
+ $ lmcadm monitor -A "ExampleProject" raw --type table device_info \
106
+ device 3a096938-87b4-47c8-a388-fda75f30eacc
107
+ CLOUD_RTT | CPU_LOAD | UPTIME | TOTAL_MEMORY | FREE_MEMORY | CONTROL_RX | CONTROL_TX | MONITORING_RX | MONITORING_TX
108
+ ----------|----------|----------|--------------|-------------|------------|------------|---------------|--------------
109
+ 29 | 1 | 19512712 | 248064 | 27228 | 513704725 | 291602474 | 119108008 | 936963871
110
+ 29 | 0 | 19512652 | 248064 | 27228 | 513701635 | 291600722 | 119107296 | 936957306
111
+ 30 | 1 | 19512592 | 248064 | 27228 | 513698545 | 291598970 | 119106584 | 936950729
112
+ 77 | 6 | 19512533 | 248064 | 27228 | 513695455 | 291597218 | 119105872 | 936944149
113
+ ...
99
114
 
100
115
  # Footnotes
101
116
  [1] https://stedolan.github.io/jq/manual/
@@ -83,21 +83,31 @@ module LMCAdm #:nodoc:
83
83
  start: startTime.to_i,
84
84
  end: endTime.to_i,
85
85
  }
86
+ base_timestamp = result.body.base
87
+ delta = result.body.delta
86
88
  monitordata = result.body.items[name]
87
89
  puts result.body.inspect if _g[:debug]
88
90
  if options[:type] == 'scalar'
89
- puts monitordata.values
91
+ table_data = monitordata.values.map.with_index { |value, row_index|
92
+ {
93
+ timestamp: DateTime.strptime((base_timestamp + delta * (monitordata.values.length - row_index)).to_s,'%s'),
94
+ value: value,
95
+ }
96
+ }
97
+ tp table_data
90
98
  elsif options[:type] == 'json'
91
99
  puts JSON.pretty_generate monitordata.to_h[:values]
92
100
  elsif options[:type] == 'table'
93
- table_data = monitordata.values.map { |v|
94
- row = v.first
95
- hash = {}
96
- monitordata.keys.each_with_index { |k, index|
97
- unless row[index].nil?
98
- hash[k] = v.first[index]
99
- end
100
- }
101
+ table_data = monitordata.values.map.with_index { |v, row_index|
102
+ hash = { timestamp: DateTime.strptime((base_timestamp + delta * (monitordata.values.length - row_index)).to_s,'%s') }
103
+ unless v.nil?
104
+ row = v.first
105
+ monitordata.keys.each_with_index { |k, column_index|
106
+ unless row[column_index].nil?
107
+ hash[k] = v.first[column_index]
108
+ end
109
+ }
110
+ end
101
111
  hash
102
112
  }
103
113
  tp table_data
@@ -1,3 +1,3 @@
1
1
  module LMCAdm
2
- VERSION = '0.18.0'
2
+ VERSION = '0.19.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lmcadm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - erpel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-09 00:00:00.000000000 Z
11
+ date: 2021-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler