Hi
Two ideas:
1. Use php scripts:
Any reason why the generated script is not a php CLI?
Instead of having this module generate a shell script with the credentials needed, why not have a drupal.php script written in PHP that boots Drupal
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// do neat stuff here, according to hooks ...
// Report it the Munin way
We then symlink it from the drupal directory to the /etc/munin/plugins
We avoid having to store the database credentials this way.
What do you think of this idea?
2. Use Munin's config file:
Another way to avoid hard coding the database credentials, is to put them in /etc/munin/plugin-conf.d/munin-node like so:
[drupal*]
CONF_DATABASE xxx
CONF_MYSQL_USER xxxx
CONF_MYSQL_PASS xxxx
Comments
Comment #1
McGo commentedHm. Great idea! Really neat. As long as i understand the data collection mechanism in munin, every graph has to have its own plugin script doesn't it? If not, this suggestion might work really great. No script to generate, everything configurable in the admin backend and no possible security problems.
So: Time for a Version 2?
Comment #2
neyvaz commentedEach plugin could provide it's own individual script file, which can then be symlinked according to kbahey.
One could propose the following:
/modules/munin
/modules/munin/plugins
/modules/munin/plugins/nodes
/modules/munin/plugins/nodes/nodes-plugin.munin.php
/modules/munin/plugins/users
/modules/munin/plugins/users/users-plugin.munin.php
/modules/munin/plugins/mail
[...]
/modules/munin/plugins/watchdog
[...]
Each foo-plugin.munin.php file could then be symlinked manualy into /etc/munin/plugins. (to enable it)
Voilà, one script per graph.
Comment #3
neyvaz commentedFollowing this, the munin.module could simplify plugin development by providing it's API calls like this.
Example plugin code (php CLI)
API:munin_plugin_output() to do the heavy lifting of printing proper munin responses.
API:munin_plugin_run() to do things like $_SERVER['argv'] to react on 'autoconf' and 'conf' command line arguments. Calling _munin_plugin_run() with the correct $op.
Plugin development looks pretty easy this way.
Plugin developers would really only modify step 3 and implement individual plugin code there.
This would keep us from re-generating script files. Also it would keep us from updating drupal munin plugins upon any potential munin output format changes. (munin.module would handle any version changes)
And first of all, it would keep any db credentials within drupal. :)
Comment #4
sillygwailoAnother idea: a Drush plugin, with only one symbolic link in the /etc/munin/plugins directory. So then after the one-time symlink, you could have all configuration in the Munin module's settings (or the settings for the modules that implement the Munin module's API). Or a short shell script that calls Drush with the right parameters.
Comment #5
geerlingguy commentedSubscribe.
Comment #6
thebuckst0p commentedSubscribe.
Comment #7
thebuckst0p commentedSee #1133544: Refactored for Drush, other changes
Comment #8
Alex Savin commentedThis is implemented for some time.