[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Gerhard Lausser
gerhard.lausser at consol.de
Tue Feb 28 22:15:17 UTC 2012
The following commit has been merged in the debian/master branch:
commit ceabaa3b3cf35503b5925384097933b180f77406
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date: Sat Jan 21 16:35:43 2012 +0100
Remove the performance test from test_livestatus. There's an extra test_livestatus_perf for that
diff --git a/test/test_livestatus.py b/test/test_livestatus.py
index af4b0f3..e503b6e 100755
--- a/test/test_livestatus.py
+++ b/test/test_livestatus.py
@@ -3382,496 +3382,6 @@ test_host_1;test_router_0,test_router_1;
self.assert_(self.lines_equal(response, good_response))
-
-def isprime(startnumber):
- startnumber*=1.0
- for divisor in range(2,int(startnumber**0.5)+1):
- if startnumber/divisor==int(startnumber/divisor):
- return False
- return True
-
-
-# only for >= 2.7 @skip("skipping a very huge config. uncomment me for performance tests")
-class TestConfigCrazy(TestConfig):
- def setUp(self):
- print "comment me for performance tests"
- self.setup_with_file('etc/nagios_10r_1000h_20000s.cfg')
- self.testid = str(os.getpid() + random.randint(1, 1000))
- self.init_livestatus()
-
- self.sched.fill_initial_broks()
- self.update_broker()
- self.nagios_path = None
- self.livestatus_path = None
- self.nagios_config = None
- # add use_aggressive_host_checking so we can mix exit codes 1 and 2
- # but still get DOWN state
- host = self.sched.hosts.find_by_name("test_host_0000")
- host.__class__.use_aggressive_host_checking = 1
-
-
- def tearDown(self):
- print "comment me for performance tests";
- self.stop_nagios()
- self.livestatus_broker.db.commit()
- self.livestatus_broker.db.close()
- if os.path.exists(self.livelogs):
- os.remove(self.livelogs)
- if os.path.exists(self.livelogs+"-journal"):
- os.remove(self.livelogs+"-journal")
- if os.path.exists(self.livestatus_broker.pnp_path):
- shutil.rmtree(self.livestatus_broker.pnp_path)
- self.livestatus_broker = None
-
-
- def test_perf(self):
- print "comment me for performance tests";
- self.print_header()
- now = time.time()
- objlist = []
- for host in self.sched.hosts:
- objlist.append([host, 0, 'UP'])
- for service in self.sched.services:
- objlist.append([service, 0, 'OK'])
- self.scheduler_loop(1, objlist)
- primes = [num for num in xrange(0, 999) if isprime(num)]
- down_hosts = [self.sched.hosts.find_by_name("test_host_%04d" % num) for num in xrange(0, 1000) if num in primes]
- crit_services = []
- warn_services = []
- for num in [x for x in xrange(100, 200) if x in primes]:
- crit_services.append(self.sched.services.find_srv_by_name_and_hostname("test_host_%04d" % num, "test_ok_01"))
- crit_services.append(self.sched.services.find_srv_by_name_and_hostname("test_host_%04d" % num, "test_ok_05"))
- crit_services.append(self.sched.services.find_srv_by_name_and_hostname("test_host_%04d" % num, "test_ok_11"))
- for num in [x for x in xrange(100, 200) if x in primes]:
- warn_services.append(self.sched.services.find_srv_by_name_and_hostname("test_host_%04d" % num, "test_ok_19"))
-
- for num in [x for x in xrange(201, 999) if x in primes]:
- warn_services.append(self.sched.services.find_srv_by_name_and_hostname("test_host_%04d" % num, "test_ok_03"))
- warn_services.append(self.sched.services.find_srv_by_name_and_hostname("test_host_%04d" % num, "test_ok_07"))
- crit_services.append(self.sched.services.find_srv_by_name_and_hostname("test_host_%04d" % num, "test_ok_13"))
- crit_services.append(self.sched.services.find_srv_by_name_and_hostname("test_host_%04d" % num, "test_ok_17"))
- print "%d services are in a warning state" % len(warn_services)
- print "%d services are in a critical state" % len(crit_services)
- nonok = []
- nonok.extend([[w, 1, "W"] for w in warn_services])
- nonok.extend([[c, 2, "C"] for c in crit_services])
- nonok.extend([[h, 2, "D"] for h in down_hosts])
- print "nonono", nonok
- self.scheduler_loop(1, nonok)
- nonok = []
- nonok.extend([[w, 1, "W"] for w in warn_services if warn_services.index(w) in primes])
- lenw = len(nonok)
- nonok.extend([[c, 2, "C"] for c in crit_services if crit_services.index(c) in primes])
- lenc = len(nonok) - lenw
- nonok.extend([[h, 2, "D"] for h in down_hosts if down_hosts.index(h) in primes])
- lenh = len(nonok) -lenc - lenw
- print "%d hosts are hard/down" % lenh
- print "%d services are in a hard/warning state" % lenw
- print "%d services are in a hard/critical state" % lenc
- self.scheduler_loop(3, nonok)
- self.update_broker()
-
- request = """GET services
-Columns: host_name description state state_type plugin_output
-OutputFormat: csv
-Filter: state != 0
-"""
- response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
- print "query1", len(response.split("\n"))
-
- # Now read services but execute a lot of lambda-functions to read
- # also host attributes
- request = """GET services
-Columns: host_name description state state_type plugin_output host_state host_state_type host_plugin_output
-OutputFormat: csv
-Filter: host_state != 0
-"""
- print "send request 2"
- response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
- print "query2", len(response.split("\n")), " must be 3401"
-
- # Now again the simple services-read, but with limit
- request = """GET services
-Columns: host_name description state state_type plugin_output
-OutputFormat: csv
-Filter: state != 0
-Limit: 5000
-"""
- response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
- print "query3", len(response.split("\n"))
-
- # Now again the services-read with host-lambdas, but with limit
- request = """GET services
-Columns: host_name description state state_type plugin_output host_state host_state_type host_plugin_output
-OutputFormat: csv
-Filter: state != 0
-Limit: 5000
-"""
- response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
- print "query4", len(response.split("\n"))
-
-
- def test_thruk(self):
- self.print_header()
- now = time.time()
- self.update_broker()
- #---------------------------------------------------------------
- # get the full hosts table
- #---------------------------------------------------------------
- request = """GET hosts
-Stats: name !=
-Stats: check_type = 0
-Stats: check_type = 1
-Stats: has_been_checked = 1
-Stats: state = 0
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 1
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 2
-StatsAnd: 2
-Stats: has_been_checked = 0
-Stats: has_been_checked = 0
-Stats: active_checks_enabled = 0
-StatsAnd: 2
-Stats: has_been_checked = 0
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 2
-Stats: state = 0
-Stats: has_been_checked = 1
-Stats: active_checks_enabled = 0
-StatsAnd: 3
-Stats: state = 0
-Stats: has_been_checked = 1
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 3
-Stats: state = 1
-Stats: has_been_checked = 1
-Stats: acknowledged = 1
-StatsAnd: 3
-Stats: state = 1
-Stats: scheduled_downtime_depth > 0
-Stats: has_been_checked = 1
-StatsAnd: 3
-Stats: state = 1
-Stats: active_checks_enabled = 0
-Stats: has_been_checked = 1
-StatsAnd: 3
-Stats: state = 1
-Stats: active_checks_enabled = 1
-Stats: acknowledged = 0
-Stats: scheduled_downtime_depth = 0
-Stats: has_been_checked = 1
-StatsAnd: 5
-Stats: state = 2
-Stats: acknowledged = 1
-Stats: has_been_checked = 1
-StatsAnd: 3
-Stats: state = 2
-Stats: scheduled_downtime_depth > 0
-Stats: has_been_checked = 1
-StatsAnd: 3
-Stats: state = 2
-Stats: active_checks_enabled = 0
-StatsAnd: 2
-Stats: state = 2
-Stats: active_checks_enabled = 1
-Stats: acknowledged = 0
-Stats: scheduled_downtime_depth = 0
-Stats: has_been_checked = 1
-StatsAnd: 5
-Stats: is_flapping = 1
-Stats: flap_detection_enabled = 0
-Stats: notifications_enabled = 0
-Stats: event_handler_enabled = 0
-Stats: active_checks_enabled = 0
-Stats: accept_passive_checks = 0
-Stats: state = 1
-Stats: childs !=
-StatsAnd: 2
-Separators: 10 59 44 124
-ResponseHeader: fixed16"""
- print "Query 1 launched (host status)"
- response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
- print response
-
- #-----------------------------
- # host statistics
- #-----------------------------
- request = """
-GET hosts
-Stats: name !=
-StatsAnd: 1
-Stats: check_type = 0
-StatsAnd: 1
-Stats: check_type = 1
-StatsAnd: 1
-Stats: has_been_checked = 0
-StatsAnd: 1
-Stats: has_been_checked = 0
-Stats: active_checks_enabled = 0
-StatsAnd: 2
-Stats: has_been_checked = 0
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 0
-StatsAnd: 2
-Stats: check_type = 0
-Stats: has_been_checked = 1
-Stats: state = 0
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: check_type = 1
-Stats: has_been_checked = 1
-Stats: state = 0
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: has_been_checked = 1
-Stats: state = 0
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 3
-Stats: has_been_checked = 1
-Stats: state = 1
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: acknowledged = 1
-StatsAnd: 3
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 3
-Stats: check_type = 0
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: check_type = 1
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: active_checks_enabled = 1
-Stats: acknowledged = 0
-Stats: scheduled_downtime_depth = 0
-StatsAnd: 5
-Stats: has_been_checked = 1
-Stats: state = 2
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: acknowledged = 1
-StatsAnd: 3
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 3
-Stats: check_type = 0
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: check_type = 1
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: active_checks_enabled = 1
-Stats: acknowledged = 0
-Stats: scheduled_downtime_depth = 0
-StatsAnd: 5
-Stats: is_flapping = 1
-StatsAnd: 1
-Stats: flap_detection_enabled = 0
-StatsAnd: 1
-Stats: notifications_enabled = 0
-StatsAnd: 1
-Stats: event_handler_enabled = 0
-StatsAnd: 1
-Stats: check_type = 0
-Stats: active_checks_enabled = 0
-StatsAnd: 2
-Stats: check_type = 1
-Stats: active_checks_enabled = 0
-StatsAnd: 2
-Stats: accept_passive_checks = 0
-StatsAnd: 1
-Stats: state = 1
-Stats: childs !=
-StatsAnd: 2
-OutputFormat: json
-ResponseHeader: fixed16
-"""
- print "Query 2 launched (Get hosts stastics)"
- response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
- #print response
-
-
- #-----------------------------
- # host statistics
- #-----------------------------
- # Now Query 3 (service stats)
- query_start = time.time()
- request = """
-GET services
-Stats: description !=
-StatsAnd: 1
-Stats: check_type = 0
-StatsAnd: 1
-Stats: check_type = 1
-StatsAnd: 1
-Stats: has_been_checked = 0
-StatsAnd: 1
-Stats: has_been_checked = 0
-Stats: active_checks_enabled = 0
-StatsAnd: 2
-Stats: has_been_checked = 0
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 0
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 0
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 3
-Stats: check_type = 0
-Stats: has_been_checked = 1
-Stats: state = 0
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: check_type = 1
-Stats: has_been_checked = 1
-Stats: state = 0
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: has_been_checked = 1
-Stats: state = 1
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 3
-Stats: check_type = 0
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: check_type = 1
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: acknowledged = 1
-StatsAnd: 3
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: host_state != 0
-StatsAnd: 3
-Stats: has_been_checked = 1
-Stats: state = 1
-Stats: host_state = 0
-Stats: active_checks_enabled = 1
-Stats: acknowledged = 0
-Stats: scheduled_downtime_depth = 0
-StatsAnd: 6
-Stats: has_been_checked = 1
-Stats: state = 2
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 3
-Stats: check_type = 0
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: check_type = 1
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: acknowledged = 1
-StatsAnd: 3
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: host_state != 0
-StatsAnd: 3
-Stats: has_been_checked = 1
-Stats: state = 2
-Stats: host_state = 0
-Stats: active_checks_enabled = 1
-Stats: acknowledged = 0
-Stats: scheduled_downtime_depth = 0
-StatsAnd: 6
-Stats: has_been_checked = 1
-Stats: state = 3
-StatsAnd: 2
-Stats: has_been_checked = 1
-Stats: state = 3
-Stats: scheduled_downtime_depth > 0
-StatsAnd: 3
-Stats: check_type = 0
-Stats: has_been_checked = 1
-Stats: state = 3
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: check_type = 1
-Stats: has_been_checked = 1
-Stats: state = 3
-Stats: active_checks_enabled = 0
-StatsAnd: 4
-Stats: has_been_checked = 1
-Stats: state = 3
-Stats: acknowledged = 1
-StatsAnd: 3
-Stats: has_been_checked = 1
-Stats: state = 3
-Stats: host_state != 0
-StatsAnd: 3
-Stats: has_been_checked = 1
-Stats: state = 3
-Stats: host_state = 0
-Stats: active_checks_enabled = 1
-Stats: acknowledged = 0
-Stats: scheduled_downtime_depth = 0
-StatsAnd: 6
-Stats: is_flapping = 1
-StatsAnd: 1
-Stats: flap_detection_enabled = 0
-StatsAnd: 1
-Stats: notifications_enabled = 0
-StatsAnd: 1
-Stats: event_handler_enabled = 0
-StatsAnd: 1
-Stats: check_type = 0
-Stats: active_checks_enabled = 0
-StatsAnd: 2
-Stats: check_type = 1
-Stats: active_checks_enabled = 0
-StatsAnd: 2
-Stats: accept_passive_checks = 0
-StatsAnd: 1
-OutputFormat: json
-ResponseHeader: fixed16
-"""
- print "Query 3 launched (Get services statistics)"
- response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
- #print response
-
-
-
if __name__ == '__main__':
#import cProfile
command = """unittest.main()"""
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list