Skip to content

Commit 1059fa1

Browse files
cholco202GitHub Enterprise
authored andcommitted
Merge pull request #2 from SDS/vmax_propertiesraw
Vmax propertiesraw
2 parents ce1a893 + 574f75d commit 1059fa1

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

src/vmax.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ where
4848
.basic_auth(config.user.clone(), Some(config.password.clone()))
4949
.send()?
5050
.error_for_status()?;
51-
let deserialized: T = j.json()?;
52-
Ok(deserialized.into_point(Some(point_name)))
51+
let deserialized: Result<T, reqwest::Error> = j.json();
52+
debug!("deserialized: {:?}", deserialized);
53+
Ok(deserialized?.into_point(Some(point_name)))
5354
}
5455

5556
/* Changed the GET to POST and added body parameter to pass additional fields to
@@ -998,12 +999,15 @@ pub fn get_vmax_array_raw(
998999
}
9991000

10001001
// This is split into objects and sub-objects based upon the new Unisphere release v9
1002+
// Added Option here since some of the arrays polled are not returning the same output, may need to be updated again down the road
10011003
#[derive(Debug, Deserialize)]
10021004
pub struct VmaxSystemCapacity {
10031005
#[serde(rename = "symmetrixId")]
10041006
pub symmetrix_id: String,
10051007
pub device_count: u64,
10061008
pub ucode: String,
1009+
#[serde(rename = "targetUcode")]
1010+
pub targetucode: Option<String>,
10071011
pub model: String,
10081012
pub local: bool,
10091013
pub default_fba_srp: String,
@@ -1023,6 +1027,9 @@ impl IntoPoint for VmaxSystemCapacity {
10231027
p.add_tag("symmetrix_id", TsValue::String(self.symmetrix_id.clone()));
10241028
p.add_field("device_count", TsValue::Long(self.device_count));
10251029
p.add_field("ucode", TsValue::String(self.ucode.clone()));
1030+
if let Some(ref target_ucode) = self.targetucode {
1031+
p.add_field("targetucode", TsValue::String(target_ucode.clone()));
1032+
}
10261033
p.add_field("model", TsValue::String(self.model.clone()));
10271034
p.add_field("local", TsValue::Boolean(self.local.clone()));
10281035
p.add_tag(
@@ -1105,19 +1112,22 @@ impl ChildPoint for SystemEfficiency {
11051112
}
11061113
}
11071114

1115+
// Added Option here since some of the arrays polled are not returning the same output, may need to be updated again down the road
11081116
#[allow(non_snake_case)]
11091117
#[derive(Debug, Deserialize)]
11101118
pub struct MetaDataUsage {
1111-
pub system_meta_data_used_percent: f64,
1119+
pub system_meta_data_used_percent: Option<f64>,
11121120
pub replication_cache_used_percent: u64,
11131121
}
11141122

11151123
impl ChildPoint for MetaDataUsage {
11161124
fn sub_point(&self, p: &mut TsPoint) {
1117-
p.add_field(
1118-
"system_meta_data_used_percent",
1119-
TsValue::Float(self.system_meta_data_used_percent),
1120-
);
1125+
if let Some(system_meta_data) = self.system_meta_data_used_percent {
1126+
p.add_field(
1127+
"system_meta_data_used_percent",
1128+
TsValue::Float(system_meta_data),
1129+
);
1130+
}
11211131
p.add_field(
11221132
"replication_cache_used_percent",
11231133
TsValue::Long(self.replication_cache_used_percent),

0 commit comments

Comments
 (0)