访问和监控 POX 控制器中的日志文件

Accessing and monitoring log file in POX controller

我想对 POX 控制器中的日志文件做一些分析,我必须在线进行。为此,我需要在线累积的该控制器的日志文件。 (例如在 h1 ping h2 时记录信息) 任何人都可以帮助我在网络信息中找到 pox 中的日志文件。提前致谢。

您可以为开关的统计信息添加侦听器。像这样添加它们

core.openflow.addListenerByName("FlowStatsReceived", self._handle_flowstats_received)
core.openflow.addListenerByName("PortStatsReceived", self._handle_portstats_received)
core.openflow.addListenerByName("QueueStatsReceived", self._handle_qeuestats_received)

并且在之后的一些class方法中

def _handle_qeuestats_received (self, event):
        """
        handler to manage queued packets statistics received
        Args:
            event: Event listening to QueueStatsReceived from openflow
        """
        stats = flow_stats_to_list(event.stats)
        # log.info("QueueStatsReceived from %s: %s", dpidToStr(event.connection.dpid), stats)

def _handle_portstats_received(self,event):
    """
    Handler to manage port statistics received
    Args:
        event: Event listening to PortStatsReceived from openflow
    """
    print event.stats

和流量统计方法。你会明白这一点的。有关完整示例,请检查 https://github.com/tsartsaris/pythess-SDN/blob/master/pythess.py