Testing
This commit is contained in:
parent
d9edcda36c
commit
4d8bacef50
@ -10,22 +10,8 @@ pub mod smart;
|
||||
|
||||
pub use error::CollectorError;
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub enum AgentType {
|
||||
Smart,
|
||||
Service,
|
||||
Backup,
|
||||
}
|
||||
pub use cm_dashboard_shared::envelope::AgentType;
|
||||
|
||||
impl AgentType {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
AgentType::Smart => "smart",
|
||||
AgentType::Service => "service",
|
||||
AgentType::Backup => "backup",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CollectorOutput {
|
||||
|
||||
@ -9,8 +9,9 @@ use crate::collectors::{
|
||||
backup::BackupCollector,
|
||||
service::ServiceCollector,
|
||||
smart::SmartCollector,
|
||||
Collector, AgentType
|
||||
Collector
|
||||
};
|
||||
use cm_dashboard_shared::envelope::AgentType;
|
||||
use crate::discovery::AutoDiscovery;
|
||||
use crate::notifications::{NotificationManager, NotificationConfig};
|
||||
|
||||
@ -143,10 +144,10 @@ impl SimpleAgent {
|
||||
|
||||
async fn send_metrics(&self, agent_type: &AgentType, data: &serde_json::Value) -> anyhow::Result<()> {
|
||||
let message = serde_json::json!({
|
||||
"host": self.hostname,
|
||||
"hostname": self.hostname,
|
||||
"agent_type": agent_type,
|
||||
"data": data,
|
||||
"timestamp": Utc::now()
|
||||
"timestamp": Utc::now().timestamp() as u64,
|
||||
"metrics": data
|
||||
});
|
||||
|
||||
let serialized = serde_json::to_string(&message)?;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user