Compare commits

..

No commits in common. "ad4ce178a990c3cb252ac48b9df1b84aa45c9c3a" and "32a43f9ed80cf9c8c61b9200d4b6ca90f659742a" have entirely different histories.

3 changed files with 14 additions and 33 deletions

View File

@ -8,8 +8,3 @@ DB_DBNAME = "db_name"1
# Prometheus-Exporter info
EXPORTER_URL = "http(s)://ip.ip.ip.ip:port"
# eNODE.Monitoring configuration
ENODE_MONITORING_IP = "ip.ip.ip.ip"
ENODE_MONITORING_LOGIN = "admin_user_enode_monitoring" # admin user is required
ENODE_MONITORING_PASSWORD = "admin_password_enode_monitoring" # # admin password is required

View File

@ -14,11 +14,13 @@ use config::{pull_local_config, init_config_grub_mechanism};
use net::init_api_grub_mechanism;
use tokio::sync::mpsc;
use log::{error, info, warn};
use monitoring::get_metrics_from_monitoring;
#[tokio::main(flavor = "multi_thread")]
async fn main() -> Result<()>{
dotenv::dotenv().ok();
// 3 coroutines
// 1) unix-socket coroutine (for config updating)
// 2) api coroutine
// 3) ?
setup_logger().await?;
let config = get_config().await;
// config update channel
@ -39,16 +41,6 @@ async fn main() -> Result<()>{
}
});
let event_grub = tokio::spawn(async move {
if std::env::var("ENODE_MONITORING_IP").is_ok() {
match get_metrics_from_monitoring(0, 5).await {
Ok(_) => {
info!("Grabing (eNODE.Monitoring) task deinitialized");
},
Err(er) => {
error!("Grabing task returned an error : {}", er);
},
}
} else {
match init_api_grub_mechanism(config, &mut rx).await {
Ok(_) => {
info!("Grabing task deinitialized");
@ -57,7 +49,6 @@ async fn main() -> Result<()>{
error!("Grabing task returned an error : {}", er);
},
}
}
});
let events_handler = vec![event_config, event_grub];
for event in events_handler {

View File

@ -13,7 +13,6 @@ use tokio::task::JoinHandle;
use std::pin::Pin;
use std::future::Future;
use integr_structs::api::v3::{MetricOutput, PrometheusMetrics};
use log::{error, info, warn};
// use chrono::{Local, DateTime};
pub async fn get_metrics_from_monitoring(duration: usize, delay: usize) -> anyhow::Result<()> {
@ -150,16 +149,12 @@ impl MonitoringImporter {
});
jh_vec.push(jh);
}
// let mut vals = Vec::new();
let mut vals = Vec::new();
for event in jh_vec {
match event.await {
Ok(val) => {
if let Ok(val) = val {
match crate::export::Exporter::export_metrics(val).await {
Ok(bytes) => info!("Successfully transmitted {} bytes to the Prometehus exporter", bytes),
Err(er) => error!("Cannot export data to the Prometehus exporter due to : `{}`", er),
}
// vals.push(val);
vals.push(val);
}
},
Err(er) => println!("Fatal error on async task: {}", er),