fix build errors

This commit is contained in:
Graham McIntire 2026-01-09 13:41:48 -06:00
parent fd1b02a6ea
commit 97736ea4b8
No known key found for this signature in database
6 changed files with 12 additions and 18 deletions

View file

@ -41,10 +41,7 @@ impl ApiClient {
.context("Failed to send config request")?; .context("Failed to send config request")?;
if !response.status().is_success() { if !response.status().is_success() {
anyhow::bail!( anyhow::bail!("Config request failed with status: {}", response.status());
"Config request failed with status: {}",
response.status()
);
} }
let config: AgentConfig = response let config: AgentConfig = response
@ -96,10 +93,7 @@ impl ApiClient {
.context("Failed to send heartbeat request")?; .context("Failed to send heartbeat request")?;
if !response.status().is_success() { if !response.status().is_success() {
anyhow::bail!( anyhow::bail!("Heartbeat failed with status: {}", response.status());
"Heartbeat failed with status: {}",
response.status()
);
} }
Ok(()) Ok(())

View file

@ -57,11 +57,7 @@ impl Storage {
conn.execute( conn.execute(
"INSERT INTO metrics (metric_type, data, timestamp) VALUES (?1, ?2, ?3)", "INSERT INTO metrics (metric_type, data, timestamp) VALUES (?1, ?2, ?3)",
params![ params![metric.metric_type(), data, metric.timestamp().to_rfc3339()],
metric.metric_type(),
data,
metric.timestamp().to_rfc3339()
],
) )
.context("Failed to insert metric")?; .context("Failed to insert metric")?;
@ -125,6 +121,7 @@ impl Storage {
} }
/// Get the last poll time for equipment /// 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>>> { pub fn get_last_poll_time(&self, equipment_id: &str) -> Result<Option<DateTime<Utc>>> {
let conn = self.conn.lock().unwrap(); let conn = self.conn.lock().unwrap();

View file

@ -101,7 +101,10 @@ impl Scheduler {
Ok(()) Ok(())
} }
Err(e) => { Err(e) => {
warn!("Failed to fetch config, continuing with cached config: {}", e); warn!(
"Failed to fetch config, continuing with cached config: {}",
e
);
Err(e) Err(e)
} }
} }
@ -168,9 +171,7 @@ impl Scheduler {
// Check if it's time to poll this equipment // Check if it's time to poll this equipment
let should_poll = match poll_times.get(&equipment.id) { let should_poll = match poll_times.get(&equipment.id) {
Some(last_poll) => { Some(last_poll) => {
let elapsed = Utc::now() let elapsed = Utc::now().signed_duration_since(*last_poll).num_seconds() as u64;
.signed_duration_since(*last_poll)
.num_seconds() as u64;
elapsed >= equipment.poll_interval_seconds elapsed >= equipment.poll_interval_seconds
} }
None => true, // Never polled before None => true, // Never polled before

View file

@ -39,6 +39,7 @@ impl SnmpClient {
/// Perform an SNMP WALK operation to get multiple values /// Perform an SNMP WALK operation to get multiple values
/// ///
/// TODO: Complete SNMP library integration with proper walk implementation /// TODO: Complete SNMP library integration with proper walk implementation
#[allow(dead_code)] // Used in full SNMP implementation
pub async fn walk( pub async fn walk(
&self, &self,
ip_address: &str, ip_address: &str,

View file

@ -2,4 +2,3 @@ mod client;
mod types; mod types;
pub use client::SnmpClient; pub use client::SnmpClient;
pub use types::*;

View file

@ -1,5 +1,6 @@
use thiserror::Error; use thiserror::Error;
#[allow(dead_code)] // Some variants used only in full SNMP implementation
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum SnmpError { pub enum SnmpError {
#[error("SNMP request failed: {0}")] #[error("SNMP request failed: {0}")]
@ -21,6 +22,7 @@ pub enum SnmpError {
pub type SnmpResult<T> = Result<T, SnmpError>; pub type SnmpResult<T> = Result<T, SnmpError>;
/// SNMP value returned from a GET operation /// SNMP value returned from a GET operation
#[allow(dead_code)] // All variants used in full SNMP implementation
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum SnmpValue { pub enum SnmpValue {
Integer(i64), Integer(i64),