zabbixlaunch/src/main.rs

26 lines
697 B
Rust
Raw Normal View History

2021-09-09 00:50:28 +02:00
pub mod config;
mod padcontrol;
mod zabbix;
2021-09-05 20:30:24 +02:00
2021-09-09 00:50:28 +02:00
use config::Config;
2021-09-11 23:23:59 +02:00
use zabbix::problems::ZabbixLayout;
2021-09-05 20:30:24 +02:00
2021-09-09 00:50:28 +02:00
fn main() {
2021-09-12 20:16:11 +02:00
let mut datamatrix = ZabbixLayout { layout: Vec::new() };
2021-09-11 23:23:59 +02:00
2021-09-09 09:22:48 +02:00
// parse arguments
2021-09-09 00:50:28 +02:00
let matches = config::argparse();
2021-09-05 20:30:24 +02:00
2021-09-09 09:22:48 +02:00
// load configuration
2021-09-12 20:16:11 +02:00
let configfile = matches.value_of("config").unwrap_or("config.json");
2021-09-09 00:50:28 +02:00
let mut cfg = Config::new();
cfg.load(&configfile);
2021-09-11 23:23:59 +02:00
zabbix::api::get_zabbix_authtoken(&mut cfg);
cfg.save(&configfile);
2021-09-05 20:30:24 +02:00
2021-09-09 09:22:48 +02:00
// init/connect to launchpad and clear it
2021-09-12 20:16:11 +02:00
let (mut canvas, mut _poller) = padcontrol::initpad();
//padcontrol::input(&mut canvas, &mut _poller);
padcontrol::draw(&mut canvas, &mut datamatrix, &mut cfg);
}