|
@@ -251,14 +251,9 @@ class Stats:
|
|
# It counts the number of instances of same module by
|
|
# It counts the number of instances of same module by
|
|
# examining the third value from the array result of
|
|
# examining the third value from the array result of
|
|
# 'show_processes' of Init
|
|
# 'show_processes' of Init
|
|
- seq = self.cc_session.group_sendmsg(
|
|
|
|
- isc.config.ccsession.create_command("show_processes"),
|
|
|
|
- 'Init')
|
|
|
|
- (answer, env) = self.cc_session.group_recvmsg(False, seq)
|
|
|
|
- modules = []
|
|
|
|
- if answer:
|
|
|
|
- (rcode, value) = isc.config.ccsession.parse_answer(answer)
|
|
|
|
- if rcode == 0 and type(value) is list:
|
|
|
|
|
|
+ try:
|
|
|
|
+ value = self.mccs.rpc_call('show_processes', 'Init')
|
|
|
|
+ if type(value) is list:
|
|
# NOTE: For example, the "show_processes" command
|
|
# NOTE: For example, the "show_processes" command
|
|
# of Init is assumed to return the response in this
|
|
# of Init is assumed to return the response in this
|
|
# format:
|
|
# format:
|
|
@@ -286,6 +281,10 @@ class Stats:
|
|
# release.
|
|
# release.
|
|
modules = [ v[2] if type(v) is list and len(v) > 2 \
|
|
modules = [ v[2] if type(v) is list and len(v) > 2 \
|
|
else None for v in value ]
|
|
else None for v in value ]
|
|
|
|
+ except isc.config.RPCError:
|
|
|
|
+ # TODO: Is it OK to just pass? As part of refactoring, preserving
|
|
|
|
+ # the original behaviour.
|
|
|
|
+ pass
|
|
# start requesting each module to collect statistics data
|
|
# start requesting each module to collect statistics data
|
|
sequences = []
|
|
sequences = []
|
|
for (module_name, data) in self.get_statistics_data().items():
|
|
for (module_name, data) in self.get_statistics_data().items():
|
|
@@ -296,7 +295,10 @@ class Stats:
|
|
module_name)
|
|
module_name)
|
|
cmd = isc.config.ccsession.create_command(
|
|
cmd = isc.config.ccsession.create_command(
|
|
"getstats", None) # no argument
|
|
"getstats", None) # no argument
|
|
- seq = self.cc_session.group_sendmsg(cmd, module_name)
|
|
|
|
|
|
+ # Not using rpc_call here, we query a lot of modules in parallel
|
|
|
|
+ # here
|
|
|
|
+ seq = self.cc_session.group_sendmsg(cmd, module_name,
|
|
|
|
+ want_answer=True)
|
|
sequences.append((module_name, seq))
|
|
sequences.append((module_name, seq))
|
|
cnt = modules.count(module_name)
|
|
cnt = modules.count(module_name)
|
|
if cnt > 1:
|
|
if cnt > 1:
|
|
@@ -421,21 +423,17 @@ class Stats:
|
|
raises StatsError.
|
|
raises StatsError.
|
|
"""
|
|
"""
|
|
modules = {}
|
|
modules = {}
|
|
- seq = self.cc_session.group_sendmsg(
|
|
|
|
- isc.config.ccsession.create_command(
|
|
|
|
- isc.config.ccsession.COMMAND_GET_STATISTICS_SPEC),
|
|
|
|
- 'ConfigManager')
|
|
|
|
- (answer, env) = self.cc_session.group_recvmsg(False, seq)
|
|
|
|
- if answer:
|
|
|
|
- (rcode, value) = isc.config.ccsession.parse_answer(answer)
|
|
|
|
- if rcode == 0:
|
|
|
|
- for mod in value:
|
|
|
|
- spec = { "module_name" : mod }
|
|
|
|
- if value[mod] and type(value[mod]) is list:
|
|
|
|
- spec["statistics"] = value[mod]
|
|
|
|
- modules[mod] = isc.config.module_spec.ModuleSpec(spec)
|
|
|
|
- else:
|
|
|
|
- raise StatsError("Updating module spec fails: " + str(value))
|
|
|
|
|
|
+ try:
|
|
|
|
+ value = self.mccs.rpc_call(isc.config.ccsession. \
|
|
|
|
+ COMMAND_GET_STATISTICS_SPEC,
|
|
|
|
+ 'ConfigManager')
|
|
|
|
+ except isc.config.RPCError as e:
|
|
|
|
+ raise StatsError("Updating module spec fails: " + str(e))
|
|
|
|
+ for mod in value:
|
|
|
|
+ spec = { "module_name" : mod }
|
|
|
|
+ if value[mod] and type(value[mod]) is list:
|
|
|
|
+ spec["statistics"] = value[mod]
|
|
|
|
+ modules[mod] = isc.config.module_spec.ModuleSpec(spec)
|
|
modules[self.module_name] = self.mccs.get_module_spec()
|
|
modules[self.module_name] = self.mccs.get_module_spec()
|
|
self.modules = modules
|
|
self.modules = modules
|
|
|
|
|