zabbix-client 0.0.2 → 0.0.3
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/README.md +5 -3
- data/lib/zabbix/client/client.rb +9 -1
- data/lib/zabbix/client/version.rb +1 -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: 37cf81b7ef3559cfb4199eea0338d1990e9b52d2
|
|
4
|
+
data.tar.gz: 544d6f8d3d8fd360729b5352a2af0a316a7e5e45
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91e85581088aa200d91b1daba210937237e103cb13db5198d689a8bb2089359155adef63f7d2f750db9379ebf65d82531337df06f5ff0b5e30f1d83161e83185
|
|
7
|
+
data.tar.gz: 68199bc81acba251c13a1b8da97780d462b839600ca458c5de1024f654d61c7e58fbe6efd5bae93c5d8a1576b2b472cac6b0fc8078a7247837757f37a61f51f1
|
data/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This is a simple client of Zabbix API.
|
|
4
4
|
|
|
5
|
+
[](http://badge.fury.io/rb/zabbix-client)
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
Add this line to your application's Gemfile:
|
|
@@ -42,7 +44,7 @@ p client.template.getobjects(host: ['Template OS Linux'])
|
|
|
42
44
|
### Use proxy
|
|
43
45
|
|
|
44
46
|
```ruby
|
|
45
|
-
|
|
47
|
+
Zabbix::Client.new(
|
|
46
48
|
'http://localhost/zabbix/api_jsonrpc.php',
|
|
47
49
|
proxy_user: 'username', proxy_password: 'password'
|
|
48
50
|
)
|
|
@@ -51,7 +53,7 @@ client = Zabbix::Client.new(
|
|
|
51
53
|
### Basic auth
|
|
52
54
|
|
|
53
55
|
```ruby
|
|
54
|
-
|
|
56
|
+
Zabbix::Client.new(
|
|
55
57
|
'http://localhost/zabbix/api_jsonrpc.php',
|
|
56
58
|
basic_auth_user: 'username', basic_auth_password: 'password'
|
|
57
59
|
)
|
|
@@ -60,7 +62,7 @@ client = Zabbix::Client.new(
|
|
|
60
62
|
### Debug mode
|
|
61
63
|
|
|
62
64
|
```ruby
|
|
63
|
-
|
|
65
|
+
Zabbix::Client.new(
|
|
64
66
|
'http://localhost/zabbix/api_jsonrpc.php',
|
|
65
67
|
debug: true
|
|
66
68
|
)
|
data/lib/zabbix/client/client.rb
CHANGED
|
@@ -6,6 +6,11 @@ class Zabbix::Client
|
|
|
6
6
|
LOGIN_METHOD = 'user.login'
|
|
7
7
|
LOGOUT_METHOD = 'user.logout'
|
|
8
8
|
|
|
9
|
+
UNAUTHENTICATED_METHODS = [
|
|
10
|
+
'user.login',
|
|
11
|
+
'apiinfo.version',
|
|
12
|
+
]
|
|
13
|
+
|
|
9
14
|
DEFAULT_HEADERS = {
|
|
10
15
|
'Content-Type' => 'application/json-rpc'
|
|
11
16
|
}
|
|
@@ -54,7 +59,10 @@ class Zabbix::Client
|
|
|
54
59
|
:id => JSON_RPC_REQUEST_ID,
|
|
55
60
|
}.merge(options)
|
|
56
61
|
|
|
57
|
-
|
|
62
|
+
if @client.auth and not UNAUTHENTICATED_METHODS.include?(method)
|
|
63
|
+
body[:auth] = @client.auth
|
|
64
|
+
end
|
|
65
|
+
|
|
58
66
|
body = JSON.dump(body)
|
|
59
67
|
|
|
60
68
|
proxy_user = @client.options[:proxy_user]
|