zabbixapi 3.1.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +9 -0
- data/CHANGELOG.md +5 -0
- data/{LICENSE → LICENSE.md} +1 -1
- data/README.md +53 -569
- data/lib/zabbixapi.rb +102 -65
- data/lib/zabbixapi/basic/basic_alias.rb +21 -4
- data/lib/zabbixapi/basic/basic_func.rb +56 -23
- data/lib/zabbixapi/basic/basic_init.rb +21 -4
- data/lib/zabbixapi/basic/basic_logic.rb +75 -18
- data/lib/zabbixapi/classes/actions.rb +8 -4
- data/lib/zabbixapi/classes/applications.rb +20 -6
- data/lib/zabbixapi/classes/configurations.rb +23 -17
- data/lib/zabbixapi/classes/errors.rb +2 -4
- data/lib/zabbixapi/classes/graphs.rb +65 -15
- data/lib/zabbixapi/classes/hostgroups.rb +12 -4
- data/lib/zabbixapi/classes/hosts.rb +36 -10
- data/lib/zabbixapi/classes/httptests.rb +24 -4
- data/lib/zabbixapi/classes/items.rb +24 -5
- data/lib/zabbixapi/classes/maintenance.rb +8 -4
- data/lib/zabbixapi/classes/mediatypes.rb +20 -13
- data/lib/zabbixapi/classes/proxies.rb +29 -8
- data/lib/zabbixapi/classes/screens.rb +41 -25
- data/lib/zabbixapi/classes/server.rb +8 -4
- data/lib/zabbixapi/classes/templates.rb +46 -43
- data/lib/zabbixapi/classes/triggers.rb +43 -16
- data/lib/zabbixapi/classes/unusable.rb +0 -2
- data/lib/zabbixapi/classes/usergroups.rb +33 -26
- data/lib/zabbixapi/classes/usermacros.rb +137 -31
- data/lib/zabbixapi/classes/users.rb +32 -10
- data/lib/zabbixapi/classes/valuemaps.rb +50 -0
- data/lib/zabbixapi/client.rb +61 -22
- data/lib/zabbixapi/version.rb +1 -1
- data/zabbixapi.gemspec +26 -23
- metadata +25 -73
- data/.gitignore +0 -7
- data/.rspec +0 -1
- data/.travis.yml +0 -41
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -36
- data/Rakefile +0 -1
- data/json-1.x.Gemfile +0 -4
- data/json-1.x.Gemfile.lock +0 -28
- data/spec/action.rb +0 -89
- data/spec/application.rb +0 -83
- data/spec/basic_func.rb +0 -4
- data/spec/configuration.rb +0 -122
- data/spec/graph.rb +0 -135
- data/spec/host.rb +0 -176
- data/spec/hostgroup.rb +0 -55
- data/spec/httptest.rb +0 -136
- data/spec/item.rb +0 -134
- data/spec/maintenance.rb +0 -81
- data/spec/mediatype.rb +0 -50
- data/spec/query.rb +0 -18
- data/spec/screen.rb +0 -88
- data/spec/script.rb +0 -123
- data/spec/server.rb +0 -15
- data/spec/spec_helper.rb +0 -21
- data/spec/template.rb +0 -148
- data/spec/trigger.rb +0 -103
- data/spec/user.rb +0 -116
- data/spec/usergroup.rb +0 -85
- data/spec/usermacro.rb +0 -190
data/.gitignore
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color --format documentation
|
data/.travis.yml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
language:
|
2
|
-
- ruby
|
3
|
-
addons:
|
4
|
-
postgresql: '9.5'
|
5
|
-
apt:
|
6
|
-
sources:
|
7
|
-
- sourceline: 'deb http://repo.zabbix.com/zabbix/3.0/ubuntu/ trusty main'
|
8
|
-
key_url: 'http://repo.zabbix.com/zabbix-official-repo.key'
|
9
|
-
packages:
|
10
|
-
- php5-pgsql
|
11
|
-
- zabbix-frontend-php
|
12
|
-
- zabbix-server-pgsql
|
13
|
-
services:
|
14
|
-
- postgresql
|
15
|
-
rvm:
|
16
|
-
- 1.9.3
|
17
|
-
- 2.0
|
18
|
-
- 2.1
|
19
|
-
- 2.2
|
20
|
-
- 2.3
|
21
|
-
gemfile:
|
22
|
-
- Gemfile
|
23
|
-
- json-1.x.Gemfile
|
24
|
-
dist: trusty
|
25
|
-
sudo: required
|
26
|
-
|
27
|
-
before_script:
|
28
|
-
- sudo sed -i "s,;date.timezone =,date.timezone = 'US/Eastern'," /etc/php5/apache2/php.ini
|
29
|
-
- psql -c 'create database zabbix;' -U postgres
|
30
|
-
- psql -c 'create user zabbix;' -U postgres
|
31
|
-
- psql -c 'grant all privileges on database zabbix to zabbix;' -U postgres
|
32
|
-
- zcat /usr/share/doc/zabbix-server-pgsql/create.sql.gz | LC_ALL=C psql -U zabbix
|
33
|
-
- echo "$(curl -fsSL https://gist.githubusercontent.com/evtuhovich/9544441/raw/d661863063b76cc8e2599bc44d8595b1f86ece38/zabbix)" | sudo tee /etc/zabbix/web/zabbix.conf.php
|
34
|
-
- sudo service apache2 restart
|
35
|
-
script: "ZABBIX_HOST_URL=http://localhost/zabbix/api_jsonrpc.php bundle exec rspec spec/*"
|
36
|
-
|
37
|
-
matrix:
|
38
|
-
exclude:
|
39
|
-
# json 2.x requires ruby 2.x
|
40
|
-
- rvm: 1.9.3
|
41
|
-
gemfile: json-1.x.Gemfile
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
zabbixapi (3.0.0)
|
5
|
-
json
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
diff-lcs (1.2.5)
|
11
|
-
json (2.0.3)
|
12
|
-
rake (12.0.0)
|
13
|
-
rspec (3.5.0)
|
14
|
-
rspec-core (~> 3.5.0)
|
15
|
-
rspec-expectations (~> 3.5.0)
|
16
|
-
rspec-mocks (~> 3.5.0)
|
17
|
-
rspec-core (3.5.4)
|
18
|
-
rspec-support (~> 3.5.0)
|
19
|
-
rspec-expectations (3.5.0)
|
20
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
-
rspec-support (~> 3.5.0)
|
22
|
-
rspec-mocks (3.5.0)
|
23
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
-
rspec-support (~> 3.5.0)
|
25
|
-
rspec-support (3.5.0)
|
26
|
-
|
27
|
-
PLATFORMS
|
28
|
-
ruby
|
29
|
-
|
30
|
-
DEPENDENCIES
|
31
|
-
rake
|
32
|
-
rspec
|
33
|
-
zabbixapi!
|
34
|
-
|
35
|
-
BUNDLED WITH
|
36
|
-
1.14.3
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
data/json-1.x.Gemfile
DELETED
data/json-1.x.Gemfile.lock
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
diff-lcs (1.2.5)
|
5
|
-
json (1.8.5)
|
6
|
-
rspec (3.5.0)
|
7
|
-
rspec-core (~> 3.5.0)
|
8
|
-
rspec-expectations (~> 3.5.0)
|
9
|
-
rspec-mocks (~> 3.5.0)
|
10
|
-
rspec-core (3.5.4)
|
11
|
-
rspec-support (~> 3.5.0)
|
12
|
-
rspec-expectations (3.5.0)
|
13
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
14
|
-
rspec-support (~> 3.5.0)
|
15
|
-
rspec-mocks (3.5.0)
|
16
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
17
|
-
rspec-support (~> 3.5.0)
|
18
|
-
rspec-support (3.5.0)
|
19
|
-
|
20
|
-
PLATFORMS
|
21
|
-
ruby
|
22
|
-
|
23
|
-
DEPENDENCIES
|
24
|
-
json (~> 1.8)
|
25
|
-
rspec
|
26
|
-
|
27
|
-
BUNDLED WITH
|
28
|
-
1.12.5
|
data/spec/action.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'action' do
|
6
|
-
before do
|
7
|
-
@actionname = gen_name 'action'
|
8
|
-
@usergroupid = zbx.usergroups.create(:name => gen_name('usergroup'))
|
9
|
-
@actiondata = {
|
10
|
-
:name => @actionname,
|
11
|
-
:eventsource => '0', # event source is a triggerid
|
12
|
-
:status => '0', # action is enabled
|
13
|
-
:esc_period => '120', # how long each step should take
|
14
|
-
:def_shortdata => "Email header",
|
15
|
-
:def_longdata => "Email content",
|
16
|
-
:maintenance_mode => '1',
|
17
|
-
:filter => {
|
18
|
-
:evaltype => '1', # perform 'and' between the conditions
|
19
|
-
:conditions => [
|
20
|
-
{
|
21
|
-
:conditiontype => '3', # trigger name
|
22
|
-
:operator => '2', # like
|
23
|
-
:value => 'pattern' # the pattern
|
24
|
-
},
|
25
|
-
{
|
26
|
-
:conditiontype => '4', # trigger severity
|
27
|
-
:operator => '5', # >=
|
28
|
-
:value => '3' # average
|
29
|
-
}
|
30
|
-
]
|
31
|
-
},
|
32
|
-
:operations => [
|
33
|
-
{
|
34
|
-
:operationtype => '0', # send message
|
35
|
-
:opmessage_grp => [ # who the message will be sent to
|
36
|
-
{
|
37
|
-
:usrgrpid => @usergroupid
|
38
|
-
}
|
39
|
-
],
|
40
|
-
:opmessage => {
|
41
|
-
:default_msg => '0', # use default message
|
42
|
-
:mediatypeid => '1' # email id
|
43
|
-
}
|
44
|
-
}
|
45
|
-
],
|
46
|
-
:recovery_operations => [
|
47
|
-
{
|
48
|
-
:operationtype => '11', # send recovery message
|
49
|
-
:opmessage_grp => [ # who the message will be sent to
|
50
|
-
{
|
51
|
-
:usrgrpid => @usergroupid
|
52
|
-
}
|
53
|
-
],
|
54
|
-
:opmessage => {
|
55
|
-
:default_msg => '0', # use default message
|
56
|
-
:mediatypeid => '1' # email id
|
57
|
-
}
|
58
|
-
}
|
59
|
-
]
|
60
|
-
}
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'when not exists' do
|
64
|
-
describe 'create' do
|
65
|
-
it "should return integer id" do
|
66
|
-
actionid = zbx.actions.create(@actiondata)
|
67
|
-
expect(actionid).to be_kind_of(Integer)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context 'when exists' do
|
73
|
-
before do
|
74
|
-
@actionid = zbx.actions.create(@actiondata)
|
75
|
-
end
|
76
|
-
|
77
|
-
describe 'create_or_update' do
|
78
|
-
it "should return id" do
|
79
|
-
expect(zbx.actions.create_or_update(@actiondata)).to eq @actionid
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe 'delete' do
|
84
|
-
it "should return id" do
|
85
|
-
expect(zbx.actions.delete(@actionid)).to eq @actionid
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
data/spec/application.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'application' do
|
6
|
-
before :all do
|
7
|
-
@hostgroup = gen_name 'hostgroup'
|
8
|
-
@hostgroupid = zbx.hostgroups.create(:name => @hostgroup)
|
9
|
-
@template = gen_name 'template'
|
10
|
-
@templateid = zbx.templates.create(
|
11
|
-
:host => @template,
|
12
|
-
:groups => [:groupid => @hostgroupid]
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'when name not exists' do
|
17
|
-
before do
|
18
|
-
@application = gen_name 'application'
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'create' do
|
22
|
-
it "should return integer id" do
|
23
|
-
applicationid = zbx.applications.create(
|
24
|
-
:name => @application,
|
25
|
-
:hostid => @templateid
|
26
|
-
)
|
27
|
-
expect(applicationid).to be_kind_of(Integer)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe 'get_id' do
|
32
|
-
it "should return nil" do
|
33
|
-
expect(zbx.applications.get_id(:name => @application)).to be_kind_of(NilClass)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'when name exists' do
|
39
|
-
before :all do
|
40
|
-
@application = gen_name 'application'
|
41
|
-
@applicationid = zbx.applications.create(
|
42
|
-
:name => @application,
|
43
|
-
:hostid => @templateid
|
44
|
-
)
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'get_or_create' do
|
48
|
-
it "should return id of application" do
|
49
|
-
expect(zbx.applications.get_or_create(
|
50
|
-
:name => @application,
|
51
|
-
:hostid => @templateid
|
52
|
-
)).to eq @applicationid
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe 'get_full_data' do
|
57
|
-
it "should contains created application" do
|
58
|
-
expect(zbx.applications.get_full_data(:name => @application)[0]).to include("name" => @application)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe 'get_id' do
|
63
|
-
it "should return id of application" do
|
64
|
-
expect(zbx.applications.get_id(:name => @application)).to eq @applicationid
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe 'create_or_update' do
|
69
|
-
it "should return id of updated application" do
|
70
|
-
expect(zbx.applications.create_or_update(
|
71
|
-
:name => @application,
|
72
|
-
:hostid => @templateid
|
73
|
-
)).to eq @applicationid
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe "delete" do
|
78
|
-
it "should return id" do
|
79
|
-
expect(zbx.applications.delete(@applicationid)).to eq @applicationid
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
data/spec/basic_func.rb
DELETED
data/spec/configuration.rb
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "configuration" do
|
6
|
-
before :all do
|
7
|
-
@hostgroup = gen_name "hostgroup"
|
8
|
-
@hostgroup_id = zbx.hostgroups.create(:name => @hostgroup)
|
9
|
-
@template = gen_name "template"
|
10
|
-
@template_id = zbx.templates.create(
|
11
|
-
:host => @template,
|
12
|
-
:groups => [:groupid => @hostgroup_id]
|
13
|
-
)
|
14
|
-
@source = zbx.configurations.export(
|
15
|
-
:format => "xml",
|
16
|
-
:options => {
|
17
|
-
:templates => [@template_id]
|
18
|
-
}
|
19
|
-
)
|
20
|
-
@item = gen_name "item"
|
21
|
-
@item_id = zbx.items.create(
|
22
|
-
:name => @item,
|
23
|
-
:description => "item",
|
24
|
-
:key_ => "proc.num[aaa]",
|
25
|
-
:type => 0,
|
26
|
-
:value_type => 3,
|
27
|
-
:hostid => zbx.templates.get_id(:host => @template),
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
after :all do
|
32
|
-
zbx.items.delete(zbx.items.get_id(:name => @item))
|
33
|
-
zbx.templates.delete(zbx.templates.get_id(:host => @template))
|
34
|
-
zbx.hostgroups.delete(zbx.hostgroups.get_id(:name => @hostgroup))
|
35
|
-
end
|
36
|
-
|
37
|
-
context "when object not exists" do
|
38
|
-
describe "import with createMissing" do
|
39
|
-
before do
|
40
|
-
zbx.items.delete(@item_id)
|
41
|
-
zbx.templates.delete(@template_id)
|
42
|
-
zbx.hostgroups.delete(@hostgroup_id)
|
43
|
-
zbx.configurations.import(
|
44
|
-
:format => "xml",
|
45
|
-
:rules => {
|
46
|
-
:groups => {
|
47
|
-
:createMissing => true
|
48
|
-
},
|
49
|
-
:templates => {
|
50
|
-
:createMissing => true
|
51
|
-
}
|
52
|
-
},
|
53
|
-
:source => @source
|
54
|
-
)
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should create object" do
|
58
|
-
expect(zbx.hostgroups.get_id(:name => @hostgroup)).to be_kind_of(Integer)
|
59
|
-
expect(zbx.templates.get_id(:host => @template)).to be_kind_of(Integer)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
context "when object exists" do
|
65
|
-
|
66
|
-
describe "export" do
|
67
|
-
before do
|
68
|
-
zbx.items.create(
|
69
|
-
:name => @item,
|
70
|
-
:description => "item",
|
71
|
-
:key_ => "proc.num[aaa]",
|
72
|
-
:type => 0,
|
73
|
-
:value_type => 3,
|
74
|
-
:hostid => zbx.templates.get_id(:host => @template),
|
75
|
-
)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should export updated object" do
|
79
|
-
expect(zbx.configurations.export(
|
80
|
-
:format => "xml",
|
81
|
-
:options => {
|
82
|
-
:templates => [zbx.templates.get_id(:host => @template)]
|
83
|
-
}
|
84
|
-
)).to match(/#{@item}/)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe "import with updateExisting" do
|
89
|
-
before do
|
90
|
-
@source_updated = zbx.configurations.export(
|
91
|
-
:format => "xml",
|
92
|
-
:options => {
|
93
|
-
:templates => [zbx.templates.get_id(:host => @template)]
|
94
|
-
}
|
95
|
-
)
|
96
|
-
zbx.items.delete(zbx.items.get_id(:name => @item))
|
97
|
-
zbx.configurations.import(
|
98
|
-
:format => "xml",
|
99
|
-
:rules => {
|
100
|
-
:templates => {
|
101
|
-
:updateExisting => true
|
102
|
-
},
|
103
|
-
:items => {
|
104
|
-
:createMissing => true
|
105
|
-
}
|
106
|
-
},
|
107
|
-
:source => @source_updated
|
108
|
-
)
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should update object" do
|
112
|
-
expect(zbx.configurations.export(
|
113
|
-
:format => "xml",
|
114
|
-
:options => {
|
115
|
-
:templates => [zbx.templates.get_id(:host => @template)]
|
116
|
-
}
|
117
|
-
)).to match(/#{@item}/)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
data/spec/graph.rb
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'graph' do
|
6
|
-
before :all do
|
7
|
-
@hostgroup = gen_name 'hostgroup'
|
8
|
-
@hostgroupid = zbx.hostgroups.create(:name => @hostgroup)
|
9
|
-
@template = gen_name 'template'
|
10
|
-
@templateid = zbx.templates.create(
|
11
|
-
:host => @template,
|
12
|
-
:groups => [:groupid => @hostgroupid]
|
13
|
-
)
|
14
|
-
@application = gen_name 'application'
|
15
|
-
@applicationid = zbx.applications.create(
|
16
|
-
:name => @application,
|
17
|
-
:hostid => @templateid
|
18
|
-
)
|
19
|
-
@item = gen_name 'item'
|
20
|
-
@itemid = zbx.items.create(
|
21
|
-
:name => @item,
|
22
|
-
:key_ => "proc.num[#{gen_name 'proc'}]",
|
23
|
-
:status => 0,
|
24
|
-
:hostid => @templateid,
|
25
|
-
:applications => [@applicationid]
|
26
|
-
)
|
27
|
-
|
28
|
-
@color = "123456"
|
29
|
-
end
|
30
|
-
|
31
|
-
def gitems
|
32
|
-
{
|
33
|
-
:itemid => @itemid,
|
34
|
-
:calc_fnc => "3",
|
35
|
-
:color => @color,
|
36
|
-
:type => "0",
|
37
|
-
:periods_cnt => "5"
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
def create_graph(graph, itemid)
|
42
|
-
zbx.graphs.create(
|
43
|
-
:gitems => [gitems],
|
44
|
-
:show_triggers => "0",
|
45
|
-
:name => graph,
|
46
|
-
:width => "900",
|
47
|
-
:height => "200"
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
context 'when name not exists' do
|
53
|
-
describe 'create' do
|
54
|
-
it "should return integer id" do
|
55
|
-
@graph = gen_name 'graph'
|
56
|
-
expect(create_graph(@graph, @itemid)).to be_kind_of(Integer)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'when name exists' do
|
62
|
-
before :all do
|
63
|
-
@graph = gen_name 'graph'
|
64
|
-
@graphid = create_graph(@graph, @itemid)
|
65
|
-
end
|
66
|
-
|
67
|
-
describe 'get_or_create' do
|
68
|
-
it "should return id of existing graph" do
|
69
|
-
expect(zbx.graphs.get_or_create(
|
70
|
-
:gitems => [gitems],
|
71
|
-
:show_triggers => "0",
|
72
|
-
:name => @graph,
|
73
|
-
:width => "900",
|
74
|
-
:height => "200"
|
75
|
-
)).to eq @graphid
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
describe 'get_items' do
|
80
|
-
it "should return array" do
|
81
|
-
expect(zbx.graphs.get_items( @graphid )).to be_kind_of(Array)
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should return array of size 1" do
|
85
|
-
expect(zbx.graphs.get_items( @graphid ).size).to eq 1
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should include correct item" do
|
89
|
-
expect(zbx.graphs.get_items( @graphid )[0]).to include("color" => @color)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
describe 'get_id' do
|
94
|
-
it "should return id" do
|
95
|
-
expect(zbx.graphs.get_id( :name => @graph )).to eq @graphid
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
describe 'get_ids_by_host' do
|
100
|
-
it "should contains id of graph" do
|
101
|
-
graph_array = zbx.graphs.get_ids_by_host( :host => @host )
|
102
|
-
expect(graph_array).to be_kind_of(Array)
|
103
|
-
expect(graph_array).to include(@graphid.to_s)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe 'update' do
|
108
|
-
it "should return id" do
|
109
|
-
expect(zbx.graphs.update(
|
110
|
-
:graphid => @graphid,
|
111
|
-
:gitems => [gitems],
|
112
|
-
:ymax_type => 1
|
113
|
-
)).to eq @graphid
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
describe 'create_or_update' do
|
118
|
-
it "should return existing id" do
|
119
|
-
expect(zbx.graphs.create_or_update(
|
120
|
-
:gitems => [gitems],
|
121
|
-
:show_triggers => "1",
|
122
|
-
:name => @graph,
|
123
|
-
:width => "900",
|
124
|
-
:height => "200"
|
125
|
-
)).to eq @graphid
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe 'delete' do
|
130
|
-
it "should return true" do
|
131
|
-
expect(zbx.graphs.delete(@graphid)).to eq @graphid
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|