feature/statuszero #21

Merged
Ghost merged 2 commits from feature/statuszero into rc 2025-04-04 16:49:31 +03:00
4 changed files with 11 additions and 3 deletions

View File

@ -9,6 +9,10 @@ DB_DBNAME = "db_name"1
# Prometheus-Exporter info # Prometheus-Exporter info
EXPORTER_URL = "http(s)://ip.ip.ip.ip:port" 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 configuration
ENODE_MONITORING_IP = "ip.ip.ip.ip" ENODE_MONITORING_IP = "ip.ip.ip.ip"
ENODE_MONITORING_LOGIN = "admin_user_enode_monitoring" # admin user is required ENODE_MONITORING_LOGIN = "admin_user_enode_monitoring" # admin user is required

View File

@ -114,12 +114,13 @@ impl Exporter {
/// Exports metrics in `PrometheusMetricsExtended` format to Exporter defined /// Exports metrics in `PrometheusMetricsExtended` format to Exporter defined
/// as env var $EXORPTER_URL /// as env var $EXORPTER_URL
pub async fn export_extended_metrics(metrics: PrometheusMetricsExtended) -> Result<usize> { pub async fn export_extended_metrics(metrics: PrometheusMetricsExtended) -> Result<usize> {
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); debug!("Exporting: {:?}", &metrics);
let req = Client::new() let req = Client::new()
.post(url) .post(&url)
.json(&metrics) .json(&metrics)
.send().await; .send().await;
req?; req?;

View File

@ -405,7 +405,8 @@ impl MonitoringImporter {
}, },
addr : "enode.monitoring.api".to_owned(), addr : "enode.monitoring.api".to_owned(),
desc : description, desc : description,
value : val.clone() value : val.clone(),
status: 0,
}) })
} }
} }

View File

@ -271,6 +271,7 @@ pub mod v3 {
pub value : Value, pub value : Value,
#[serde(rename = "description")] #[serde(rename = "description")]
pub desc : String, pub desc : String,
pub status: usize,
} }
impl MetricOutputExtended { impl MetricOutputExtended {
pub fn new_with_slices(id : &str, json_type : &str, addr: &str, desc : &str, value : Value) -> Self { 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(), addr : addr.to_string(),
value : value, value : value,
desc : desc.to_string(), desc : desc.to_string(),
status: 0,
} }
} }
} }