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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Useful defaults, if possible based on munin environment.

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.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.