egn user-agent + refactor
parent
ce7987eb99
commit
b30e940df7
|
|
@ -1,6 +1,4 @@
|
|||
CONFIG_SERVER_CREDS = "ws://ip.ip.ip.ip:port"
|
||||
API_GRUBBER_SOCKET = "api-grubber.sock"
|
||||
PREPROC_SOCKET = "preproc.sock"
|
||||
# Template .env for API grabber
|
||||
|
||||
# PostgreSQL connection [DEPRECATED]
|
||||
DB_HOST = "ip.addr.postgresql.server"
|
||||
|
|
@ -9,4 +7,4 @@ DB_PASSWORD = "db_user_password"
|
|||
DB_DBNAME = "db_name"1
|
||||
|
||||
# Prometheus-Exporter info
|
||||
EXPORTER_URL = "ip.ip.ip.ip:port"
|
||||
EXPORTER_URL = "http(s)://ip.ip.ip.ip:port"
|
||||
|
|
@ -16,3 +16,5 @@ reqwest = { version = "0.12.12", features = ["rustls-tls", "json"] }
|
|||
deadpool-postgres = { version = "0.14.1", features = ["serde"] }
|
||||
tokio-postgres = "0.7.12"
|
||||
dotenv = "0.15.0"
|
||||
md5 = "0.7.0"
|
||||
rand = "0.9.0"
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
// module to handle unix-socket connection + pulling info from api
|
||||
use anyhow::{Error, Result};
|
||||
use integr_structs::api::{ApiConfigV2, ProcessedEndpoint};
|
||||
use anyhow::Result;
|
||||
// use integr_structs::api::{ApiConfigV2, ProcessedEndpoint};
|
||||
use log::{error, info};
|
||||
use serde_json::Value;
|
||||
use rand::random;
|
||||
use tokio::sync::mpsc::Receiver;
|
||||
use tokio::time::{sleep, Duration};
|
||||
use reqwest::{Client, Method, RequestBuilder};
|
||||
use reqwest::{Client, Method};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::sync::Arc;
|
||||
use tokio::task::JoinHandle;
|
||||
// use tokio::sync::Mutex;
|
||||
use dotenv::dotenv;
|
||||
use crate::json::JsonParser;
|
||||
use crate::export::{self, Exporter};
|
||||
use crate::export::Exporter;
|
||||
use integr_structs::api::v3::{Config, ConfigEndpoint, Credentials, Metrics, PrometheusMetrics};
|
||||
use md5::compute;
|
||||
|
||||
// type BufferType = Arc<Mutex<Vec<String>>>;
|
||||
|
||||
|
|
@ -96,8 +98,14 @@ impl<'a> ApiPoll<'a> {
|
|||
// let mut req = Client::new()
|
||||
// // .user_agent("api_grub/integration_module")
|
||||
// .get(&metrics.url);
|
||||
use std::hash::DefaultHasher;
|
||||
|
||||
let rand = random::<char>();
|
||||
let mut hash = DefaultHasher::new();
|
||||
rand.hash(&mut hash);
|
||||
|
||||
let client = Client::builder()
|
||||
.user_agent("api_grub/integration_module");
|
||||
.user_agent(format!("api-grabber-{}", hash.finish()));
|
||||
let mut req = client.build().unwrap().get(&metrics.url);
|
||||
|
||||
let login = &creds.endpoint.login;
|
||||
|
|
|
|||
Loading…
Reference in New Issue