Skip to content
Browse files

Merge branch 'services-r11'

Change-Id: Iccb5473b2aad7eabb649e4ed7a52f86cc3898ca9
  • Loading branch information...
2 parents 930a58d + 9ac3abe commit e2d6733098a90a0139b777304a201ae9e486cbe5 @kushmerick kushmerick committed
View
6 collector/lib/collector.rb
@@ -45,6 +45,9 @@ module Collector
REDIS_PROVISIONER = "RaaS-Provisioner"
REDIS_NODE = "RaaS-Node"
+ VBLOB_PROVISIONER = "VBlobaaS-Provisioner"
+ VBLOB_NODE = "VBlobaaS-Node"
+
SERIALIZATION_DATA_SERVER = "SerializationDataServer"
BACKUP_MANAGER = "BackupManager"
@@ -72,7 +75,8 @@ def initialize
MONGODB_PROVISIONER, MONGODB_NODE,
NEO4J_PROVISIONER, NEO4J_NODE,
RABBITMQ_PROVISIONER, RABBITMQ_NODE,
- REDIS_PROVISIONER, REDIS_NODE])
+ REDIS_PROVISIONER, REDIS_NODE,
+ VBLOB_PROVISIONER, VBLOB_NODE])
@service_auxiliary_components = Set.new([SERIALIZATION_DATA_SERVER,
BACKUP_MANAGER])
View
1 collector/lib/collector/handlers/mongodb_provisioner.rb
@@ -7,6 +7,7 @@ class MongodbProvisioner < ServiceHandler
def process(varz)
process_plan_score_metric(varz)
+ process_online_nodes(varz)
end
def service_type
View
1 collector/lib/collector/handlers/mysql_provisioner.rb
@@ -7,6 +7,7 @@ class MysqlProvisioner < ServiceHandler
def process(varz)
process_plan_score_metric(varz)
+ process_online_nodes(varz)
end
def service_type
View
1 collector/lib/collector/handlers/neo4j_provisioner.rb
@@ -7,6 +7,7 @@ class Neo4jProvisioner < ServiceHandler
def process(varz)
process_plan_score_metric(varz)
+ process_online_nodes(varz)
end
def service_type
View
1 collector/lib/collector/handlers/postgresql_gateway.rb
@@ -7,6 +7,7 @@ class PostgresqlProvisioner < ServiceHandler
def process(varz)
process_plan_score_metric(varz)
+ process_online_nodes(varz)
end
def service_type
View
1 collector/lib/collector/handlers/rabbitmq_gateway.rb
@@ -7,6 +7,7 @@ class RabbitmqProvisioner < ServiceHandler
def process(varz)
process_plan_score_metric(varz)
+ process_online_nodes(varz)
end
def service_type
View
1 collector/lib/collector/handlers/redis_gateway.rb
@@ -7,6 +7,7 @@ class RedisProvisioner < ServiceHandler
def process(varz)
process_plan_score_metric(varz)
+ process_online_nodes(varz)
end
def service_type
View
23 collector/lib/collector/handlers/vblob_gateway.rb
@@ -0,0 +1,23 @@
+# Copyright (c) 2009-2012 VMware, Inc.
+
+module Collector
+ class Handler
+ class VblobProvisioner < ServiceHandler
+ register VBLOB_PROVISIONER
+
+ def process(varz)
+ process_plan_score_metric(varz)
+ process_online_nodes(varz)
+ end
+
+ def service_type
+ "vblob"
+ end
+
+ def component
+ "gateway"
+ end
+
+ end
+ end
+end
View
22 collector/lib/collector/handlers/vblob_node.rb
@@ -0,0 +1,22 @@
+# Copyright (c) 2009-2012 VMware, Inc.
+
+module Collector
+ class Handler
+ class VblobNode < ServiceHandler
+ register VBLOB_NODE
+
+ def process(varz)
+ process_healthy_instances_metric(varz)
+ end
+
+ def service_type
+ "vblob"
+ end
+
+ def component
+ "node"
+ end
+
+ end
+ end
+end
View
8 collector/lib/collector/service_handler.rb
@@ -43,6 +43,14 @@ def process_plan_score_metric(varz)
end if varz["plans"]
end
+ # Get online nodes varz for each service gateway, report the total
+ # number of online nodes
+ #
+ def process_online_nodes(varz)
+ return unless varz.include?("nodes")
+ send_metric("services.online_nodes", varz["nodes"].length)
+ end
+
def service_type # "mysql", "postgresql", "mongodb" ...
"unknown"
end
View
23 collector/spec/unit/collector/service_handler_spec.rb
@@ -64,4 +64,27 @@
end
end
+ describe :process_online_nodes do
+ it "should report online nodes number to TSDB server" do
+ connection = mock(:TsdbConnection)
+ connection.should_receive(:send_data).
+ with("put services.online_nodes 10000 2 component=unknown index=1 " \
+ "job=Test service_type=unknown\n")
+ handler = Collector::ServiceHandler.new(connection, "Test", 1, 10000)
+ varz = {
+ "nodes" => {
+ "node_0" => {
+ "available_capacity" => 50,
+ "plan" => "free"
+ },
+ "node_1" => {
+ "available_capacity" => 50,
+ "plan" => "free"
+ }
+ }
+ }
+ handler.process_online_nodes(varz)
+ end
+ end
+
end

0 comments on commit e2d6733

Please sign in to comment.
Something went wrong with that request. Please try again.