Add chrony SOCK refclock and initial UCCM source
This commit is contained in:
@@ -3,7 +3,7 @@ use chimemon::{ChimemonSource, ChimemonSourceChannel, Config};
|
||||
use chrony_candm::reply::{self, ReplyBody, SourceMode};
|
||||
use chrony_candm::request::{self, RequestBody};
|
||||
use influxdb2::models::DataPoint;
|
||||
use log::{info, warn};
|
||||
use log::{debug, info, warn};
|
||||
use std::net::{SocketAddr, ToSocketAddrs};
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
use tokio::runtime::Handle;
|
||||
@@ -77,8 +77,8 @@ pub fn datapoint_from_sourcedata(
|
||||
reply::SourceState::NonSelectable => String::from("unusable"),
|
||||
reply::SourceState::Falseticker => String::from("falseticker"),
|
||||
reply::SourceState::Jittery => String::from("jittery"),
|
||||
reply::SourceState::Unselected => String::from("unused"),
|
||||
reply::SourceState::Selectable => String::from("combined"),
|
||||
reply::SourceState::Unselected => String::from("combined"),
|
||||
reply::SourceState::Selectable => String::from("unused"),
|
||||
},
|
||||
)
|
||||
.field("poll", d.poll as i64)
|
||||
@@ -208,9 +208,9 @@ impl ChronyClient {
|
||||
|
||||
let tracking_data = datapoint_from_tracking(&tracking, &self.config)?;
|
||||
|
||||
info!("Writing tracking data: {:?}", tracking_data);
|
||||
info!("Sending tracking data");
|
||||
|
||||
chan.send(tracking_data)
|
||||
chan.send(tracking_data.into())
|
||||
.expect("Unable to send tracking data to targets");
|
||||
|
||||
Ok(())
|
||||
@@ -221,19 +221,21 @@ impl ChronyClient {
|
||||
chan: &ChimemonSourceChannel,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let sources = self.get_sources().await?;
|
||||
let mut dps = Vec::with_capacity(sources.len());
|
||||
for ds in sources {
|
||||
let source_data = datapoint_from_sourcedata(&ds, &self.config)?;
|
||||
info!("Writing source data: {:?}", source_data);
|
||||
chan.send(source_data)
|
||||
.expect("Unable to send source data to targets");
|
||||
dps.push(source_data);
|
||||
}
|
||||
info!("Sending source data");
|
||||
chan.send(dps.into())
|
||||
.expect("Unable to send source data to targets");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ChimemonSource for ChronyClient {
|
||||
async fn run(self, chan: tokio::sync::broadcast::Sender<DataPoint>) {
|
||||
async fn run(self, chan: ChimemonSourceChannel) {
|
||||
info!("Chrony task started");
|
||||
|
||||
let mut t_interval = tokio::time::interval(Duration::from_secs(
|
||||
|
||||
Reference in New Issue
Block a user