Пример #1
0
 def log(self, log_msg, level=SandeshLevel.SYS_DEBUG, fun=None):
     if fun:
         log = fun(level=level, og_msg=log_msg, sandesh=self._sandesh)
         log.send(sandesh=self._sandesh)
     else:
         self._sandesh.logger().log(
                 SandeshLogger.get_py_logger_level(level), log_msg)
 def send_database_status(self):
     cassandra_status_uve = CassandraStatusUVE()
     cassandra_status = CassandraStatusData()
     cassandra_status.cassandra_compaction_task = CassandraCompactionTask()
     # Get compactionstats
     compaction_count = subprocess.Popen("nodetool compactionstats|grep 'pending tasks:'",
         shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     op, err = compaction_count.communicate()
     if compaction_count.returncode != 0:
         msg = "Failed to get nodetool compactionstats " + err
         self.msg_log(msg, level=SandeshLevel.SYS_ERR)
         return
     cassandra_status.cassandra_compaction_task.pending_compaction_tasks = \
         self.get_pending_compaction_count(op)
     # Get the tpstats value
     tpstats_op = subprocess.Popen(["nodetool", "tpstats"], stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
     op, err = tpstats_op.communicate()
     if tpstats_op.returncode != 0:
         msg = "Failed to get nodetool tpstats " + err
         self.msg_log(msg, level=SandeshLevel.SYS_ERR)
         return
     cassandra_status.thread_pool_stats = self.get_tp_status(op)
     cassandra_status.name = socket.gethostname()
     cassandra_status_uve = CassandraStatusUVE(data=cassandra_status)
     msg = 'Sending UVE: ' + str(cassandra_status_uve)
     self.sandesh_global.logger().log(SandeshLogger.get_py_logger_level(
                         SandeshLevel.SYS_DEBUG), msg)
     cassandra_status_uve.send()
Пример #3
0
 def log(self, log_msg, level=SandeshLevel.SYS_DEBUG, fun=None):
     if fun:
         log = fun(level=level, og_msg=log_msg, sandesh=self._sandesh)
         log.send(sandesh=self._sandesh)
     else:
         self._sandesh.logger().log(
             SandeshLogger.get_py_logger_level(level), log_msg)
 def send_database_status(self):
     cassandra_status_uve = CassandraStatusUVE()
     cassandra_status = CassandraStatusData()
     cassandra_status.cassandra_compaction_task = CassandraCompactionTask()
     # Get compactionstats
     compaction_count = subprocess.Popen(
         "nodetool compactionstats|grep 'pending tasks:'",
         shell=True,
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE)
     op, err = compaction_count.communicate()
     if compaction_count.returncode != 0:
         msg = "Failed to get nodetool compactionstats " + err
         self.msg_log(msg, level=SandeshLevel.SYS_ERR)
         return
     cassandra_status.cassandra_compaction_task.pending_compaction_tasks = \
         self.get_pending_compaction_count(op)
     # Get the tpstats value
     tpstats_op = subprocess.Popen(["nodetool", "tpstats"],
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
     op, err = tpstats_op.communicate()
     if tpstats_op.returncode != 0:
         msg = "Failed to get nodetool tpstats " + err
         self.msg_log(msg, level=SandeshLevel.SYS_ERR)
         return
     cassandra_status.thread_pool_stats = self.get_tp_status(op)
     cassandra_status.name = socket.gethostname()
     cassandra_status_uve = CassandraStatusUVE(data=cassandra_status)
     msg = 'Sending UVE: ' + str(cassandra_status_uve)
     self.sandesh_global.logger().log(
         SandeshLogger.get_py_logger_level(SandeshLevel.SYS_DEBUG), msg)
     cassandra_status_uve.send()
Пример #5
0
    def syslog(self, msg, *args, **kwargs):
        if not self._logger:
            return
        level = kwargs.get('level', 'info')
        if isinstance(level, int):
            from pysandesh.sandesh_logger import SandeshLogger
            level = SandeshLogger.get_py_logger_level(level)

        log_method = getattr(self._logger, level, self._logger.info)
        log_method(msg)
Пример #6
0
    def syslog(self, msg, *args, **kwargs):
        if not self._logger:
            return
        level = kwargs.get('level', 'info')
        if isinstance(level, int):
            from pysandesh.sandesh_logger import SandeshLogger
            level = SandeshLogger.get_py_logger_level(level)

        log_method = getattr(self._logger, level, self._logger.info)
        log_method(msg)
Пример #7
0
 def syslog(self, log_msg, level):
     """ Log to syslog. """
     self._sandesh.logger().log(
         SandeshLogger.get_py_logger_level(level), log_msg)
Пример #8
0
 def msg_log(self, msg, level):
     self.logger.log(SandeshLogger.get_py_logger_level(level), msg)
Пример #9
0
 def syslog(self, log_msg, level):
     """ Log to syslog. """
     self._sandesh.logger().log(
         SandeshLogger.get_py_logger_level(level), log_msg)
 def msg_log(self, msg, level):
     self.sandesh_global.logger().log(SandeshLogger.get_py_logger_level(
                         level), msg)
 def _logger(self, msg, level):
     logging.log(SandeshLogger.get_py_logger_level(level), msg)
 def msg_log(self, msg, level):
     self.sandesh_instance.logger().log(SandeshLogger.get_py_logger_level(
                         level), msg)
Пример #13
0
 def msg_log(self, msg, level):
     self.sandesh_global.logger().log(
         SandeshLogger.get_py_logger_level(level), msg)
 def _logger(self, msg, level):
     logging.log(SandeshLogger.get_py_logger_level(level), msg)
 def msg_log(self, msg, level):
     self.logger.log(SandeshLogger.get_py_logger_level(level), msg)