Traffic Monitor


Traffic Monitor is a Java Tomcat application that monitors caches, provides health state information to Traffic Router, and collects statistics for use in tools such as Traffic Ops and Traffic Stats. The health state provided by Traffic Monitor is used by Traffic Router to control which caches are available on the CDN.

Software Requirements

To work on Traffic Monitor you need a *nix (MacOS and Linux are most commonly used) environment that has the following installed:

  • Eclipse >= Kepler SR2 (or another Java IDE)
  • Maven >= 3.3.1
  • JDK >= 6.0

Traffic Monitor Project Tree Overview

  • traffic_control/traffic_monitor/ - base directory for Traffic Monitor

    • etc/ - Miscellaneous simulator utilities

    • src/main - Main source directory for the Traffic Monitor

      • bin/ - Configuration tools
      • conf/ - Configuration files
      • java/ - Java source code for Traffic Monitor
      • opt/tomcat/conf - Contains Tomcat configuration file(s) pulled in during an RPM build
      • resources/ - Resources pulled in during an RPM build
      • scripts/ - Scripts used by the RPM build process
      • webapp/ - Java webapp resources
    • src/test - Test source directory for Traffic Monitor

      • java/ - JUnit based unit tests for Traffic Monitor
      • resources/conf - Configuration files used by unit tests
      • resources/db - Files downloaded by unit tests
      • resources/var - Files generated by unit tests

Java Formatting Conventions

None at this time. The codebase will eventually be formatted per Java standards.

Installing The Developer Environment

To install the Traffic Monitor Developer environment:

  1. Clone the traffic_control repository using Git.
  2. Change directories into traffic_control/traffic_monitor.
  3. Edit the following parameters in src/test/resources/conf/traffic_monitor_config.js:
Parameter Value
tm.hostname FQDN of the Traffic Ops instance (do not include http://).
tm.username Admin username for Traffic Ops
tm.password Password for admin user
cdnName Name of the CDN this Traffic Monitor will monitor

Note: any change done later in the configuration file requires a mvn build in order to be applied.

  1. Import the existing git repo into Eclipse:

    1. File -> Import -> Git -> Projects from Git; Next
    2. Existing local repository; Next
    3. Add -> browse to find traffic_control; Add
    4. Select traffic_control; Next
    5. Ensure “Import existing projects” is selected, expand traffic_control, select traffic_monitor; Next
    6. Ensure traffic_monitor is checked; Finish
    7. Ensure traffic_monitor has been opened by Eclipse after importing
  2. Run mvn clean verify from the traffic_monitor directory

  3. Start the embedded Jetty instance from within Eclipse

    1. In the package explorer, expand traffic_monitor

    2. Expand src/test/java

    3. Expand the package

    4. Open and run


      If an error is displayed in the Console, run mvn clean verify from the traffic_monitor directory

    5. With a web browser, navigate to http://localhost:8080

Test Cases

Unit tests can be executed using Maven by running mvn test at the root of the traffic_monitor project.