zabbix_manager 5.1.0 → 5.1.1.pre.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -2
  3. data/{LICENSE.txt → LICENSE} +6 -6
  4. data/README.md +3 -2
  5. data/lib/zabbix_manager/basic/basic_alias.rb +6 -8
  6. data/lib/zabbix_manager/basic/basic_func.rb +17 -18
  7. data/lib/zabbix_manager/basic/basic_init.rb +21 -18
  8. data/lib/zabbix_manager/basic/basic_logic.rb +143 -139
  9. data/lib/zabbix_manager/classes/actions.rb +1 -1
  10. data/lib/zabbix_manager/classes/applications.rb +8 -7
  11. data/lib/zabbix_manager/classes/configurations.rb +2 -2
  12. data/lib/zabbix_manager/classes/drules.rb +6 -6
  13. data/lib/zabbix_manager/classes/errors.rb +1 -1
  14. data/lib/zabbix_manager/classes/graphs.rb +6 -6
  15. data/lib/zabbix_manager/classes/hostgroups.rb +0 -34
  16. data/lib/zabbix_manager/classes/hostinterfaces.rb +26 -0
  17. data/lib/zabbix_manager/classes/hosts.rb +35 -153
  18. data/lib/zabbix_manager/classes/httptests.rb +3 -3
  19. data/lib/zabbix_manager/classes/items.rb +51 -49
  20. data/lib/zabbix_manager/classes/mediatypes.rb +5 -5
  21. data/lib/zabbix_manager/classes/problems.rb +43 -61
  22. data/lib/zabbix_manager/classes/proxies.rb +4 -24
  23. data/lib/zabbix_manager/classes/roles.rb +7 -7
  24. data/lib/zabbix_manager/classes/screens.rb +3 -3
  25. data/lib/zabbix_manager/classes/templates.rb +17 -33
  26. data/lib/zabbix_manager/classes/triggers.rb +31 -73
  27. data/lib/zabbix_manager/classes/usergroups.rb +6 -6
  28. data/lib/zabbix_manager/classes/usermacros.rb +38 -37
  29. data/lib/zabbix_manager/classes/users.rb +4 -4
  30. data/lib/zabbix_manager/classes/valuemaps.rb +8 -7
  31. data/lib/zabbix_manager/client.rb +70 -45
  32. data/lib/zabbix_manager/version.rb +2 -1
  33. data/lib/zabbix_manager.rb +18 -38
  34. data/zabbix_manager.gemspec +7 -11
  35. metadata +22 -66
  36. data/CODE_OF_CONDUCT.md +0 -84
  37. data/lib/zabbix_manager/basic/basic_extend.rb +0 -40
metadata CHANGED
@@ -1,101 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbix_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.1.1.pre.alpha1
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-04-10 00:00:00.000000000 Z
11
+ date: 2023-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 5.1.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0
26
+ version: 5.1.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: 2.6.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: 2.6.3
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '2.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '2.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.11'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.11'
69
- - !ruby/object:Gem::Dependency
70
- name: yard
42
+ name: activesupport
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
45
  - - "~>"
74
46
  - !ruby/object:Gem::Version
75
- version: 0.9.27
76
- type: :development
47
+ version: 7.0.4
48
+ type: :runtime
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
52
  - - "~>"
81
53
  - !ruby/object:Gem::Version
82
- version: 0.9.27
83
- - !ruby/object:Gem::Dependency
84
- name: yardstick
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: 0.9.9
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 0.9.9
97
- description: Most codes borrowed from ZabbixApi, But changed some logic for everyday
98
- jobs. Support Zabbix 4.0 5.0 6.0
54
+ version: 7.0.4
55
+ description: A Ruby interface to the Zabbix API
99
56
  email:
100
57
  - careline@foxmail.com
101
58
  executables: []
@@ -103,12 +60,10 @@ extensions: []
103
60
  extra_rdoc_files: []
104
61
  files:
105
62
  - CHANGELOG.md
106
- - CODE_OF_CONDUCT.md
107
- - LICENSE.txt
63
+ - LICENSE
108
64
  - README.md
109
65
  - lib/zabbix_manager.rb
110
66
  - lib/zabbix_manager/basic/basic_alias.rb
111
- - lib/zabbix_manager/basic/basic_extend.rb
112
67
  - lib/zabbix_manager/basic/basic_func.rb
113
68
  - lib/zabbix_manager/basic/basic_init.rb
114
69
  - lib/zabbix_manager/basic/basic_logic.rb
@@ -120,6 +75,7 @@ files:
120
75
  - lib/zabbix_manager/classes/events.rb
