Denial of Service (DoS) attacks try to deplete system resources by consuming bandwidth. In this paper the application using Software-Defined Networking (SDN) principles for DoS attack mitigation based on traffic monitoring in a network is proposed. The most important details about the programming aspects of the application using OpenDaylight (ODL) are explained. The application generates both proactive and reactive rules that should be installed in the network devices. Therefore, it is possible to have statistics of the flows and track possible anomalies such as an unexpected increase of the throughput in one or more of the flows. This allows to detect a DoS attack and mitigate it, installing the appropriate rules. Simulation results obtained with the application when using virtual switches in a network with a linear topology are presented.