diff --git a/src/fixtures/valid/valid.txt b/src/fixtures/valid/valid.txt index e9b68eb..84fe950 100644 --- a/src/fixtures/valid/valid.txt +++ b/src/fixtures/valid/valid.txt @@ -358,4 +358,3 @@ osd-ldiskfs.testfs-MDT0001.quota_slave.acct_user= usr_accounting: - id: 0 usage: { inodes: 265, kbytes: 356672 } -ldlm.namespaces.filter-ai400-OST0001_UUID.resource_count=0 diff --git a/src/osd_parser.rs b/src/osd_parser.rs index da46e6d..107d6eb 100644 --- a/src/osd_parser.rs +++ b/src/osd_parser.rs @@ -39,9 +39,9 @@ pub(crate) fn params() -> Vec { format!("osd-*.*.{KBYTES_FREE}"), format!("osd-*.*.{KBYTES_TOTAL}"), format!("osd-*.*.{BRW_STATS}"), - format!("osd-*.{QUOTA_ACCT_GRP}"), - format!("osd-*.{QUOTA_ACCT_USR}"), - format!("osd-*.{QUOTA_ACCT_PRJ}"), + format!("osd-*.*.{QUOTA_ACCT_GRP}"), + format!("osd-*.*.{QUOTA_ACCT_USR}"), + format!("osd-*.*.{QUOTA_ACCT_PRJ}"), ] } diff --git a/src/oss/job_stats.rs b/src/oss/job_stats.rs index b995b76..73c8013 100644 --- a/src/oss/job_stats.rs +++ b/src/oss/job_stats.rs @@ -12,7 +12,7 @@ use combine::{ repeat::take_until, }, stream::{Stream, StreamErrorFor}, - Parser, + Parser, eof, }; pub(crate) fn parse() -> impl Parser>> @@ -22,9 +22,10 @@ where { ( optional(newline()), // If Jobstats are present, the whole yaml blob will be on a newline - take_until(attempt((newline(), alpha_num()))), + take_until(attempt((newline(), alpha_num()).map(drop).or(eof()))), ) - .skip(newline()) + .skip(optional(newline())) + .skip(optional(eof())) .and_then(|(_, x): (_, String)| { serde_yaml::from_str(&x) .map(|x: JobStatsOst| x.job_stats) diff --git a/src/parser.rs b/src/parser.rs index d314896..7d2d835 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -22,8 +22,8 @@ pub fn params() -> Vec { .chain(mgs_parser::params()) .chain(oss_parser::params()) .chain(mds_parser::params()) - .chain(ldlm::params()) .chain(quota::params()) + .chain(ldlm::params()) .collect() } @@ -39,8 +39,8 @@ where mgs_parser::parse().map(|x| vec![x]), mds_parser::parse().map(|x| vec![x]), oss_parser::parse().map(|x| vec![x]), - ldlm::parse().map(|x| vec![x]), quota::parse().map(|x| vec![x]), + ldlm::parse().map(|x| vec![x]), ))) .map(|xs: Vec<_>| xs.into_iter().flatten().collect()) } diff --git a/src/quota/quota_parser.rs b/src/quota/quota_parser.rs index cd846ab..b10b857 100644 --- a/src/quota/quota_parser.rs +++ b/src/quota/quota_parser.rs @@ -9,7 +9,7 @@ use crate::{ QuotaKind, QuotaStat, QuotaStatOsd, QuotaStats, TargetQuotaStat, }; use combine::{ - attempt, choice, + attempt, choice, eof, error::{ParseError, StreamError}, many, one_of, optional, parser::{ @@ -51,9 +51,10 @@ where optional(newline()), // If quota stats are present, the whole yaml blob will be on a newline many::, _, _>(alpha_num().or(one_of("_-:".chars()))), // But yaml header might not be properly formatted, ignore it newline(), - take_until(attempt((newline(), alpha_num()))), + take_until(attempt((newline(), alpha_num()).map(drop).or(eof()))), ) - .skip(newline()) + .skip(optional(newline())) + .skip(optional(eof())) .and_then(|(_, _, _, x): (_, _, _, String)| { serde_yaml::from_str::>(&x).map_err(StreamErrorFor::::other) }) @@ -68,9 +69,10 @@ where optional(newline()), // If quota stats are present, the whole yaml blob will be on a newline many::, _, _>(alpha_num().or(one_of("_-:".chars()))), // But yaml header might not be properly formatted, ignore it newline(), - take_until(attempt((newline(), alpha_num()))), + take_until(attempt((newline(), alpha_num()).map(drop).or(eof()))), ) - .skip(newline()) + .skip(optional(newline())) + .skip(optional(eof())) .and_then(|(_, _, _, x): (_, _, _, String)| { serde_yaml::from_str::>(&x).map_err(StreamErrorFor::::other) }) diff --git a/src/snapshots/lustre_collector__parser__tests__node_output.snap b/src/snapshots/lustre_collector__parser__tests__node_output.snap index 0a7b1b8..798125b 100644 --- a/src/snapshots/lustre_collector__parser__tests__node_output.snap +++ b/src/snapshots/lustre_collector__parser__tests__node_output.snap @@ -2374,20 +2374,6 @@ expression: result }, ), ), - Target( - ResourceCount( - TargetStat { - kind: Ost, - param: Param( - "resource_count", - ), - target: Target( - "ai400-OST0001", - ), - value: 0, - }, - ), - ), ], "", ) diff --git a/src/snapshots/lustre_collector__parser__tests__params.snap b/src/snapshots/lustre_collector__parser__tests__params.snap index 7980461..6c7b2fb 100644 --- a/src/snapshots/lustre_collector__parser__tests__params.snap +++ b/src/snapshots/lustre_collector__parser__tests__params.snap @@ -15,6 +15,9 @@ expression: params() "osd-*.*.kbytesfree", "osd-*.*.kbytestotal", "osd-*.*.brw_stats", + "osd-*.*.quota_slave.acct_group", + "osd-*.*.quota_slave.acct_user", + "osd-*.*.quota_slave.acct_project", "mdt.*.exports.*.uuid", "mgs.*.mgs.stats", "mgs.*.mgs.threads_max", @@ -30,6 +33,9 @@ expression: params() "mdt.*.job_stats", "mdt.*.md_stats", "mdt.*MDT*.num_exports", + "qmt.*.*.glb-usr", + "qmt.*.*.glb-prj", + "qmt.*.*.glb-grp", "ldlm.namespaces.{mdt-,filter-}*.contended_locks", "ldlm.namespaces.{mdt-,filter-}*.contention_seconds", "ldlm.namespaces.{mdt-,filter-}*.ctime_age_limit",