121
76
  - lib/zabbix_manager/classes/graphs.rb
122
77
  - lib/zabbix_manager/classes/hostgroups.rb
78
+ - lib/zabbix_manager/classes/hostinterfaces.rb
123
79
  - lib/zabbix_manager/classes/hosts.rb
124
80
  - lib/zabbix_manager/classes/httptests.rb
125
81
  - lib/zabbix_manager/classes/items.rb
@@ -145,6 +101,7 @@ homepage: https://github.com/snmpd/zabbix_manager
145
101
  licenses:
146
102
  - MIT
147
103
  metadata:
104
+ allowed_push_host: https://rubygems.org
148
105
  homepage_uri: https://github.com/snmpd/zabbix_manager
149
106
  source_code_uri: https://github.com/snmpd/zabbix_manager
150
107
  changelog_uri: https://github.com/snmpd/zabbix_manager
@@ -159,13 +116,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
116
  version: 2.7.0
160
117
  required_rubygems_version: !ruby/object:Gem::Requirement
161
118
  requirements:
162
- - - ">="
119
+ - - ">"
163
120
  - !ruby/object:Gem::Version
164
- version: '0'
121
+ version: 1.3.1
165
122
  requirements: []
166
- rubygems_version: 3.3.3
123
+ rubygems_version: 3.4.6
167
124
  signing_key:
168
125
  specification_version: 4
169
- summary: Simple and lightweight ruby module for working with the Zabbix API, support
170
- 4.0 5.0 6.0
126
+ summary: Common code for Zabbix API clients
171
127
  test_files: []
data/CODE_OF_CONDUCT.md DELETED
@@ -1,84 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
-
9
- ## Our Standards
10
-
11
- Examples of behavior that contributes to a positive environment for our community include:
12
-
13
- * Demonstrating empathy and kindness toward other people
14
- * Being respectful of differing opinions, viewpoints, and experiences
15
- * Giving and gracefully accepting constructive feedback
16
- * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
- * Focusing on what is best not just for us as individuals, but for the overall community
18
-
19
- Examples of unacceptable behavior include:
20
-
21
- * The use of sexualized language or imagery, and sexual attention or
22
- advances of any kind
23
- * Trolling, insulting or derogatory comments, and personal or political attacks
24
- * Public or private harassment
25
- * Publishing others' private information, such as a physical or email
26
- address, without their explicit permission
27
- * Other conduct which could reasonably be considered inappropriate in a
28
- professional setting
29
-
30
- ## Enforcement Responsibilities
31
-
32
- Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
-
34
- Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
-
36
- ## Scope
37
-
38
- This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
-
40
- ## Enforcement
41
-
42
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
43
-
44
- All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
-
46
- ## Enforcement Guidelines
47
-
48
- Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
-
50
- ### 1. Correction
51
-
52
- **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
-
54
- **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
-
56
- ### 2. Warning
57
-
58
- **Community Impact**: A violation through a single incident or series of actions.
59
-
60
- **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
-
62
- ### 3. Temporary Ban
63
-
64
- **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
-
66
- **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
-
68
- ### 4. Permanent Ban
69
-
70
- **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
-
72
- **Consequence**: A permanent ban from any sort of public interaction within the community.
73
-
74
- ## Attribution
75
-
76
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
- available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
-
79
- Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
-
81
- [homepage]: https://www.contributor-covenant.org
82
-
83
- For answers to common questions about this code of conduct, see the FAQ at
84
- https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ZabbixManager
4
- class Basic
5
- # 新增 get_hostgroup_ids 方法,使用列表 flatten 功能拉平属组对象
6
- def get_hostgroup_ids(data)
7
- result = @client.api_request(
8
- method: "hostgroup.get",
9
- params: {
10
- output: "extend",
11
- filter: {
12
- name: [data].flatten
13
- }
14
- }
15
- ).map { |item| { groupid: item["groupid"] } }
16
-
17
- # 检查是是否存在
18
- result.empty? ? nil : result.flatten
19
- end
20
-
21
- # 新增 get_or_create_hostgroups 方法,查询或创建新的对象
22
- def get_or_create_hostgroups(data)
23
- [data].flatten.each do |item|
24
- # 是否存在设备属组,不存在则新建
25
-
26
- result = get_hostgroup_ids(item)
27
- if result.nil?
28
- @client.api_request(
29
- method: "hostgroup.create",
30
- params: {
31
- name: item
32
- }
33
- )
34
- end
35
- rescue StandardError => e
36
- ap e
37
- end
38
- end
39
- end
40
- end