Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d715b452c1 |
Generated
+1
-1
@@ -248,7 +248,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nanometrics-agent"
|
name = "nanometrics-agent"
|
||||||
version = "0.1.12"
|
version = "0.1.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"rumqttc",
|
"rumqttc",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nanometrics-agent"
|
name = "nanometrics-agent"
|
||||||
version = "0.1.12"
|
version = "0.1.13"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ struct SmartJson {
|
|||||||
struct SmartStatus { passed: bool }
|
struct SmartStatus { passed: bool }
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct SmartTemp { current: i64 }
|
struct SmartTemp {
|
||||||
|
#[serde(default)]
|
||||||
|
current: Option<i64>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct SmartAttrs { table: Vec<SmartAttr> }
|
struct SmartAttrs { table: Vec<SmartAttr> }
|
||||||
@@ -44,7 +47,7 @@ pub fn is_available() -> bool {
|
|||||||
pub fn parse_json(json: &str) -> Result<crate::payload::SmartMetrics, serde_json::Error> {
|
pub fn parse_json(json: &str) -> Result<crate::payload::SmartMetrics, serde_json::Error> {
|
||||||
let s: SmartJson = serde_json::from_str(json)?;
|
let s: SmartJson = serde_json::from_str(json)?;
|
||||||
|
|
||||||
let temperature = s.temperature.as_ref().map(|t| t.current)
|
let temperature = s.temperature.as_ref().and_then(|t| t.current)
|
||||||
.or_else(|| s.nvme_smart_health_information_log.as_ref()?.temperature);
|
.or_else(|| s.nvme_smart_health_information_log.as_ref()?.temperature);
|
||||||
|
|
||||||
let mut reallocated = None;
|
let mut reallocated = None;
|
||||||
|
|||||||
Reference in New Issue
Block a user