read socket path from the config
This commit is contained in:
parent
40612cc4c2
commit
e4d1fc7156
|
|
@ -1,5 +1,6 @@
|
|||
[global]
|
||||
period = 1
|
||||
socket = "/var/run/collectd-unixsock"
|
||||
|
||||
[[graph]]
|
||||
name = "cpu load"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ pub struct Config {
|
|||
#[derive(Debug, Deserialize)]
|
||||
pub struct Global {
|
||||
pub period: f32,
|
||||
pub socket: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
|
|
|||
|
|
@ -19,9 +19,8 @@ struct Cli {
|
|||
|
||||
fn main() {
|
||||
let args = Cli::parse();
|
||||
if let Ok(mut proto) = Protocol::new("/var/run/collectd-unixsock") {
|
||||
let config = parse(&args.config);
|
||||
|
||||
if let Ok(mut proto) = Protocol::new(&config.global.socket) {
|
||||
let graphs = config
|
||||
.graph
|
||||
.iter()
|
||||
|
|
|
|||
Loading…
Reference in New Issue