diff options
Diffstat (limited to 'docs/rpc_statsd.md')
-rw-r--r-- | docs/rpc_statsd.md | 73 |
1 files changed, 54 insertions, 19 deletions
diff --git a/docs/rpc_statsd.md b/docs/rpc_statsd.md index 9b3d8d40..003b9c79 100644 --- a/docs/rpc_statsd.md +++ b/docs/rpc_statsd.md @@ -1,18 +1,29 @@ # Remote monitoring and metrics visualization -AFL++ can send out metrics as StatsD messages. For remote monitoring and visualization of the metrics, you can set up a tool chain. For example, with Prometheus and Grafana. All tools are free and open source. +AFL++ can send out metrics as StatsD messages. For remote monitoring and +visualization of the metrics, you can set up a tool chain. For example, with +Prometheus and Grafana. All tools are free and open source. -This enables you to create nice and readable dashboards containing all the information you need on your fuzzer instances. There is no need to write your own statistics parsing system, deploy and maintain it to all your instances, and sync with your graph rendering system. +This enables you to create nice and readable dashboards containing all the +information you need on your fuzzer instances. There is no need to write your +own statistics parsing system, deploy and maintain it to all your instances, and +sync with your graph rendering system. -Compared to the default integrated UI of AFL++, this can help you to visualize trends and the fuzzing state over time. You might be able to see when the fuzzing process has reached a state of no progress and visualize what are the "best strategies" for your targets (according to your own criteria). You can do so without logging into each instance individually. +Compared to the default integrated UI of AFL++, this can help you to visualize +trends and the fuzzing state over time. You might be able to see when the +fuzzing process has reached a state of no progress and visualize what are the +"best strategies" for your targets (according to your own criteria). You can do +so without logging into each instance individually.  -This is an example visualization with Grafana. The dashboard can be imported with [this JSON template](resources/grafana-afl++.json). +This is an example visualization with Grafana. The dashboard can be imported +with [this JSON template](resources/grafana-afl++.json). ## AFL++ metrics and StatsD -StatsD allows you to receive and aggregate metrics from a wide range of applications and retransmit them to a backend of your choice. +StatsD allows you to receive and aggregate metrics from a wide range of +applications and retransmit them to a backend of your choice. From AFL++, StatsD can receive the following metrics: - cur_path @@ -36,35 +47,57 @@ From AFL++, StatsD can receive the following metrics: - var_byte_count - variable_paths -Depending on your StatsD server, you will be able to monitor, trigger alerts, or perform actions based on these metrics (for example: alert on slow exec/s for a new build, threshold of crashes, time since last crash > X, and so on). +Depending on your StatsD server, you will be able to monitor, trigger alerts, or +perform actions based on these metrics (for example: alert on slow exec/s for a +new build, threshold of crashes, time since last crash > X, and so on). ## Setting environment variables in AFL++ -1. To enable the StatsD metrics collection on your fuzzer instances, set the environment variable `AFL_STATSD=1`. By default, AFL++ will send the metrics over UDP to 127.0.0.1:8125. +1. To enable the StatsD metrics collection on your fuzzer instances, set the + environment variable `AFL_STATSD=1`. By default, AFL++ will send the metrics + over UDP to 127.0.0.1:8125. -2. To enable tags for each metric based on their format (banner and afl_version), set the environment variable `AFL_STATSD_TAGS_FLAVOR`. By default, no tags will be added to the metrics. +2. To enable tags for each metric based on their format (banner and + afl_version), set the environment variable `AFL_STATSD_TAGS_FLAVOR`. By + default, no tags will be added to the metrics. The available values are the following: - `dogstatsd` - `influxdb` - `librato` - `signalfx` - - For more information on environment variables, see [env_variables.md](env_variables.md). - Note: When using multiple fuzzer instances with StatsD it is *strongly* recommended to set up `AFL_STATSD_TAGS_FLAVOR` to match your StatsD server. This will allow you to see individual fuzzer performance, detect bad ones, and see the progress of each strategy. + For more information on environment variables, see + [env_variables.md](env_variables.md). -3. Optional: To set the host and port of your StatsD daemon, set `AFL_STATSD_HOST` and `AFL_STATSD_PORT`. The default values are `localhost` and `8125`. + Note: When using multiple fuzzer instances with StatsD it is *strongly* + recommended to set up `AFL_STATSD_TAGS_FLAVOR` to match your StatsD server. + This will allow you to see individual fuzzer performance, detect bad ones, + and see the progress of each strategy. + +3. Optional: To set the host and port of your StatsD daemon, set + `AFL_STATSD_HOST` and `AFL_STATSD_PORT`. The default values are `localhost` + and `8125`. ## Installing and setting up StatsD, Prometheus, and Grafana -The easiest way to install and set up the infrastructure is with Docker and Docker Compose. +The easiest way to install and set up the infrastructure is with Docker and +Docker Compose. -Depending on your fuzzing setup and infrastructure, you may not want to run these applications on your fuzzer instances. This setup may be modified before use in a production environment; for example, adding passwords, creating volumes for storage, tweaking the metrics gathering to get host metrics (CPU, RAM, and so on). +Depending on your fuzzing setup and infrastructure, you may not want to run +these applications on your fuzzer instances. This setup may be modified before +use in a production environment; for example, adding passwords, creating volumes +for storage, tweaking the metrics gathering to get host metrics (CPU, RAM, and +so on). -For all your fuzzing instances, only one instance of Prometheus and Grafana is required. The [statsd exporter](https://registry.hub.docker.com/r/prom/statsd-exporter) converts the StatsD metrics to Prometheus. If you are using a provider that supports StatsD directly, you can skip this part of the setup." +For all your fuzzing instances, only one instance of Prometheus and Grafana is +required. The +[statsd exporter](https://registry.hub.docker.com/r/prom/statsd-exporter) +converts the StatsD metrics to Prometheus. If you are using a provider that +supports StatsD directly, you can skip this part of the setup." -You can create and move the infrastructure files into a directory of your choice. The directory will store all the required configuration files. +You can create and move the infrastructure files into a directory of your +choice. The directory will store all the required configuration files. To install and set up Prometheus and Grafana: @@ -76,6 +109,7 @@ To install and set up Prometheus and Grafana: ``` 2. Create a `docker-compose.yml` containing the following: + ```yml version: '3' @@ -109,7 +143,7 @@ To install and set up Prometheus and Grafana: - "8125:9125/udp" networks: - statsd-net - + grafana: image: grafana/grafana container_name: grafana @@ -134,7 +168,8 @@ To install and set up Prometheus and Grafana: ``` 4. Create a `statsd_mapping.yml` containing the following: - ```yml + + ```yml mappings: - match: "fuzzing.*" name: "fuzzing" @@ -152,4 +187,4 @@ To run your fuzzing instances: AFL_STATSD_TAGS_FLAVOR=dogstatsd AFL_STATSD=1 afl-fuzz -M test-fuzzer-1 -i i -o o [./bin/my-application] @@ AFL_STATSD_TAGS_FLAVOR=dogstatsd AFL_STATSD=1 afl-fuzz -S test-fuzzer-2 -i i -o o [./bin/my-application] @@ ... -``` +``` \ No newline at end of file |