Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix : test cases with the new orphanage time parameter.

  • Loading branch information...
commit 1ba683cb2d42738aa38c62317e2209ca7451719d 1 parent 71c24e3
@naparuba authored
View
7 shinken/modules/graphite_broker.py
@@ -81,6 +81,7 @@ def init(self):
self.con = socket()
self.con.connect((self.host, self.port))
+
# For a perf_data like /=30MB;4899;4568;1234;0 /var=50MB;4899;4568;1234;0 /toto=
# return ('/', '30'), ('/var', '50')
def get_metric_and_value(self, perf_data):
@@ -122,16 +123,19 @@ def get_metric_and_value(self, perf_data):
res.append((key, value))
return res
+
# Prepare service custom vars
def manage_initial_service_status_brok(self, b):
if '_GRAPHITE_POST' in b.data['customs']:
self.svc_dict[(b.data['host_name'], b.data['service_description'])] = b.data['customs']
+
# Prepare host custom vars
def manage_initial_host_status_brok(self, b):
if '_GRAPHITE_PRE' in b.data['customs']:
self.host_dict[b.data['host_name']] = b.data['customs']
+
# A service check result brok has just arrived, we UPDATE data info with this
def manage_service_check_result_brok(self, b):
data = b.data
@@ -183,6 +187,7 @@ def manage_service_check_result_brok(self, b):
logger.debug("[Graphite broker] Launching: %s" % packet)
self.con.sendall(packet)
+
# A host check result brok has just arrived, we UPDATE data info with this
def manage_host_check_result_brok(self, b):
data = b.data
@@ -216,7 +221,6 @@ def manage_host_check_result_brok(self, b):
self.buffer.append(("%s.__HOST__.%s" % (path, metric),
("%d" % check_time,
"%s" % value)))
-
else:
lines = []
# Send a bulk of all metrics at once
@@ -228,6 +232,7 @@ def manage_host_check_result_brok(self, b):
logger.debug("[Graphite broker] Launching: %s" % packet)
self.con.sendall(packet)
+
def hook_tick(self, brok):
"""Each second the broker calls the hook_tick function
Every tick try to flush the buffer
View
2  test/test_properties_defaults.py
@@ -518,6 +518,7 @@ class TestHost(PropertiesTester, ShinkenTest, unittest.TestCase):
('business_impact', '2'),
('trigger', ''),
('trigger_name', ''),
+ ('time_to_orphanage', '300'),
])
def setUp(self):
@@ -775,6 +776,7 @@ class TestService(PropertiesTester, ShinkenTest, unittest.TestCase):
('business_impact', '2'),
('trigger', ''),
('trigger_name', ''),
+ ('time_to_orphanage', '300'),
])
def setUp(self):
Please sign in to comment.
Something went wrong with that request. Please try again.