systemd: hm-module systemd.machines option + warn on fetch failures
This commit is contained in:
parent
dfa3840d97
commit
628ae67b7d
2 changed files with 31 additions and 3 deletions
|
|
@ -240,6 +240,26 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
systemd = moduleOpt "systemd" (
|
||||||
|
(intervalOpt 15000)
|
||||||
|
// {
|
||||||
|
machines = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
example = [
|
||||||
|
"muede-pc2"
|
||||||
|
"monitoring@server.example.com"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
SSH targets to query via `busctl --host=<target>` for the
|
||||||
|
systemd applet's cross-machine tree. May include `localhost` /
|
||||||
|
the local hostname; duplicates are deduped at runtime. SSH
|
||||||
|
auth (keys, known_hosts, ssh config aliases) is the user's
|
||||||
|
responsibility - nova-shell only spawns busctl.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
statsDaemon = lib.mkOption {
|
statsDaemon = lib.mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
description = "Configuration for the nova-stats daemon.";
|
description = "Configuration for the nova-stats daemon.";
|
||||||
|
|
|
||||||
|
|
@ -486,8 +486,12 @@ impl qobject::SystemdService {
|
||||||
local_container_names
|
local_container_names
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(name, _, _)| {
|
.map(|(name, _, _)| {
|
||||||
fetch_via_busctl(name, &["--machine", name], false, "")
|
fetch_via_busctl(name, &["--machine", name], false, "").unwrap_or_else(
|
||||||
.unwrap_or_else(|(k, r)| MachineJson::errored(name.clone(), k, r, 0))
|
|(k, r)| {
|
||||||
|
tracing::warn!(target: "nova_plugin::systemd", machine = %name, kind = k, error = %r, "local container fetch failed");
|
||||||
|
MachineJson::errored(name.clone(), k, r, 0)
|
||||||
|
},
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -555,12 +559,16 @@ impl qobject::SystemdService {
|
||||||
false,
|
false,
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
.unwrap_or_else(|(k, r)| MachineJson::errored(cn.clone(), k, r, 0))
|
.unwrap_or_else(|(k, r)| {
|
||||||
|
tracing::warn!(target: "nova_plugin::systemd", host = %target, machine = %cn, kind = k, error = %r, "remote container fetch failed");
|
||||||
|
MachineJson::errored(cn.clone(), k, r, 0)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
m
|
m
|
||||||
}
|
}
|
||||||
Err((kind, reason)) => {
|
Err((kind, reason)) => {
|
||||||
|
tracing::warn!(target: "nova_plugin::systemd", host = %target, kind = kind, error = %reason, "remote host fetch failed");
|
||||||
MachineJson::errored(target.clone(), kind, reason, prev_last_seen)
|
MachineJson::errored(target.clone(), kind, reason, prev_last_seen)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue