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