Struct munin_plugin::config::Config
source · [−]pub struct Config {
pub plugin_name: String,
pub plugin_statedir: PathBuf,
pub plugin_cache: PathBuf,
pub dirtyconfig: bool,
pub daemonize: bool,
pub pidfile: PathBuf,
pub cfgsize: usize,
pub fetchsize: usize,
}Expand description
Plugin configuration.
Fields
plugin_name: StringThe name of the plugin.
Default is “Simple munin plugin in Rust”
plugin_statedir: PathBufPlugins state directory
Fallback to /tmp if environment variable MUNIN_PLUGSTATE is not set.
plugin_cache: PathBufCachefile for the plugin
Plugins that daemonize and continuously fetch data need to
write them somewhere, so that the
MuninPlugin::fetch function can
output them. The default is a combination of
Config::plugin_statedir and a random string, with munin and
value added, in std::format! syntax: "{}.munin.{}.value", [Config::plugin_statedir], randomstring.
dirtyconfig: boolDoes munin support dirtyconfig? (Send data after sending config)
Checks MUNIN_CAP_DIRTYCONFIG environment variable, if set to 1, this is true, otherwise false.
daemonize: boolDoes this plugin need to run in background, continuously fetching data?
Default to false
pidfile: PathBufIf plugin uses daemonize, whats the pidfile name?
Defaults to Config::plugin_statedir plus “munin-plugin.pid”, using Config::new will set it to Config::plugin_statedir/Config::plugin_name.pid
cfgsize: usizeSize of buffer for BufWriter for MuninPlugin::config.
Defaults to 8192, but if the plugin outputs huge munin configuration (trivial with multigraph plugins), you may want to increase this.
fetchsize: usizeSize of buffer for BufWriter for MuninPlugin::fetch.
Defaults to 8192, but if the plugin outputs large datasets, it is useful to increase this.
Implementations
sourceimpl Config
impl Config
sourcepub fn new(plugin_name: String) -> Self
pub fn new(plugin_name: String) -> Self
Create a new Config with defined plugin_name, also setting Config::pidfile and Config::plugin_cache to a sensible value using the Config::plugin_name.
Examples
let config = Config::new(String::from("great-plugin"));
println!("My pidfile is {:?}", config.pidfile);Trait Implementations
sourceimpl Default for Config
impl Default for Config
Useful defaults, if possible based on munin environment.
sourcefn default() -> Self
fn default() -> Self
Set default values, try to read munin environment variables to fill Config::plugin_statedir and Config::dirtyconfig. Config::plugin_statedir falls back to /tmp if no munin environment variables are present.
impl Eq for Config
impl StructuralEq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more