I've made a number of additions and improvements to the current dev version of the munin_api and munin_default modules. Many of the changes were interrelated and I decided to make a lot of changes at once in a spurt of development. I was shooting to get a lot of these changes in for a presentation (by my colleague) at DrupalCOn Prague. I have therefore made a sandbox which contains the changes.
https://drupal.org/sandbox/murrayw/2084225
For convenience I have attached a patch as well.
The changes are as follows:
1. Settings split out into two local tasks: settings and plugins.
This split separates discrete functionality. The settings contains some of the more technical config. The plugins tab allows the user to focus on what is going to be monitored. The plugins tab is also supports vertical tabs and so was better suited to be on its own.
2. New "Results" local task which reports on config and values for each of the plugins.
This tab allows for the user to access all of the output from the drush command. User can easily debug the values and see what is going on without running drush.
3. Plugins local task has vertical tabs.
This adds another level of ordering and makes maintenance of large numbers of plugins easier. Plugin authors now get their own discrete tab, encouraging the further release of plugins by the community.
4. Plugins config stored in variable table is deeper to allow for storage of plugin specific config.
There is an ["enable"] property now to indicate the category is being used. Update hook handles this. Update hook 7001 handles this.
5. Addition of Critical and Warning fields on each category.
It should be possible to configure these values for all plugins. It should not be set in the plugin definition because the values will change from site to site. It is therefore in the UI.
6. Addition of munin-setup drush command to aid easy creation of symlinks etc.
The script was helpful, however, it still left it up to the user to create the symlinks, a tedious and error prone process. The munin-setup command alleviates this, making it possible to refresh all the backend with one command. This drush command is relatively sophisticated as it handles:
- running as a specific user for security
- supports drush aliases
- supports multisite
7. Internal logic tweaked to support multiple sites using munin_api.
The symlink is named so that it can be prefixed in different ways for different sites. The old way had all sites namespaced as "drupal_. You now get "drupal_mysite.example.com". This makes the module much more useful on machines with more than one site.
8. Refactoring of a lot of the code.
- There is an admin.inc file.
- Many functions have moved to the module file for reuse between admin.inc and drush.inc.
- Function names changed for better code standards.
- Code more defensive to avoid warnings etc.
9. CSS file removed.
It made the module less portable as it made assumptions about the theme it was being installed into. We don't lose much by dropping it.
10. statement_arguments slot added to plugin config.
Allows for better SQL for db_query. ie. It is now safer and easier to add you arguments to SQL statements. The munin_default module reworked to use this approach.
11. Drush script improved:
- Drush alias supported Helpful for Aegir systems where the root changes but the alias stays the same.
- Drush user added. Script can run as non root/nobody. Good for security and where drush is locked down to be accessible by a specific user (eg. aegir).
There's a lot going on there :) The code is working well for me locally and on some prod sites. Sites running the current version of the module should upgrade OK.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | munin-results.png | 48.88 KB | murrayw |
| #1 | munin-plugins.png | 62.47 KB | murrayw |
| #1 | munin-settings.png | 40.65 KB | murrayw |
| munin_additions.patch | 39.69 KB | murrayw |
Comments
Comment #1
murrayw commentedSome pics to give you an idea of the UI changes.
Comment #2
Alex Savin commentedThis looks awesome!!! :)
Please give me a couple of more days before I can review and applying the patch if you don't mind.
Thank you!
Comment #3
Alex Savin commentedJust pushed the patch is in the latest dev. I didn't really manage to test it but I hope next week to be able. If somebody manages in the meanwhile please leave some feedback.
Thanks!
Comment #4
murrayw commentedHi Alex. Thanks for that. I'll be around to help with issues. Just let me know if you want me to look at anything.
Comment #5
Alex Savin commentedHi murrayw!
It's a long time since this patch was merged. Did you had the chance to use it? Any issues? I would like to bump the version.
Thanks,
Alex