munin-plugin - Simple writing of plugins for munin in Rust
SPDX-License-Identifier: LGPL-3.0-only
Copyright (C) 2022 Joerg Jaspert joerg@debian.org
About
Simple way to write munin plugins.
Repository / plugin using this code
Usage
To implement a standard munin plugin, which munin runs every 5 minutes when fetching data, you load this library, create an empty struct named for your plugin and then implement MuninPlugin for your struct. You need to write out the functions config and fetch, the rest can have the magic unimplemented!(), and you call start() on your Plugin.
Example
The following implements the load plugin from munin, graphing the load average of the system, using the 5-minute value. As implemented, it expects to be run by munin every 5 minutes, usually munin will first run it with the config parameter, followed by no parameter to fetch data. If munin-node supports it and the capability dirtyconfig is set, config will also print out data.
It is a shortened version of the plugin linked above (Simple munin plugin to graph load), with things like logging dropped.
use Result;
use ;
use LoadAverage;
use ;
// Our plugin struct
;
// Implement the needed functions
// The actual program start point