spec/localhost.rb in zabbixapi-0.4.7 vs spec/localhost.rb in zabbixapi-0.4.8
- old
+ new
@@ -1,11 +1,10 @@
require 'zabbixapi'
# settings
#api_url = 'http://zabbix/zabbix12/api_jsonrpc.php'
-api_url = 'http://zabbix/zabbix13/api_jsonrpc.php'
-api_url = 'http://monitor02.undev.cc/api_jsonrpc.php'
+api_url = 'http://zabbix/api_jsonrpc.php'
#api_url = 'http://zabbix/zabbix20/api_jsonrpc.php'
api_login = 'Admin'
api_password = 'zabbix'
@@ -189,17 +188,10 @@
:hosts_id => [zbx.hosts.get_id(:host => host)],
:templates_id => [zbx.templates.get_id(:host => template)]
).should be_kind_of(TrueClass)
end
- it "TEMPLATE: Unlink hosts from templates" do
- zbx.templates.mass_remove(
- :hosts_id => [zbx.hosts.get_id(:host => host)],
- :templates_id => [zbx.templates.get_id(:host => template)]
- ).should be_kind_of(TrueClass)
- end
-
it "TEMPLATE: Get all" do
zbx.templates.all.should be_kind_of(Hash)
end
it "TRIGGER: Create" do
@@ -256,10 +248,14 @@
it "GRAPH: Find" do
zbx.graphs.get_id( :name => graph ).should be_kind_of(Integer)
end
+ it "GRAPH: get_ids_by_host" do
+ zbx.graphs.get_ids_by_host( :host => host ).should be_kind_of(Array)
+ end
+
it "GRAPH: Update" do
zbx.graphs.update(
:graphid => zbx.graphs.get_id(
:name => graph,
:hostid => zbx.hosts.get_id(:host => host)
@@ -280,9 +276,29 @@
:show_triggers => "1",
:name => graph,
:width => "900",
:height => "200"
).should be_kind_of(Integer)
+ end
+
+ it "SCREEN: Get or create for host" do
+ zbx.screens.get_or_create_for_host(
+ :host => host,
+ :graphids => zbx.graphs.get_ids_by_host(:host => host)
+ ).should be_kind_of(Integer)
+ end
+
+ it "TEMPLATE: Unlink hosts from templates" do
+ zbx.templates.mass_remove(
+ :hosts_id => [zbx.hosts.get_id(:host => host)],
+ :templates_id => [zbx.templates.get_id(:host => template)]
+ ).should be_kind_of(TrueClass)
+ end
+
+ it "SCREEN: Delete" do
+ zbx.screens.delete(
+ [zbx.screens.get_id(:name => "#{host}_graphs")]
+ ).should be_kind_of(Integer)
end
it "GRAPH: Delete" do
zbx.graphs.delete(zbx.graphs.get_id(:name => graph)).should be_kind_of(Integer)
end