ftimme
2013-07-22 0da99ab8674724662940fbdddd917f48892c250f
- Integrated munin into Monitoring module.
2 files added
9 files modified
158 ■■■■■ changed files
install/tpl/server.ini.master 3 ●●●●● patch | view | raw | blame | history
interface/web/admin/form/server_config.tform.php 28 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/de_server_config.lng 5 ●●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_server_config.lng 5 ●●●●● patch | view | raw | blame | history
interface/web/admin/templates/server_config_server_edit.htm 12 ●●●●● patch | view | raw | blame | history
interface/web/monitor/lib/lang/de.lng 3 ●●●●● patch | view | raw | blame | history
interface/web/monitor/lib/lang/en.lng 3 ●●●●● patch | view | raw | blame | history
interface/web/monitor/lib/module.conf.php 5 ●●●●● patch | view | raw | blame | history
interface/web/monitor/show_munin.php 82 ●●●●● patch | view | raw | blame | history
interface/web/monitor/templates/show_monit.htm 2 ●●● patch | view | raw | blame | history
interface/web/monitor/templates/show_munin.htm 10 ●●●●● patch | view | raw | blame | history
install/tpl/server.ini.master
@@ -19,6 +19,9 @@
monit_url=
monit_user=
monit_password=
munin_url=
munin_user=
munin_password=
[mail]
module=postfix_mysql
interface/web/admin/form/server_config.tform.php
@@ -207,6 +207,34 @@
            'width' => '40',
            'maxlength' => '255'
        ),
        'munin_url' => array(
            'datatype' => 'VARCHAR',
            'formtype' => 'TEXT',
            'default' => '',
            'validators'    => array ( 0 => array (    'type'    => 'REGEX',
                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
                                                                'errmsg'=> 'munin_url_error_regex'),
                                                ),
            'value' => '',
            'width' => '40',
            'maxlength' => '255'
        ),
        'munin_user' => array(
            'datatype' => 'VARCHAR',
            'formtype' => 'TEXT',
            'default' => '',
            'value' => '',
            'width' => '40',
            'maxlength' => '255'
        ),
        'munin_password' => array(
            'datatype' => 'VARCHAR',
            'formtype' => 'TEXT',
            'default' => '',
            'value' => '',
            'width' => '40',
            'maxlength' => '255'
        ),
    ##################################
    # ENDE Datatable fields
    ##################################
interface/web/admin/lib/lang/de_server_config.lng
@@ -183,4 +183,9 @@
$wb['monit_password_txt'] = 'Monit-Passwort';
$wb['monit_url_error_regex'] = 'Ungültige Monit-URL';
$wb['monit_url_note_txt'] = 'Platzhalter:';
$wb['munin_url_txt'] = 'Munin-URL';
$wb['munin_user_txt'] = 'Munin-Benutzer';
$wb['munin_password_txt'] = 'Munin-Passwort';
$wb['munin_url_error_regex'] = 'Ungültige Munin-URL';
$wb['munin_url_note_txt'] = 'Platzhalter:';
?>
interface/web/admin/lib/lang/en_server_config.lng
@@ -183,4 +183,9 @@
$wb['monit_password_txt'] = 'Monit Password';
$wb['monit_url_error_regex'] = 'Invalid Monit URL';
$wb['monit_url_note_txt'] = 'Placeholder:';
$wb['munin_url_txt'] = 'Munin URL';
$wb['munin_user_txt'] = 'Munin User';
$wb['munin_password_txt'] = 'Munin Password';
$wb['munin_url_error_regex'] = 'Invalid Munin URL';
$wb['munin_url_note_txt'] = 'Placeholder:';
?>
interface/web/admin/templates/server_config_server_edit.htm
@@ -77,6 +77,18 @@
                <label for="monit_password">{tmpl_var name='monit_password_txt'}</label>
                <input name="monit_password" id="monit_password" value="{tmpl_var name='monit_password'}" size="40" maxlength="255" type="text" class="textInput" />
            </div>
            <div class="ctrlHolder">
                <label for="munin_url">{tmpl_var name='munin_url_txt'}</label>
                <input name="munin_url" id="munin_url" value="{tmpl_var name='munin_url'}" size="40" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='munin_url_note_txt'} <a href="javascript:void(0);" class="addPlaceholder">[SERVERNAME]</a>
            </div>
            <div class="ctrlHolder">
                <label for="munin_user">{tmpl_var name='munin_user_txt'}</label>
                <input name="munin_user" id="munin_user" value="{tmpl_var name='munin_user'}" size="40" maxlength="255" type="text" class="textInput" />
            </div>
            <div class="ctrlHolder">
                <label for="munin_password">{tmpl_var name='munin_password_txt'}</label>
                <input name="munin_password" id="munin_password" value="{tmpl_var name='munin_password'}" size="40" maxlength="255" type="text" class="textInput" />
            </div>
        </fieldset>
            
        <input type="hidden" name="id" value="{tmpl_var name='id'}">
interface/web/monitor/lib/lang/de.lng
@@ -149,4 +149,7 @@
$wb['Show Monit'] = 'Monit anzeigen';
$wb['no_monit_url_defined_txt'] = 'Keine Monit-URL definiert.';
$wb['no_permissions_to_view_monit_txt'] = 'Sie haben nicht die Berechtigung, auf Monit zuzugreifen.';
$wb['Show Munin'] = 'Munin anzeigen';
$wb['no_munin_url_defined_txt'] = 'Keine Munin-URL definiert.';
$wb['no_permissions_to_view_munin_txt'] = 'Sie haben nicht die Berechtigung, auf Munin zuzugreifen.';
?>
interface/web/monitor/lib/lang/en.lng
@@ -149,4 +149,7 @@
$wb['Show Monit'] = 'Show Monit';
$wb['no_monit_url_defined_txt'] = 'No Monit URL defined.';
$wb['no_permissions_to_view_monit_txt'] = 'You are not allowed to access Monit.';
$wb['Show Munin'] = 'Show Munin';
$wb['no_munin_url_defined_txt'] = 'No Munin URL defined.';
$wb['no_permissions_to_view_munin_txt'] = 'You are not allowed to access Munin.';
?>
interface/web/monitor/lib/module.conf.php
@@ -125,6 +125,11 @@
                  'target'     => 'content',
                  'link'    => 'monitor/show_data.php?type=openvz_beancounter',
                  'html_id' => 'openvz_beancounter');
$items[] = array( 'title'     => "Show Munin",
                  'target'     => 'content',
                  'link'    => 'monitor/show_munin.php',
                  'html_id' => 'monit');
$module["nav"][] = array(    'title'    => 'Server State',
                            'open'     => 1,
interface/web/monitor/show_munin.php
New file
@@ -0,0 +1,82 @@
<?php
/*
Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('monitor');
$app->uses('tools_monitor');
// Loading the template
$app->uses('tpl');
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setInclude('content_tpl', 'templates/show_munin.htm');
$monTransSrv = $app->lng("monitor_settings_server_txt");
$title = 'Munin ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
$app->tpl->setVar("list_head_txt", $title);
if($_SESSION["s"]["user"]["typ"] == 'admin'){
    $app->uses('getconf');
    $server_config = $app->getconf->get_server_config($_SESSION['monitor']['server_id'],'server');
    $munin_url = trim($server_config['munin_url']);
    if($munin_url != ''){
        $munin_url = str_replace('[SERVERNAME]', $_SESSION['monitor']['server_name'], $munin_url);
        $munin_user = trim($server_config['munin_user']);
        $munin_password = trim($server_config['munin_password']);
        $auth_string = '';
        if($munin_user != ''){
            $auth_string = $munin_user;
        }
        if($munin_user != '' && $munin_password != ''){
            $auth_string .= ':'.$munin_password;
        }
        if($auth_string != '') $auth_string .= '@';
        $munin_url_parts = parse_url($munin_url);
        $munin_url = $munin_url_parts['scheme'].'://'.$auth_string.$munin_url_parts['host'].(isset($munin_url_parts['port']) ? ':' . $munin_url_parts['port'] : '').(isset($munin_url_parts['path']) ? $munin_url_parts['path'] : '').(isset($munin_url_parts['query']) ? '?' . $munin_url_parts['query'] : '').(isset($munin_url_parts['fragment']) ? '#' . $munin_url_parts['fragment'] : '');
        $app->tpl->setVar("munin_url", $munin_url);
    } else {
        $app->tpl->setVar("no_munin_url_defined_txt", $app->lng("no_munin_url_defined_txt"));
    }
} else {
    $app->tpl->setVar("no_permissions_to_view_munin_txt", $app->lng("no_permissions_to_view_munin_txt"));
}
$app->tpl_defaults();
$app->tpl->pparse();
?>
interface/web/monitor/templates/show_monit.htm
@@ -3,7 +3,7 @@
<div class="panel panel_system">
<tmpl_if name='monit_url'>
    <iframe src="{tmpl_var name="monit_url"}" width="100%" height="1000" frameborder="0" style="overflow:visible;"></iframe>
    <iframe src="{tmpl_var name='monit_url'}" width="100%" height="1000" frameborder="0" style="overflow:visible;"></iframe>
<tmpl_else>
    <div id="errorMsg"><h3>ERROR</h3><ol><li>{tmpl_var name="no_monit_url_defined_txt"} {tmpl_var name="no_permissions_to_view_monit_txt"}<br></li></ol></div>
</tmpl_if>
interface/web/monitor/templates/show_munin.htm
New file
@@ -0,0 +1,10 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_system">
<tmpl_if name='munin_url'>
    <iframe src="{tmpl_var name='munin_url'}" width="100%" height="1000" frameborder="0" style="overflow:visible;"></iframe>
<tmpl_else>
    <div id="errorMsg"><h3>ERROR</h3><ol><li>{tmpl_var name="no_munin_url_defined_txt"} {tmpl_var name="no_permissions_to_view_munin_txt"}<br></li></ol></div>
</tmpl_if>
</div>