zabbix-rails 0.2.5 → 0.2.6
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/lib/zabbix/chart.rb +22 -0
- data/lib/zabbix/host_monitor.rb +0 -3
- data/lib/zabbix/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '04028ecb3b9665bf45fe93d6bc65797804e34f0f32eb3d1858afec834b550c84'
|
4
|
+
data.tar.gz: 7370e0c11ee2220e323e32cac92e1a22647a6b19f759fbcc5d628bf487e09936
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92759a5c33530cc15566d5758a25a1ecdb0667184a127f626eae9fd429c8a1e2919b06a515298c233a02e4a6456fe23659ed7fd9be5ea67474316607e8af8a54
|
7
|
+
data.tar.gz: 86a63bfbe19b364b51ff00c6cf37280f5a08e311d5c561720e4278da9016cf593cbab95109e61b8d933ec58bd09ef138c7e798da684ce41addd5410ad00b209d
|
data/lib/zabbix/chart.rb
CHANGED
@@ -21,6 +21,27 @@ module Zabbix
|
|
21
21
|
_item_chart("/chart2.php", data)
|
22
22
|
end
|
23
23
|
|
24
|
+
# 接口图片
|
25
|
+
def iface_chart(*itemids)
|
26
|
+
# 构造数据结构
|
27
|
+
data = {
|
28
|
+
from: "now-6h",
|
29
|
+
to: "now",
|
30
|
+
itemids: [itemids].flatten,
|
31
|
+
height: 400,
|
32
|
+
width: 900
|
33
|
+
}
|
34
|
+
|
35
|
+
# 请求后端返回图片对象
|
36
|
+
_item_chart(data)
|
37
|
+
end
|
38
|
+
|
39
|
+
# 保存接口流量图片
|
40
|
+
def save_iface_graph(*itemids)
|
41
|
+
filename = generate_name([itemids].flatten[0])
|
42
|
+
save_file(filename, iface_chart(itemids))
|
43
|
+
end
|
44
|
+
|
24
45
|
# 请求生成 item_chart 对象
|
25
46
|
def item_chart(itemid, height = 400, width = 900, start_at = "now-6h", end_at = "now")
|
26
47
|
# 构造数据结构
|
@@ -77,3 +98,4 @@ module Zabbix
|
|
77
98
|
end
|
78
99
|
end
|
79
100
|
end
|
101
|
+
|
data/lib/zabbix/host_monitor.rb
CHANGED
@@ -15,9 +15,6 @@ module Zabbix
|
|
15
15
|
hostid = item[:hostid]
|
16
16
|
|
17
17
|
# 封装数据之前确保设备属组已经存在
|
18
|
-
zabbix_connector.hostgroups.get_or_create_hostgroups(item.group) if item.group.present?
|
19
|
-
|
20
|
-
# 检查是否已存在监控对象
|
21
18
|
search_id = zabbix_connector.hosts.get_id(host: item.sn)
|
22
19
|
# 构建 zabbix-rails 监控对象数据结构,创建或者更新数据
|
23
20
|
if hostid.present?
|
data/lib/zabbix/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zabbix-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WENWU.YAN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|