fix build errors
This commit is contained in:
parent
fd1b02a6ea
commit
97736ea4b8
6 changed files with 12 additions and 18 deletions
|
|
@ -41,10 +41,7 @@ impl ApiClient {
|
|||
.context("Failed to send config request")?;
|
||||
|
||||
if !response.status().is_success() {
|
||||
anyhow::bail!(
|
||||
"Config request failed with status: {}",
|
||||
response.status()
|
||||
);
|
||||
anyhow::bail!("Config request failed with status: {}", response.status());
|
||||
}
|
||||
|
||||
let config: AgentConfig = response
|
||||
|
|
@ -96,10 +93,7 @@ impl ApiClient {
|
|||
.context("Failed to send heartbeat request")?;
|
||||
|
||||
if !response.status().is_success() {
|
||||
anyhow::bail!(
|
||||
"Heartbeat failed with status: {}",
|
||||
response.status()
|
||||
);
|
||||
anyhow::bail!("Heartbeat failed with status: {}", response.status());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -57,11 +57,7 @@ impl Storage {
|
|||
|
||||
conn.execute(
|
||||
"INSERT INTO metrics (metric_type, data, timestamp) VALUES (?1, ?2, ?3)",
|
||||
params![
|
||||
metric.metric_type(),
|
||||
data,
|
||||
metric.timestamp().to_rfc3339()
|
||||
],
|
||||
params![metric.metric_type(), data, metric.timestamp().to_rfc3339()],
|
||||
)
|
||||
.context("Failed to insert metric")?;
|
||||
|
||||
|
|
@ -125,6 +121,7 @@ impl Storage {
|
|||
}
|
||||
|
||||
/// Get the last poll time for equipment
|
||||
#[allow(dead_code)] // Used in full SNMP implementation
|
||||
pub fn get_last_poll_time(&self, equipment_id: &str) -> Result<Option<DateTime<Utc>>> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,10 @@ impl Scheduler {
|
|||
Ok(())
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Failed to fetch config, continuing with cached config: {}", e);
|
||||
warn!(
|
||||
"Failed to fetch config, continuing with cached config: {}",
|
||||
e
|
||||
);
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
|
|
@ -168,9 +171,7 @@ impl Scheduler {
|
|||
// Check if it's time to poll this equipment
|
||||
let should_poll = match poll_times.get(&equipment.id) {
|
||||
Some(last_poll) => {
|
||||
let elapsed = Utc::now()
|
||||
.signed_duration_since(*last_poll)
|
||||
.num_seconds() as u64;
|
||||
let elapsed = Utc::now().signed_duration_since(*last_poll).num_seconds() as u64;
|
||||
elapsed >= equipment.poll_interval_seconds
|
||||
}
|
||||
None => true, // Never polled before
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ impl SnmpClient {
|
|||
/// Perform an SNMP WALK operation to get multiple values
|
||||
///
|
||||
/// TODO: Complete SNMP library integration with proper walk implementation
|
||||
#[allow(dead_code)] // Used in full SNMP implementation
|
||||
pub async fn walk(
|
||||
&self,
|
||||
ip_address: &str,
|
||||
|
|
|
|||
|
|
@ -2,4 +2,3 @@ mod client;
|
|||
mod types;
|
||||
|
||||
pub use client::SnmpClient;
|
||||
pub use types::*;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use thiserror::Error;
|
||||
|
||||
#[allow(dead_code)] // Some variants used only in full SNMP implementation
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SnmpError {
|
||||
#[error("SNMP request failed: {0}")]
|
||||
|
|
@ -21,6 +22,7 @@ pub enum SnmpError {
|
|||
pub type SnmpResult<T> = Result<T, SnmpError>;
|
||||
|
||||
/// SNMP value returned from a GET operation
|
||||
#[allow(dead_code)] // All variants used in full SNMP implementation
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum SnmpValue {
|
||||
Integer(i64),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue