Struct munin_plugin::config::Config
source · [−]pub struct Config {
pub plugin_name: String,
pub plugin_statedir: PathBuf,
pub dirtyconfig: bool,
pub daemonize: bool,
pub pidfile: PathBuf,
pub cfgsize: usize,
}
Expand description
Plugin configuration.
Fields
plugin_name: String
The name of the plugin.
Default is “Simple munin plugin in Rust”
plugin_statedir: PathBuf
Plugins state directory
Fallback to /tmp if environment variable MUNIN_PLUGSTATE is not set.
dirtyconfig: bool
Does munin support dirtyconfig? (Send data after sending config)
Checks MUNIN_CAP_DIRTYCONFIG environment variable, if set to 1, this is true, otherwise false.
daemonize: bool
Does this plugin need to run in background, continuously fetching data?
Default to false
pidfile: PathBuf
If 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: usize
Size 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.
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 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