Skip to content

Monitor to export fuzzer metrics to Prometheus server#875

Merged
domenukk merged 12 commits intoAFLplusplus:mainfrom
peterwhitingyb:prometheus_monitor
Nov 7, 2022
Merged

Monitor to export fuzzer metrics to Prometheus server#875
domenukk merged 12 commits intoAFLplusplus:mainfrom
peterwhitingyb:prometheus_monitor

Conversation

@peterwhitingyb
Copy link
Copy Markdown
Contributor

This implements a monitor (prometheus.rs) to take fuzzer statistics (as well as user defined ones) and host them on a web server in the OpenMetrics format. This is defined within a fuzzer as so:

let listener = "127.0.0.1:8080".to_string();
let monitor = PrometheusMonitor::new(listener,|s| println!("{}", s));

A prometheus server can then be pointed at the user defined IP:PORT to scrape it every n seconds from within prometheus.yml. For dashboards/graphs, prometheus can then be added as a source within something like Grafana.
An example Grafana dashboard may look like this for (2 LibAFL fuzzers running and a prometheus node_exporter for system metrics):
dashboard example

@domenukk
Copy link
Copy Markdown
Member

domenukk commented Nov 1, 2022

This is great! Just a few nits from CI that shouldn't take long:

  • run ./scripts/autofix.sh to fix the clippy errors
  • don't use prelude:: in the library but instead the proper path versions
  • run ./scripts/fmt_all.sh to format the code

Comment thread libafl/Cargo.toml Outdated
self.total_execs(),
self.execs_per_sec()
);
(self.print_fn)(fmt);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this we potentially want the option to stack/join multiple monitors, so that the prometheus monitor doesn't have to print direclty (and could also offer a tui), what do you think @andreafioraldi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is akready the json on disk monitor that iirc does that as example

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of a monitor that wraps two monitors

@domenukk
Copy link
Copy Markdown
Member

domenukk commented Nov 1, 2022

@andreafioraldi seems like your blob search does not ignore ./target?

@andreafioraldi
Copy link
Copy Markdown
Member

target should be in the gitignore

@peterwhitingyb
Copy link
Copy Markdown
Contributor Author

target should be in the gitignore

Just checked and target is the first line of my gitignore

@domenukk
Copy link
Copy Markdown
Member

domenukk commented Nov 7, 2022

Thank you!

@domenukk domenukk merged commit 18f288e into AFLplusplus:main Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants