Marius Burkard
2016-05-04 c3189ce6c7301c3ec17878fd3918f31d0d3cb18a
commit | author | age
b7489f 1 <?php
V 2
3 /*
4 Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9
10     * Redistributions of source code must retain the above copyright notice,
11       this list of conditions and the following disclaimer.
12     * Redistributions in binary form must reproduce the above copyright notice,
13       this list of conditions and the following disclaimer in the documentation
14       and/or other materials provided with the distribution.
15     * Neither the name of ISPConfig nor the names of its contributors
16       may be used to endorse or promote products derived from this software without
17       specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
b1a6a5 31 require_once '../../lib/config.inc.php';
MC 32 require_once '../../lib/app.inc.php';
b7489f 33
V 34 //* Check permissions for module
35 $app->auth->check_module_permissions('monitor');
36
31f6ce 37 $app->uses('tools_monitor');
b7489f 38
V 39 /* Get the dataType to show */
40 $dataType = $_GET["type"];
41
7e3524 42 /* Get some translations */
A 43 $monTransDate = $app->lng("monitor_settings_datafromdate_txt");
44 $monTransSrv = $app->lng("monitor_settings_server_txt");
45
46
b7489f 47 $output = '';
V 48
49 switch($dataType) {
b1a6a5 50 case 'server_load':
MC 51     $template = 'templates/show_data.htm';
52     $output .= $app->tools_monitor->showServerLoad();
53     $time = $app->tools_monitor->getDataTime('server_load');
54     $title = $app->lng("Server Load").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
55     $description = '';
942a60 56     $add_padding = true;
b1a6a5 57     break;
MC 58 case 'disk_usage':
59     $template = 'templates/show_data.htm';
60     $output .= $app->tools_monitor->showDiskUsage();
61     $time = $app->tools_monitor->getDataTime('disk_usage');
62     $title = $app->lng("Disk usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
63     $description = '';
64     break;
65 case 'database_size':
66     $template = 'templates/show_data.htm';
67     $output .= $app->tools_monitor->showDatabaseSize();
68     $time = $app->tools_monitor->getDataTime('database_size');
69     $title = $app->lng("Database size").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
70     $description = '';
71     break;
72 case 'mem_usage':
73     $template = 'templates/show_data.htm';
74     $output .= $app->tools_monitor->showMemUsage();
75     $time = $app->tools_monitor->getDataTime('mem_usage');
76     $title = $app->lng("Memory usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
77     $description = '';
78     break;
79 case 'cpu_info':
80     $template = 'templates/show_data.htm';
81     $output .= $app->tools_monitor->showCpuInfo();
82     $time = $app->tools_monitor->getDataTime('cpu_info');
83     $title = $app->lng("monitor_title_cpuinfo_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
84     $description = '';
85     break;
86 case 'services':
87     $template = 'templates/show_data.htm';
88     $output .= $app->tools_monitor->showServices();
89     $time = $app->tools_monitor->getDataTime('services');
90     $title = $app->lng("Status of services").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
91     $description = '';
92     break;
93 case 'openvz_beancounter':
94     $template = 'templates/show_data.htm';
95     $output .= $app->tools_monitor->showOpenVzBeanCounter();
96     $time = $app->tools_monitor->getDataTime('openvz_beancounter');
97     $title = $app->lng("monitor_title_beancounter_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
98     $description = '';
942a60 99     $add_padding = true;
b1a6a5 100     break;
MC 101 case 'system_update':
102     $template = 'templates/show_data.htm';
103     $output .= $app->tools_monitor->showSystemUpdate();
104     $time = $app->tools_monitor->getDataTime('system_update');
105     $title = $app->lng("monitor_title_updatestate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
106     $description = '';
942a60 107     $add_padding = true;
b1a6a5 108     break;
MC 109 case 'mailq':
110     $template = 'templates/show_data.htm';
111     $output .= $app->tools_monitor->showMailq();
112     $time = $app->tools_monitor->getDataTime('mailq');
113     $title = $app->lng("monitor_title_mailq_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
114     $description = '';
942a60 115     $add_padding = true;
b1a6a5 116     break;
MC 117 case 'raid_state':
118     $template = 'templates/show_data.htm';
119     $output .= $app->tools_monitor->showRaidState();
120     $time = $app->tools_monitor->getDataTime('raid_state');
121     $title = $app->lng("monitor_title_raidstate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
122     $description = '';
942a60 123     $add_padding = true;
b1a6a5 124     break;
MC 125 case 'rkhunter':
126     $template = 'templates/show_data.htm';
127     $output .= $app->tools_monitor->showRKHunter();
128     $time = $app->tools_monitor->getDataTime('rkhunter');
129     $title = $app->lng("monitor_title_rkhunterlog_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
130     $description = '';
942a60 131     $add_padding = true;
b1a6a5 132     break;
MC 133 case 'fail2ban':
134     $template = 'templates/show_data.htm';
135     $output .= $app->tools_monitor->showFail2ban();
136     $time = $app->tools_monitor->getDataTime('log_fail2ban');
137     $title = $app->lng("monitor_title_fail2ban_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
138     $description = '';
942a60 139     $add_padding = true;
b1a6a5 140     break;
e7ae4e 141 /*
b1a6a5 142 case 'mongodb':
MC 143     $template = 'templates/show_data.htm';
144     $output .= $app->tools_monitor->showMongoDB();
145     $time = $app->tools_monitor->getDataTime('log_mongodb');
146     $title = $app->lng("monitor_title_mongodb_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
147     $description = '';
148     break;
e7ae4e 149 */
b1a6a5 150 case 'iptables':
MC 151     $template = 'templates/show_data.htm';
152     $output .= $app->tools_monitor->showIPTables();
153     $time = $app->tools_monitor->getDataTime('iptables_rules');
154     $title = $app->lng("monitor_title_iptables_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
155     $description = '';
942a60 156     $add_padding = true;
b1a6a5 157     break;
MC 158 default:
159     $template = '';
160     break;
b7489f 161 }
V 162
942a60 163 if($add_padding == true) {
TB 164 $output = '<div style="padding:20px;">'.$output.'</div>';
165 }
166
b7489f 167
V 168 // Loading the template
169 $app->uses('tpl');
170 $app->tpl->newTemplate("form.tpl.htm");
fb4c27 171 $app->tpl->setInclude('content_tpl', $template);
b7489f 172
fb4c27 173 $app->tpl->setVar("output", $output);
a3e696 174 $app->tpl->setVar("list_head_txt", $title);
O 175 $app->tpl->setVar("list_desc_txt", $description);
fb4c27 176 $app->tpl->setVar("time", $time);
7e3524 177 $app->tpl->setVar("monTransDate", $monTransDate);
b7489f 178
V 179 $app->tpl_defaults();
180 $app->tpl->pparse();
7e3524 181 ?>