zabbix_manager 5.0.2 → 5.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: baddfe1c19c7d70234e9faaf1327b7fb5a440083229dfc417dd2bc3b34ecdf75
4
- data.tar.gz: 19e8933f296db4a00f48df300d3684f5c11fdae8f1f4f0921e41a357ade03466
3
+ metadata.gz: c2dd53cab35de67ecf4197410f9122102aaff9509c0860532fb751fb8d555d3f
4
+ data.tar.gz: 9c3ffb719aabcbfc0db37dfd1f0932cb9478d59e7c5b100493894d090b26a897
5
5
  SHA512:
6
- metadata.gz: e7992694a2eaf74eb663c254e9143f1b1f054dba270bd856f9fce44466c54540f674e587cf76fc4924e7059acd301b04058ccea5ebbca69f538ef1facbc9e4f7
7
- data.tar.gz: 30ff7ca3f862f7db10361f46337a680a47a79fde932efe280ec756167d2b7de83aa7ea35c30229b756d68cd4492ac020ed4f2f7a3a1dbf832d1398a955c825e4
6
+ metadata.gz: cfd62dce5eb71f75b04a2ffd6c115fa865185f29dd4a89b165beef09089be108c0d95e633457216e11d114e0b20cbd4e8cb5241c347adb78826a4f00047fe4c2
7
+ data.tar.gz: dbc6eb6f1788dfb8e07c0f6816cea0ec535ee1a04b379c189dc5920b1b7d895ab7eb9ac9c4344a33b752516ec1778c7938336f7de9a12efe6d1eb088b3fc5b27
@@ -0,0 +1,69 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AutoImportSettings">
4
+ <option name="autoReloadType" value="SELECTIVE" />
5
+ </component>
6
+ <component name="ChangeListManager">
7
+ <list default="true" id="9f25f96c-828f-4aea-8886-dcbae369ba60" name="变更" comment="">
8
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
9
+ <change beforePath="$PROJECT_DIR$/lib/zabbix_manager/version.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/zabbix_manager/version.rb" afterDir="false" />
10
+ </list>
11
+ <option name="SHOW_DIALOG" value="false" />
12
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
13
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
14
+ <option name="LAST_RESOLUTION" value="IGNORE" />
15
+ </component>
16
+ <component name="Git.Settings">
17
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
18
+ </component>
19
+ <component name="JsBowerSettings">
20
+ <bower-package value="" />
21
+ <bower.json value="" />
22
+ </component>
23
+ <component name="ProjectId" id="265x23SpJKPxcHuoXgA68nnhQDg" />
24
+ <component name="ProjectViewState">
25
+ <option name="hideEmptyMiddlePackages" value="true" />
26
+ <option name="showLibraryContents" value="true" />
27
+ </component>
28
+ <component name="PropertiesComponent">
29
+ <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
30
+ <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
31
+ <property name="WebServerToolWindowFactoryState" value="false" />
32
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
33
+ <property name="node.js.detected.package.eslint" value="true" />
34
+ <property name="node.js.selected.package.eslint" value="(autodetect)" />
35
+ <property name="node.js.selected.package.tslint" value="(autodetect)" />
36
+ <property name="nodejs_interpreter_path" value="node" />
37
+ <property name="nodejs_package_manager_path" value="yarn" />
38
+ <property name="settings.editor.selected.configurable" value="org.jetbrains.plugins.ruby.settings.RubyActiveModuleSdkConfigurable" />
39
+ <property name="vue.rearranger.settings.migration" value="true" />
40
+ </component>
41
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
42
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" RAKE_SPRING_PRE_LOADER_OPTION="true" RAILS_SPRING_PRE_LOADER_OPTION="true" />
43
+ <component name="TaskManager">
44
+ <task active="true" id="Default" summary="默认任务">
45
+ <changelist id="9f25f96c-828f-4aea-8886-dcbae369ba60" name="变更" comment="" />
46
+ <created>1646727041577</created>
47
+ <option name="number" value="Default" />
48
+ <option name="presentableId" value="Default" />
49
+ <updated>1646727041577</updated>
50
+ <workItem from="1646727043249" duration="3509000" />
51
+ <workItem from="1646732978147" duration="8000" />
52
+ </task>
53
+ <servers />
54
+ </component>
55
+ <component name="TypeScriptGeneratedFilesManager">
56
+ <option name="version" value="3" />
57
+ </component>
58
+ <component name="Vcs.Log.Tabs.Properties">
59
+ <option name="TAB_STATES">
60
+ <map>
61
+ <entry key="MAIN">
62
+ <value>
63
+ <State />
64
+ </value>
65
+ </entry>
66
+ </map>
67
+ </option>
68
+ </component>
69
+ </project>
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # ZabbixManager
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zabbix_manager`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ most codes are borrowed from zabbixapi, but changed some logic to fit everyday job wells. now support ZABBIX 4.0, 5.0, 6.0
6
4
 
7
5
  ## Installation
8
6
 
@@ -40,4 +38,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
38
 
41
39
  ## Code of Conduct
42
40
 
43
- Everyone interacting in the ZabbixManager project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/zabbix_manager/blob/master/CODE_OF_CONDUCT.md).
41
+ Everyone interacting in the ZabbixManager project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ciscolive/zabbix_manager/blob/master/CODE_OF_CONDUCT.md).
@@ -83,7 +83,8 @@ class ZabbixManager
83
83
  # 根据设备名称和接口名字查询监控项 | 15809 | GigabitEthernet1/0/12
84
84
  def get_interface_items(hostid, name)
85
85
  # 自动剔除收尾空白字串
86
- iface = "Interface #{name.strip}("
86
+ _name = name&.gsub(%r"[^\/0-9]", "")&.strip
87
+ iface = "#{_name}("
87
88
 
88
89
  # 模糊查询接口下所有监控项,同时过滤出特定的 snmp_oid
89
90
  result = @client.api_request(
@@ -158,7 +158,7 @@ class ZabbixManager
158
158
  manual_close: 1,
159
159
  }
160
160
  )
161
- ap result
161
+ #ap result
162
162
  # 检查是是否存在
163
163
  result.empty? ? nil : result["triggerids"]
164
164
  end
@@ -10,20 +10,19 @@ class ZabbixManager
10
10
 
11
11
  # @return [Integer]
12
12
  def id
13
- rand(100_000)
13
+ rand(800_000)
14
14
  end
15
15
 
16
16
  # Returns the API version from the Zabbix Server
17
17
  #
18
- # @return [String]
18
+ # @return [String, Hash]
19
19
  def api_version
20
- @api_version ||= api_request(method: 'apiinfo.version', params: {})
21
- @api_version
20
+ api_request(method: 'apiinfo.version', params: {})
22
21
  end
23
22
 
24
23
  # Log in to the Zabbix Server and generate an auth token using the API
25
24
  #
26
- # @return [Hash]
25
+ # @return [Hash, String]
27
26
  def auth
28
27
  api_request(
29
28
  method: 'user.login',
@@ -38,7 +37,7 @@ class ZabbixManager
38
37
  #
39
38
  # @return [boolean]
40
39
  def debug?
41
- return !@options || @options[:debug]
40
+ !@options || @options[:debug]
42
41
  end
43
42
 
44
43
  # Initializes a new Client object
@@ -58,9 +57,10 @@ class ZabbixManager
58
57
  @proxy_uri = URI.parse(ENV['http_proxy'])
59
58
  @proxy_host = @proxy_uri.host
60
59
  @proxy_port = @proxy_uri.port
61
- @proxy_user, @proxy_pass = @proxy_uri.userinfo.split(/:/) if @proxy_uri.userinfo
60
+ @proxy_user, @proxy_pass = @proxy_uri.userinfo&.split(/:/) if @proxy_uri.userinfo
62
61
  end
63
- unless api_version =~ %r{^5.[0|2]\.\d+$}
62
+
63
+ if api_version.match? /^7\.\d+\.\d+$/
64
64
  message = "Zabbix API version: #{api_version} is not supported by this version of zabbixapi"
65
65
  if @options[:ignore_version]
66
66
  puts "[WARNING] #{message}" if @options[:debug]
@@ -1,3 +1,3 @@
1
1
  class ZabbixManager
2
- VERSION = '5.0.2'.freeze
2
+ VERSION = '5.0.5'.freeze
3
3
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbix_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - WENWU YAN
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-18 00:00:00.000000000 Z
11
+ date: 2022-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -59,6 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".idea/workspace.xml"
62
63
  - ".rubocop.yml"
63
64
  - CHANGELOG.md
64
65
  - CODE_OF_CONDUCT.md
@@ -103,6 +104,7 @@ files:
103
104
  - lib/zabbix_manager/client.rb
104
105
  - lib/zabbix_manager/version.rb
105
106
  - zabbix_manager-5.0.1.gem
107
+ - zabbix_manager-5.0.2.gem
106
108
  homepage: https://github.com/snmpd/zabbix_manager
107
109
  licenses:
108
110
  - MIT
@@ -126,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
128
  - !ruby/object:Gem::Version
127
129
  version: '0'
128
130
  requirements: []
129
- rubygems_version: 3.2.22
131
+ rubygems_version: 3.3.3
130
132
  signing_key:
131
133
  specification_version: 4
132
134
  summary: Write a short summary, because RubyGems requires one.