Search code examples
logfilesdnpox

Accessing and monitoring log file in POX controller


I want to do some analysis on log file in POX controller and I have to do it online. For that, I need the log file of this controller that accumulates online. (For example recording information while h1 ping h2) Can any body help me to find the log file in pox with in network information. Thanks in advance.


Solution

  • You can add listeners for the stats from switches. Add them like so

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

    And in some class methods later

    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)
    

    and

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

    and a method for flow stats. You will get the point. For a full example check https://github.com/tsartsaris/pythess-SDN/blob/master/pythess.py