|
@@ -5,22 +5,10 @@
|
|
|
* An API to help modules expose their instrumentation to Munin.
|
|
|
*/
|
|
|
|
|
|
-define('MUNIN_API_COUNTER', 'counter');
|
|
|
-define('MUNIN_API_GAUGE', 'gauge');
|
|
|
+define('MUNIN_API_COUNTER', 'COUNTER');
|
|
|
+define('MUNIN_API_GAUGE', 'GAUGE');
|
|
|
|
|
|
|
|
|
-/**
|
|
|
- * Menu loader for %menu_api_instance.
|
|
|
- */
|
|
|
-function munin_api_instance_load($name) {
|
|
|
- $module = module_invoke($name, 'munin_api_info');
|
|
|
- $module = empty($module)
|
|
|
- ? FALSE
|
|
|
- : $module[$name];
|
|
|
-
|
|
|
- return $module;
|
|
|
-}
|
|
|
-
|
|
|
function munin_api_menu() {
|
|
|
$items = array();
|
|
|
|
|
@@ -34,14 +22,21 @@ function munin_api_menu() {
|
|
|
$items['admin/reports/munin_api/list'] = array(
|
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
|
|
'title' => 'General',
|
|
|
+ 'weight' => -1,
|
|
|
);
|
|
|
|
|
|
- $items['admin/reports/munin_api/list/%munin_api_instance'] = array(
|
|
|
- 'type' => MENU_CALLBACK,
|
|
|
- 'page callback' => 'munin_api_page_report_instance',
|
|
|
- 'page arguments' => array(4),
|
|
|
- 'access arguments' => array('access site reports'),
|
|
|
- );
|
|
|
+ foreach (module_implements('munin_api_info') as $name) {
|
|
|
+ $module = module_invoke($name, 'munin_api_info');
|
|
|
+ $module = $module[$name];
|
|
|
+ $items['admin/reports/munin_api/'. $name] = array(
|
|
|
+ 'type' => MENU_LOCAL_TASK,
|
|
|
+ 'title' => $module['#title'],
|
|
|
+ 'description' => $module['#description'],
|
|
|
+ 'page callback' => 'munin_api_page_report_instance',
|
|
|
+ 'page arguments' => array(3),
|
|
|
+ 'access arguments' => array('access site reports'),
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
return $items;
|
|
|
}
|
|
@@ -63,7 +58,7 @@ function munin_api_page_report_global() {
|
|
|
foreach ($items as $name => $item) {
|
|
|
$link_title = $item['#title'] ? $item['#title'] : $name;
|
|
|
$rows[] = array(
|
|
|
- l($link_title, 'admin/reports/munin_api/list/'. $name),
|
|
|
+ l($link_title, 'admin/reports/munin_api/'. $name),
|
|
|
isset($item['#description']) ? $item['#description'] : t('<missing>'),
|
|
|
count(element_children($item)),
|
|
|
);
|
|
@@ -73,8 +68,11 @@ function munin_api_page_report_global() {
|
|
|
}
|
|
|
|
|
|
function munin_api_page_report_instance($module) {
|
|
|
- $title = isset($module['#title']) ? $module['#title'] : t('Info');
|
|
|
- drupal_set_title($title);
|
|
|
+ dsm($module);
|
|
|
+ $module = module_invoke($module, 'munin_api_info');
|
|
|
+ $module = reset($module);
|
|
|
+ // $title = isset($module['#title']) ? $module['#title'] : t('Info');
|
|
|
+ // drupal_set_title($title);
|
|
|
|
|
|
$header = array(t('Name'), t('Description'), t('Type'));
|
|
|
$rows = array();
|