From b7489f78bfe6d641ba597ee65e87700084d39854 Mon Sep 17 00:00:00 2001
From: vogelor <vogelor@ispconfig3>
Date: Sun, 02 Nov 2008 15:45:25 -0500
Subject: [PATCH] First version of the new monitor - module (works for more than one server) It is now possible to add "navigation-text" without links (actions) to the left navigations-side of the template (needed by the monitor module to add the server-dropdown)

---
 interface/web/monitor/lib/module.conf.php |   82 +++++++++++++++++++++++++++++++----------
 1 files changed, 62 insertions(+), 20 deletions(-)

diff --git a/interface/web/monitor/lib/module.conf.php b/interface/web/monitor/lib/module.conf.php
index f49ee79..259e349 100644
--- a/interface/web/monitor/lib/module.conf.php
+++ b/interface/web/monitor/lib/module.conf.php
@@ -1,42 +1,84 @@
 <?php
 
+/*
+ Config of the Module
+ */
 $module["name"] 		= "monitor";
 $module["title"] 		= "Monitor";
 $module["template"] 	= "module.tpl.htm";
-$module["startpage"] 	= "monitor/system.php?mod=index";
 $module["tab_width"]    = '';
+$module["startpage"] 	= "monitor/system.php?type=overview";
+
+/*
+ We need all the available servers on the left navigation.
+ So fetch them from the database and add then to the navigation as dropdown-list
+*/
+$servers = $app->db->queryAllRecords("SELECT server_id, server_name FROM server order by server_name");
+
+$dropDown = "<select id='server_id' onchange=\"loadContent('monitor/show_data.php?type=overview&server=' + document.getElementById('server_id').value);\">";
+foreach ($servers as $server)
+{
+  $dropDown .= "<option value='" . $server['server_id'] . "|" . $server['server_name'] . "'>" . $server['server_name'] . "</option>";
+}
+$dropDown .= "</select>";
+
+/*
+ Now add them as dropdown to the navigation
+ */
+$items[] = array( 'title' 	=> $dropDown,
+		'target' 	=> '', // no action!
+		'link'	=> '');   // no action!
+
+$module["nav"][] = array(	'title'	=> 'Server to Monitor',
+		'open' 	=> 1,
+		'items'	=> $items);
+		
+/*
+  The first Server at the list is the server first selected
+ */
+$_SESSION['monitor']['server_id']   = $servers[0]['server_id'];
+$_SESSION['monitor']['server_name'] = $servers[0]['server_name'];
 
 /*
 	Logmonitoring module
 */
-
-$items[] = array( 'title' 	=> "Load",
+// aufr�umen
+unset($items);
+$items[] = array( 'title' 	=> "Server Load",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/system.php?mod=load');
+				  'link'	=> 'monitor/show_data.php?type=server_load');
 
-$items[] = array( 'title' 	=> "Harddisk",
+$items[] = array( 'title' 	=> "Disk usage",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/system.php?mod=disk');
+				  'link'	=> 'monitor/show_data.php?type=disk_usage');
 
 $items[] = array( 'title' 	=> "Memory usage",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/system.php?mod=memusage');
-
-$items[] = array( 'title' 	=> "CPU",
-				  'target' 	=> 'content',
-				  'link'	=> 'monitor/system.php?mod=cpu');
+				  'link'	=> 'monitor/show_data.php?type=mem_usage');
 
 $items[] = array( 'title' 	=> "Services",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/system.php?mod=services');
+				  'link'	=> 'monitor/show_data.php?type=services');
 
 
-$module["nav"][] = array(	'title'	=> 'System',
+$module["nav"][] = array(	'title'	=> 'Monitoring',
 							'open' 	=> 1,
 							'items'	=> $items);
 
 // aufr�umen
 unset($items);
+
+$items[] = array( 'title' 	=> "CPU",
+		'target' 	=> 'content',
+		'link'	=> 'monitor/show_data.php?type=cpu_info');
+
+$module["nav"][] = array(	'title'	=> 'System-Information',
+		'open' 	=> 1,
+		'items'	=> $items);
+
+// aufr�umen
+unset($items);
+
 
 /*
 	Logmonitoring module
@@ -44,31 +86,31 @@
 
 $items[] = array( 'title' 	=> "Mail log",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/logview.php?log=mail_log');
+				  'link'	=> 'monitor/show_log.php?log=log_mail');
 
 $items[] = array( 'title' 	=> "Mail warn",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/logview.php?log=mail_warn');
+				  'link'	=> 'monitor/show_log.php?log=log_mail_warn');
 
 $items[] = array( 'title' 	=> "Mail err",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/logview.php?log=mail_err');
+				  'link'	=> 'monitor/show_log.php?log=log_mail_err');
 
 $items[] = array( 'title' 	=> "Messages",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/logview.php?log=messages');
+				  'link'	=> 'monitor/show_log.php?log=log_messages');
 
 $items[] = array( 'title' 	=> "Freshclam",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/logview.php?log=freshclam');
+				  'link'	=> 'monitor/show_log.php?log=log_freshclam');
 
 $items[] = array( 'title' 	=> "Clamav",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/logview.php?log=clamav');
+				  'link'	=> 'monitor/show_log.php?log=log_clamav');
 
 $items[] = array( 'title' 	=> "ISPConfig",
 				  'target' 	=> 'content',
-				  'link'	=> 'monitor/logview.php?log=ispconfig');
+				  'link'	=> 'monitor/show_log.php?log=log_ispconfig');
 
 
 $module["nav"][] = array(	'title'	=> 'Logfiles',

--
Gitblit v1.9.1