Parcourir la source

[2136] added a new message id for getting invalid statistics data from the
module

Naoki Kambe il y a 13 ans
Parent
commit
da81d3d6b9
2 fichiers modifiés avec 21 ajouts et 20 suppressions
  1. 16 19
      src/bin/stats/stats.py.in
  2. 5 1
      src/bin/stats/stats_messages.mes

+ 16 - 19
src/bin/stats/stats.py.in

@@ -160,15 +160,13 @@ class Stats:
         logger.info(STATS_STARTING)
         logger.info(STATS_STARTING)
 
 
         # initialized Statistics data
         # initialized Statistics data
-        errors = self.update_statistics_data(
+        if self.update_statistics_data(
             self.module_name,
             self.module_name,
             lname=self.cc_session.lname,
             lname=self.cc_session.lname,
             boot_time=get_datetime(_BASETIME),
             boot_time=get_datetime(_BASETIME),
-            last_update_time=get_datetime()
-            )
-        if errors:
-            raise StatsError("stats spec file is incorrect: "
-                             + ", ".join(errors))
+            last_update_time=get_datetime()):
+            logger.warn(STATS_RECEIVED_INVALID_STATISTICS_DATA,
+                        self.module_name)
 
 
         def _poll_modules():
         def _poll_modules():
             """poll modules for statistics data"""
             """poll modules for statistics data"""
@@ -195,7 +193,7 @@ class Stats:
             for (module_name, data) in self.get_statistics_data().items():
             for (module_name, data) in self.get_statistics_data().items():
                 # skip if module_name is 'Stats'
                 # skip if module_name is 'Stats'
                 if module_name == self.module_name: continue
                 if module_name == self.module_name: continue
-                logger.debug(DBG_STATS_MESSAGING, STATS_SEND_REQUEST,
+                logger.debug(DBG_STATS_MESSAGING, STATS_SEND_STATISTICS_REQUEST,
                              module_name)
                              module_name)
                 cmd = isc.config.ccsession.create_command(
                 cmd = isc.config.ccsession.create_command(
                     "getstats", {'trees': [k for k in data.keys()]})
                     "getstats", {'trees': [k for k in data.keys()]})
@@ -210,20 +208,19 @@ class Stats:
                         if answer:
                         if answer:
                             rcode, args = isc.config.ccsession.parse_answer(answer)
                             rcode, args = isc.config.ccsession.parse_answer(answer)
                         if rcode == 0:
                         if rcode == 0:
-                            errors = self.update_statistics_data(
-                                module_name, env['from'], **args)
-                            if errors:
-                                raise StatsError("spec file is incorrect: "
-                                                 + ", ".join(errors))
-                            errors = self.update_statistics_data(
-                                        self.module_name,
-                                        last_update_time=get_datetime())
-                            if errors:
-                                raise StatsError("stats spec file is incorrect: "
-                                                 + ", ".join(errors))
+                            if self.update_statistics_data(
+                                module_name, env['from'], **args):
+                                logger.warn(STATS_RECEIVED_INVALID_STATISTICS_DATA,
+                                            module_name)
+                            else:
+                                if self.update_statistics_data(
+                                    self.module_name,
+                                    last_update_time=get_datetime()):
+                                    logger.warn(STATS_RECEIVED_INVALID_STATISTICS_DATA,
+                                                self.module_name)
                 # skip this module if SessionTimeout raised
                 # skip this module if SessionTimeout raised
                 except isc.cc.session.SessionTimeout:
                 except isc.cc.session.SessionTimeout:
-                    raise
+                    pass
 
 
         try:
         try:
             start_poll = get_timestamp() - self.config['poll-interval']
             start_poll = get_timestamp() - self.config['poll-interval']

+ 5 - 1
src/bin/stats/stats_messages.mes

@@ -53,7 +53,11 @@ response indicating that it is running normally.
 An unknown command has been sent to the stats module. The stats module
 An unknown command has been sent to the stats module. The stats module
 will respond with an error and the command will be ignored.
 will respond with an error and the command will be ignored.
 
 
-% STATS_SEND_REQUEST requesting %1 to send statistics
+% STATS_RECEIVED_INVALID_STATISTICS_DATA received invalid statistics data from %1
+Invalid statistics data has been received from the module while
+polling and it has been discarded.
+
+% STATS_SEND_STATISTICS_REQUEST requesting %1 to send statistics
 This debug message is printed when a request is sent to the module
 This debug message is printed when a request is sent to the module
 to send its data to the stats module.
 to send its data to the stats module.