zbx 1.1.1 → 1.1.2
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.
- data/README.md +32 -4
- data/lib/zbx.rb +1 -1
- data/lib/zbx/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -26,23 +26,49 @@ require 'zbx'
|
|
26
26
|
|
27
27
|
# the following code are doing the same thing ,that is get a host whose id is 10160
|
28
28
|
|
29
|
-
ZBX
|
29
|
+
ZBX.client user, password, api_url do
|
30
30
|
host.get hostids: 10160
|
31
31
|
end
|
32
32
|
|
33
|
-
ZBX
|
33
|
+
ZBX.client user, password, api_url do
|
34
34
|
host do
|
35
35
|
get hostids: 10160
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
ZBX::API.new(username, password, api_url).host.get hostids: 10160
|
40
39
|
|
41
|
-
|
40
|
+
|
41
|
+
ZBX.client do
|
42
42
|
set username: 'username', password: password
|
43
43
|
set api_url: 'http://api_url'
|
44
44
|
host.get hostids: 10160
|
45
45
|
end
|
46
|
+
|
47
|
+
client = ZBX.client(username, password, api_url)
|
48
|
+
client.host.get hostids: 10160
|
49
|
+
|
50
|
+
host_api = client.host
|
51
|
+
host_api.get hostids: 10160
|
52
|
+
```
|
53
|
+
|
54
|
+
```bash
|
55
|
+
# CLI
|
56
|
+
|
57
|
+
# get the name of a host whose id is 10160
|
58
|
+
> $ zbx send host.get '{"hostids": 10160, "output": ["name"]}'
|
59
|
+
# output:
|
60
|
+
# [{"hostid"=>"10160", "name"=>"store03.pf"}]
|
61
|
+
|
62
|
+
# open api doc in browser
|
63
|
+
> $ zbx doc host.get -v 2.0
|
64
|
+
|
65
|
+
# help
|
66
|
+
> $ zbx help
|
67
|
+
# output:
|
68
|
+
# Commands:
|
69
|
+
# zbx doc [method-name or entity-name] # Open the api doc in browser, -d its short term
|
70
|
+
# zbx help [COMMAND] # Describe available commands or one specific command
|
71
|
+
# zbx send [method] [data] # Send api request to zabbix server, -s is its short term
|
46
72
|
```
|
47
73
|
|
48
74
|
## Contributing
|
@@ -52,3 +78,5 @@ end
|
|
52
78
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
53
79
|
4. Push to the branch (`git push origin my-new-feature`)
|
54
80
|
5. Create new Pull Request
|
81
|
+
|
82
|
+
|
data/lib/zbx.rb
CHANGED
data/lib/zbx/version.rb
CHANGED