From ff68178e42261a333d84811e6a50109974eb3f81 Mon Sep 17 00:00:00 2001 From: prplV Date: Fri, 4 Apr 2025 09:01:25 -0400 Subject: [PATCH 1/2] +zero status --- crates/api-grub/src/monitoring.rs | 3 ++- crates/integr-structs/src/api.rs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/api-grub/src/monitoring.rs b/crates/api-grub/src/monitoring.rs index 2e71e8d..a2be58f 100644 --- a/crates/api-grub/src/monitoring.rs +++ b/crates/api-grub/src/monitoring.rs @@ -405,7 +405,8 @@ impl MonitoringImporter { }, addr : "enode.monitoring.api".to_owned(), desc : description, - value : val.clone() + value : val.clone(), + status: 0, }) } } diff --git a/crates/integr-structs/src/api.rs b/crates/integr-structs/src/api.rs index 4c72b68..02f1170 100644 --- a/crates/integr-structs/src/api.rs +++ b/crates/integr-structs/src/api.rs @@ -271,6 +271,7 @@ pub mod v3 { pub value : Value, #[serde(rename = "description")] pub desc : String, + pub status: usize, } impl MetricOutputExtended { pub fn new_with_slices(id : &str, json_type : &str, addr: &str, desc : &str, value : Value) -> Self { @@ -280,6 +281,7 @@ pub mod v3 { addr : addr.to_string(), value : value, desc : desc.to_string(), + status: 0, } } } From dfeb0dbfa947719bbc8451d090adb80a302b50f5 Mon Sep 17 00:00:00 2001 From: prplV Date: Fri, 4 Apr 2025 09:18:43 -0400 Subject: [PATCH 2/2] status model supprt --- .env.example | 4 ++++ crates/api-grub/src/export.rs | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index bbf58ee..f17f574 100644 --- a/.env.example +++ b/.env.example @@ -9,6 +9,10 @@ DB_DBNAME = "db_name"1 # Prometheus-Exporter info EXPORTER_URL = "http(s)://ip.ip.ip.ip:port" +# Status Model API support +# > if exists, ignore `EXPORTER_URL` var +STATUS_SYSTEM_URL = "http://192.168.2.39:9999/api/input" + # eNODE.Monitoring configuration ENODE_MONITORING_IP = "ip.ip.ip.ip" ENODE_MONITORING_LOGIN = "admin_user_enode_monitoring" # admin user is required diff --git a/crates/api-grub/src/export.rs b/crates/api-grub/src/export.rs index 6404314..1f53957 100644 --- a/crates/api-grub/src/export.rs +++ b/crates/api-grub/src/export.rs @@ -114,12 +114,13 @@ impl Exporter { /// Exports metrics in `PrometheusMetricsExtended` format to Exporter defined /// as env var $EXORPTER_URL pub async fn export_extended_metrics(metrics: PrometheusMetricsExtended) -> Result { - let url = env::var("EXPORTER_URL")?; + // let url = env::var("EXPORTER_URL")?; + let url = env::var("STATUS_SYSTEM_URL").unwrap_or(env::var("EXPORTER_URL")?); debug!("Exporting: {:?}", &metrics); let req = Client::new() - .post(url) + .post(&url) .json(&metrics) .send().await; req?;