HACKING.pod - contributing to Munin
This is the guide for Munin internals contributors (developers, testers, documenters.)
If you are looking for more information on how to use Munin you probably want http://munin-monitoring.org/wiki/Documentation instead.
The munin code is marked by years on the battle front. You will therefore find code that deviates from the guidelines defined here. However, all new code should be made to comply.
These guidelines are an RFC for the time being and are of course negotiable.
In the dev_script directory you will find scripts that are meant to be useful for developing. Most of them are tools for creating and using munin in a sandbox.
- install
-
To make a clean rebuild of the sandbox
./dev_scripts/install 1
To just install the latest changes
./dev_scripts/install
- enable/disable tls
-
To test TLS, you can enable a paranoid TLS configuration by running:
./dev_scripts/enable_tls
And disable it with:
./dev_scripts/disable_tls
- start/stop munin-node
-
./dev_scripts/start_munin-node [munin-node params ...]
And
./dev_scripts/stop_munin-node
To do both:
./dev_scripts/restart_munin-node [munin-node params ...]
- query_munin_node
-
Use this command to query the munin-node directly:
./dev_scripts/query_munin_node list
- run
-
To run Munin master programs (munin-update, munin-html, munin-cron, etc) use the run command.
./dev_scripts/run CMD [CMD args ...]
Don't use punctuation variables (see Perl Best Practices page 79.)
use English qw(-no_match_vars);
We'll add an exception for
FIX
Use test-driven devolopment.
In node, server, or common:
perl Build.PL
./Build test
Currently there is no unified approach to handling exceptions. Use Carp?
use Carp;
croak("Foo happened!");
confess("Foo happened!"); # With stack trace
Exceptions are caught with an eval:
eval {
# Exceptionally scary code
};
if ($EVAL_ERROR) {
# Handle exception
}
The API documentation is embedded as POD in the code. See perlpod for more on POD.
More is on http://munin-monitoring.org/wiki/Documentation
The POD should be defined all in one place. For plugins you place it at the top, else at the bottom.