cooperlees / btrfs_exporter

Export useful btrfs filesystem counters to prometheus.
MIT License
0 stars 1 forks source link

Move the subprocess calls into threads #5

Closed cooperlees closed 2 years ago

cooperlees commented 2 years ago

Need to workout how to get around this:

   Compiling btrfs_exporter v22.7.21 (/Users/cooper/repos/btrfs_exporter)
error[E0597]: `mountpoints` does not live long enough
  --> src/main.rs:72:23
   |
72 |     for mountpoint in mountpoints.split(',') {
   |                       ^^^^^^^^^^^^^^^^^^^^^^
   |                       |
   |                       borrowed value does not live long enough
   |                       argument requires that `mountpoints` is borrowed for `'static`
...
87 | }
   | - `mountpoints` dropped here while still borrowed

For more information about this error, try `rustc --explain E0597`.
error: could not compile `btrfs_exporter` due to previous error
cooperlees commented 2 years ago

Sweet - I can threads:

cooper@home1:~/repos/btrfs_exporter$ cargo run -- --port 9900 /cesspool,/data
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/btrfs_exporter --port 9900 /cesspool,/data`
[2022-07-22T17:36:09Z INFO  btrfs_exporter] Starting btrfs prometheus exporter on port 9900
[2022-07-22T17:36:09Z INFO  prometheus_exporter] exporting metrics to http://[::]:9900/metrics
[2022-07-22T17:36:13Z INFO  btrfs_exporter] 15 btrfs stats collected and served

Another console:

curl http://[::1]:9900/metrics