M1: core engine, config, plugin model and core plugins
- Cargo workspace (core, plugins, tui, cli) with drop-in compatible CLI - Python-compatible config file handling, limits, views, rates, MMM, history - process collection via sysinfo + procfs, filters, thresholds, events, actions - 20 core plugins (cpu, percpu, mem, memswap, load, fs, network, diskio, ...) - stdout, stdout-csv, stdout-json, --issue, --modules-list output modes - differential test harness against the Python implementation
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
//! Psutil version plugin.
|
||||
//!
|
||||
//! The Rust rewrite does not use psutil; the plugin is kept for drop-in
|
||||
//! compatibility of the stats schema and reports "N/A".
|
||||
|
||||
use crate::fields;
|
||||
use glances_core::plugin::{Plugin, PluginModel, UpdateContext};
|
||||
use glances_core::{Args, Config};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
pub struct PsutilVersionPlugin {
|
||||
pub model: PluginModel,
|
||||
}
|
||||
|
||||
impl PsutilVersionPlugin {
|
||||
pub fn new(config: &Config, args: &Args) -> Self {
|
||||
let model = PluginModel::new(
|
||||
"psutilversion",
|
||||
fields! {},
|
||||
Vec::new(),
|
||||
Value::Null,
|
||||
config,
|
||||
args.time.unwrap_or(2.0),
|
||||
args.disable_history,
|
||||
args.disable_config_exec,
|
||||
);
|
||||
Self { model }
|
||||
}
|
||||
}
|
||||
|
||||
impl Plugin for PsutilVersionPlugin {
|
||||
fn name(&self) -> &str {
|
||||
"psutilversion"
|
||||
}
|
||||
|
||||
fn model(&self) -> &PluginModel {
|
||||
&self.model
|
||||
}
|
||||
|
||||
fn model_mut(&mut self) -> &mut PluginModel {
|
||||
&mut self.model
|
||||
}
|
||||
|
||||
fn collect(&mut self, _ctx: &mut UpdateContext) -> anyhow::Result<Value> {
|
||||
Ok(json!("N/A"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user