2019-02-06 19:29:27 +01:00
|
|
|
use log::{error, warn, info, debug, trace};
|
2019-02-05 01:20:32 +01:00
|
|
|
use futures::future::lazy;
|
2019-02-01 15:56:35 +01:00
|
|
|
|
2019-02-06 19:29:27 +01:00
|
|
|
mod config;
|
|
|
|
mod metrics;
|
|
|
|
mod ping;
|
|
|
|
use crate::config::{Config, read_config, setup_clap, setup_fern};
|
|
|
|
use crate::metrics::start_serving_metrics;
|
|
|
|
use crate::ping::start_pinging_hosts;
|
2019-02-01 15:56:35 +01:00
|
|
|
|
2019-02-06 19:29:27 +01:00
|
|
|
fn main() {
|
|
|
|
let clap = setup_clap();
|
|
|
|
setup_fern(clap.occurrences_of("v"));
|
|
|
|
let config = match read_config(clap.value_of("config").unwrap()) {
|
|
|
|
Ok(config) => config,
|
|
|
|
Err(_) => {
|
|
|
|
error!("Couldn't read config file!");
|
|
|
|
return;
|
|
|
|
}
|
2019-02-01 15:56:35 +01:00
|
|
|
};
|
|
|
|
|
2019-02-06 19:29:27 +01:00
|
|
|
tokio::run(lazy(move || {
|
|
|
|
start_serving_metrics(&config);
|
|
|
|
start_pinging_hosts(&config);
|
2019-02-05 01:20:32 +01:00
|
|
|
Ok(())
|
|
|
|
}));
|
2019-02-01 15:56:35 +01:00
|
|
|
}
|