Example #1
0
function pluginMonitoringInstall($version)
{
    global $DB, $LANG, $CFG_GLPI;
    // ** Insert in DB
    $DB_file = GLPI_ROOT . "/plugins/monitoring/install/mysql/plugin_monitoring-" . $version . "-empty.sql";
    $DBf_handle = fopen($DB_file, "rt");
    $sql_query = fread($DBf_handle, filesize($DB_file));
    fclose($DBf_handle);
    foreach (explode(";\n", "{$sql_query}") as $sql_line) {
        if (get_magic_quotes_runtime()) {
            $sql_line = stripslashes_deep($sql_line);
        }
        if (!empty($sql_line)) {
            $DB->query($sql_line);
        }
    }
    include GLPI_ROOT . "/plugins/monitoring/inc/profile.class.php";
    $pmProfile = new PluginMonitoringProfile();
    $pmProfile->initProfile();
    include GLPI_ROOT . "/plugins/monitoring/inc/command.class.php";
    $pmCommand = new PluginMonitoringCommand();
    $pmCommand->initCommands();
    include GLPI_ROOT . "/plugins/monitoring/inc/notificationcommand.class.php";
    $pmNotificationcommand = new PluginMonitoringNotificationcommand();
    $pmNotificationcommand->initCommands();
    include GLPI_ROOT . "/plugins/monitoring/inc/check.class.php";
    $pmCheck = new PluginMonitoringCheck();
    $pmCheck->initChecks();
    include GLPI_ROOT . "/plugins/monitoring/inc/hostconfig.class.php";
    $pmHostconfig = new PluginMonitoringHostconfig();
    $pmHostconfig->initConfig();
    include GLPI_ROOT . "/plugins/monitoring/inc/config.class.php";
    $pmConfig = new PluginMonitoringConfig();
    $pmConfig->initConfig();
    $query = "UPDATE `glpi_plugin_monitoring_configs`\n      SET `version`='" . PLUGIN_MONITORING_VERSION . "'\n         WHERE `id`='1'";
    $DB->query($query);
    if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring')) {
        mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring");
    }
    if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/templates')) {
        mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/templates");
    }
    if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/weathermapbg')) {
        mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/weathermapbg");
    }
    CronTask::Register('PluginMonitoringServiceevent', 'updaterrd', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
    CronTask::Register('PluginMonitoringLog', 'cleanlogs', '96400', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
    CronTask::Register('PluginMonitoringUnavaibility', 'unavaibility', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
}
 function defineTabs($options = array())
 {
     global $LANG, $CFG_GLPI;
     if (isset($_GET['glpi_tab'])) {
         setActiveTab("PluginMonitoringDisplay", $_GET['glpi_tab']);
     }
     $pmDisplayview = new PluginMonitoringDisplayview();
     $ong = array();
     if (PluginMonitoringProfile::haveRight("servicescatalog", 'r')) {
         $ong[1] = $LANG['plugin_monitoring']['servicescatalog'][0];
     }
     if (PluginMonitoringProfile::haveRight("componentscatalog", 'r')) {
         $ong[2] = $LANG['plugin_monitoring']['componentscatalog'][0];
     }
     $ong[3] = $LANG['plugin_monitoring']['service'][21];
     $ong[4] = $LANG['plugin_monitoring']['host'][1];
     if (PluginMonitoringProfile::haveRight("view", 'r')) {
         $i = 5;
         $a_views = $pmDisplayview->getViews();
         foreach ($a_views as $name) {
             $ong[$i] = htmlentities($name);
             $i++;
         }
     }
     return $ong;
 }
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $array_ret = array();
     if (PluginMonitoringProfile::haveRight("servicescatalog", 'r')) {
         $array_ret[49] = self::createTabEntry(__('Monitoring', 'monitoring') . "-" . __('Services catalog', 'monitoring'));
     }
     return $array_ret;
 }
Example #4
0
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     $array_ret = array();
     if ($item->getID() > -1) {
         if (PluginMonitoringProfile::haveRight("config", 'r')) {
             $array_ret[0] = self::createTabEntry(__('Monitoring', 'monitoring'));
         }
     }
     return $array_ret;
 }
Example #5
0
 static function getMessages()
 {
     global $CFG_GLPI;
     $pmMessage = new self();
     // Display if shinken is in restart or if restarted less than 5 minutes
     echo "<div id='shikenrestart'></div>";
     echo "<script type=\"text/javascript\">\n      var elshikenrestart = Ext.get(\"shikenrestart\");\n      var mgrshikenrestart = elshikenrestart.getUpdateManager();\n      mgrshikenrestart.loadScripts=true;\n      mgrshikenrestart.showLoadIndicator=false;\n      mgrshikenrestart.startAutoRefresh(20, \"" . $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/updateshinkenrestartmessage.php\", \"\", \"\", true);";
     echo "</script>";
     $servicecatalog = '';
     $confchanges = '';
     if (PluginMonitoringProfile::haveRight("servicescatalog", 'w')) {
         $servicecatalog = $pmMessage->servicescatalogMessage();
     }
     $confchanges = $pmMessage->configurationchangesMessage();
     $runningshinken = $pmMessage->ShinkennotrunMessage();
     $i = 0;
     if ($servicecatalog != '' or $confchanges != '') {
         echo "<div class='msgboxmonit msgboxmonit-orange'>";
         if ($confchanges != '') {
             echo $confchanges;
             $i++;
         }
         if ($servicecatalog != '') {
             if ($i > 0) {
                 echo "</div>";
                 echo "<div class='msgboxmonit msgboxmonit-orange'>";
             }
             echo $servicecatalog;
             $i++;
         }
         if ($runningshinken != '') {
             if ($i > 0) {
                 echo "</div>";
                 echo "<div class='msgboxmonit msgboxmonit-red'>";
             }
             echo $runningshinken . "!";
             $i++;
         }
         echo "</div>";
     }
 }
 static function getMessages()
 {
     $pmMessage = new self();
     $servicecatalog = '';
     $confchanges = '';
     if (PluginMonitoringProfile::haveRight("servicescatalog", 'w')) {
         $servicecatalog = $pmMessage->servicescatalogMessage();
     }
     $confchanges = $pmMessage->configurationchangesMessage();
     $runningshinken = $pmMessage->ShinkennotrunMessage();
     $i = 0;
     if ($servicecatalog != '' or $confchanges != '') {
         echo "<div class='msgboxmonit msgboxmonit-orange'>";
         if ($confchanges != '') {
             echo $confchanges;
             $i++;
         }
         if ($servicecatalog != '') {
             if ($i > 0) {
                 echo "</div>";
                 echo "<div class='msgboxmonit msgboxmonit-orange'>";
             }
             echo $servicecatalog;
             $i++;
         }
         if ($runningshinken != '') {
             if ($i > 0) {
                 echo "</div>";
                 echo "<div class='msgboxmonit msgboxmonit-red'>";
             }
             echo $runningshinken . "!";
             $i++;
         }
         echo "</div>";
     }
 }
Example #7
0
 static function canView()
 {
     return PluginMonitoringProfile::haveRight("componentscatalog", 'r');
 }
  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2012 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
define('GLPI_ROOT', '../../..');
include GLPI_ROOT . "/inc/includes.php";
PluginMonitoringProfile::checkRight("view", "w");
commonHeader($LANG['plugin_monitoring']['title'][0], $_SERVER["PHP_SELF"], "plugins", "monitoring", "displayview");
$pmDisplayview = new PluginMonitoringDisplayview();
if (isset($_POST['users_id'])) {
    if ($_POST['users_id'] == 'public') {
        $_POST['users_id'] = '0';
    } else {
        $_POST['users_id'] = $_SESSION['glpiID'];
    }
}
if (isset($_POST["add"])) {
    $pmDisplayview->add($_POST);
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["update"])) {
        $pmDisplayview->update($_POST);
Example #9
0
    echo "</th>";
    echo "<th rowspan='2'>";
    if (PluginMonitoringProfile::haveRight("config", 'r')) {
        echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/tag.php'>" . __('Tag', 'monitoring') . "</a>";
    }
    echo "</th>";
    echo "</tr>";
    echo "<tr class='tab_bg_1'>";
    echo "<th width='15%' height='25'>";
    if (PluginMonitoringProfile::haveRight("command", 'r')) {
        echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/command.php'>" . __('Commands', 'monitoring') . "</a>";
    }
    echo "</th>";
    echo "<th width='15%'>";
    if (PluginMonitoringProfile::haveRight("check", 'r')) {
        echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/check.php'>" . __('Check definition', 'monitoring') . "</a>";
    }
    echo "</th>";
    echo "<th width='15%'>";
    if (Session::haveRight('calendar', 'r')) {
        echo "<a href='" . $CFG_GLPI['root_doc'] . "/front/calendar.php'>" . __('Calendar') . "</a>";
    }
    echo "</th>";
    echo "<th width='15%'>";
    if (PluginMonitoringProfile::haveRight("command", 'r')) {
        echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/eventhandler.php'>" . __('Event handler', 'monitoring') . "</a>";
    }
    echo "</th>";
    echo "</table>";
}
Html::footer();
Example #10
0
  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2012 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
define('GLPI_ROOT', '../../..');
include GLPI_ROOT . "/inc/includes.php";
PluginMonitoringProfile::checkRight("config", "w");
commonHeader($LANG['plugin_monitoring']['title'][0], $_SERVER["PHP_SELF"], "plugins", "monitoring", "config");
$pmConfig = new PluginMonitoringConfig();
if (isset($_POST["update"])) {
    $pmConfig->update($_POST);
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST['timezones_add'])) {
        $input = array();
        $pmConfig->getFromDB($_POST['id']);
        $input['id'] = $_POST['id'];
        $a_timezones = importArrayFromDB($pmConfig->fields['timezones']);
        foreach ($_POST['timezones_to_add'] as $timezone) {
            $a_timezones[] = $timezone;
        }
        $input['timezones'] = exportArrayToDB($a_timezones);
 function canView()
 {
     return PluginMonitoringProfile::haveRight("servicescatalog", 'r');
 }
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with Monitoring. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2013 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
PluginMonitoringProfile::checkRight("servicescatalog", "w");
$dropdown = new PluginMonitoringServicescatalog();
if (isset($_GET['detail']) and isset($_GET['id'])) {
    Html::header(__('Monitoring', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "servicescatalog");
    $dropdown->showBADetail($_GET['id']);
    Html::footer();
} else {
    Html::header(__('Monitoring', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "servicescatalog");
    include GLPI_ROOT . "/front/dropdown.common.form.php";
}
 function canUndo()
 {
     return PluginMonitoringProfile::haveRight("view", 'w');
 }
 function canUndo()
 {
     return PluginMonitoringProfile::haveRight("weathermap", 'w');
 }
Example #15
0
}
echo "</th>";
echo "<th rowspan='2'>";
if (PluginMonitoringProfile::haveRight("config", 'r')) {
    echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/realm.php'>" . $LANG['plugin_monitoring']['realms'][0] . "</a>";
}
echo "</th>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<th width='18%' height='25'>";
if (PluginMonitoringProfile::haveRight("command", 'r')) {
    echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/command.php'>" . $LANG['plugin_monitoring']['command'][0] . "</a>";
}
echo "</th>";
echo "<th width='18%'>";
if (PluginMonitoringProfile::haveRight("check", 'r')) {
    echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/check.php'>" . $LANG['plugin_monitoring']['check'][0] . "</a>";
}
echo "</th>";
echo "<th width='18%'>";
if (haveRight('calendar', 'r')) {
    echo "<a href='" . $CFG_GLPI['root_doc'] . "/front/calendar.php'>" . $LANG['buttons'][15] . "</a>";
}
echo "</th>";
echo "<th width='18%'>";
if (PluginMonitoringProfile::haveRight("config", 'r')) {
    echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/rrdtemplate.php'>" . $LANG['plugin_monitoring']['rrdtemplates'][0] . "</a>";
}
echo "</th>";
echo "</table>";
commonFooter();
 function canCancel()
 {
     return PluginMonitoringProfile::haveRight("config", 'w');
 }
Example #17
0
  You should have received a copy of the GNU Affero General Public License
  along with Monitoring. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2013 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkRight("profile", "r");
$pmProfile = new PluginMonitoringProfile();
Session::checkRight("profile", "w");
if ($pmProfile->getFromDB($_POST['profiles_id'])) {
    $pmProfile->update($_POST);
    $pmProfile->changeprofile();
    Html::back();
} else {
    $pmProfile->add($_POST);
    $pmProfile->changeprofile();
    Html::back();
}
Example #18
0
 static function checkRight($module, $right)
 {
     global $CFG_GLPI;
     if (!PluginMonitoringProfile::haveRight($module, $right)) {
         // Gestion timeout session
         if (!Session::getLoginUserID()) {
             Html::redirect($CFG_GLPI["root_doc"] . "/index.php");
             exit;
         }
         Html::displayRightError();
     }
 }
Example #19
0
function pluginMonitoringInstall($version)
{
    global $DB, $CFG_GLPI;
    // ** Insert in DB
    $DB_file = GLPI_ROOT . "/plugins/monitoring/install/mysql/plugin_monitoring-" . $version . "-empty.sql";
    $DBf_handle = fopen($DB_file, "rt");
    $sql_query = fread($DBf_handle, filesize($DB_file));
    fclose($DBf_handle);
    foreach (explode(";\n", "{$sql_query}") as $sql_line) {
        if (get_magic_quotes_runtime()) {
            $sql_line = Toolbox::stripslashes_deep($sql_line);
        }
        if (!empty($sql_line)) {
            $DB->query($sql_line);
        }
    }
    include GLPI_ROOT . "/plugins/monitoring/inc/profile.class.php";
    $pmProfile = new PluginMonitoringProfile();
    $pmProfile->initProfile();
    include GLPI_ROOT . "/plugins/monitoring/inc/command.class.php";
    $pmCommand = new PluginMonitoringCommand();
    $pmCommand->initCommands();
    include GLPI_ROOT . "/plugins/monitoring/inc/notificationcommand.class.php";
    $pmNotificationcommand = new PluginMonitoringNotificationcommand();
    $pmNotificationcommand->initCommands();
    include GLPI_ROOT . "/plugins/monitoring/inc/check.class.php";
    $pmCheck = new PluginMonitoringCheck();
    $pmCheck->initChecks();
    include GLPI_ROOT . "/plugins/monitoring/inc/hostconfig.class.php";
    $pmHostconfig = new PluginMonitoringHostconfig();
    $pmHostconfig->initConfig();
    include GLPI_ROOT . "/plugins/monitoring/inc/config.class.php";
    $pmConfig = new PluginMonitoringConfig();
    $pmConfig->initConfig();
    $query = "UPDATE `glpi_plugin_monitoring_configs`\n      SET `version`='" . PLUGIN_MONITORING_VERSION . "'\n         WHERE `id`='1'";
    $DB->query($query);
    $query = "SELECT * FROM `glpi_calendars`\n      WHERE `name`='24x7'\n      LIMIT 1";
    $result = $DB->query($query);
    if ($DB->numrows($result) == 0) {
        $calendar = new Calendar();
        $input = array();
        $input['name'] = '24x7';
        $input['is_recursive'] = 1;
        $calendars_id = $calendar->add($input);
        $calendarSegment = new CalendarSegment();
        $input = array();
        $input['calendars_id'] = $calendars_id;
        $input['is_recursive'] = 1;
        $input['begin'] = '00:00:00';
        $input['end'] = '24:00:00';
        $input['day'] = '0';
        $calendarSegment->add($input);
        $input['day'] = '1';
        $calendarSegment->add($input);
        $input['day'] = '2';
        $calendarSegment->add($input);
        $input['day'] = '3';
        $calendarSegment->add($input);
        $input['day'] = '4';
        $calendarSegment->add($input);
        $input['day'] = '5';
        $calendarSegment->add($input);
        $input['day'] = '6';
        $calendarSegment->add($input);
    }
    if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring')) {
        mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring");
    }
    if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/templates')) {
        mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/templates");
    }
    if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/weathermapbg')) {
        mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/weathermapbg");
    }
    CronTask::Register('PluginMonitoringServiceevent', 'updaterrd', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
    CronTask::Register('PluginMonitoringLog', 'cleanlogs', '96400', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
    CronTask::Register('PluginMonitoringUnavaibility', 'unavaibility', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
    CronTask::Register('PluginMonitoringDisplayview_rule', 'replayallviewrules', '1200', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
}
 static function canView()
 {
     return PluginMonitoringProfile::haveRight("weathermap", 'r');
 }
Example #21
0
 static function canView()
 {
     return PluginMonitoringProfile::haveRight("config", 'r');
 }
Example #22
0
  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2013 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkCentralAccess();
Html::header(__('Monitoring', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "services");
$pmService = new PluginMonitoringService();
if (isset($_POST['update'])) {
    foreach ($_POST['arg'] as $key => $value) {
        if ($value == '') {
            unset($_POST['arg'][$key]);
        }
    }
    $_POST['arguments'] = exportArrayToDB($_POST['arg']);
    $pmService->update($_POST);
    Html::back();
}
if (PluginMonitoringProfile::haveRight("componentscatalog", 'w')) {
    $pmService->showCustomArguments($_GET['id']);
}
Html::footer();
Example #23
0
 static function displayLine($data, $displayhost = 1)
 {
     global $DB, $CFG_GLPI;
     $pMonitoringService = new PluginMonitoringService();
     $networkPort = new NetworkPort();
     $pMonitoringComponent = new PluginMonitoringComponent();
     $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
     $entity = new Entity();
     $pMonitoringService->getFromDB($data['id']);
     echo "<td width='32' class='center'>";
     $shortstate = self::getState($data['state'], $data['state_type'], $data['event'], $data['is_acknowledged']);
     $alt = __('Ok', 'monitoring');
     if ($shortstate == 'orange') {
         $alt = __('Warning (data)', 'monitoring');
     } else {
         if ($shortstate == 'yellow') {
             $alt = __('Warning (connection)', 'monitoring');
         } else {
             if ($shortstate == 'red') {
                 $alt = __('Critical', 'monitoring');
             } else {
                 if ($shortstate == 'redblue') {
                     $alt = __('Critical / Acknowledge', 'monitoring');
                 }
             }
         }
     }
     echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/box_" . $shortstate . "_32.png'\n         title='" . $alt . "' alt='" . $alt . "' />";
     echo "</td>";
     echo "<td>";
     $entity->getFromDB($data['entities_id']);
     echo $entity->fields['completename'];
     echo "</td>";
     $pMonitoringComponent->getFromDB($data['plugin_monitoring_components_id']);
     echo "<td class='center'>";
     $timezone = '0';
     if (isset($_SESSION['plugin_monitoring_timezone'])) {
         $timezone = $_SESSION['plugin_monitoring_timezone'];
     }
     if ($pMonitoringComponent->fields['graph_template'] != '') {
         echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display.form.php?itemtype=PluginMonitoringService&items_id=" . $data['id'] . "'>";
         $pmServicegraph = new PluginMonitoringServicegraph();
         ob_start();
         $pmServicegraph->displayGraph($pMonitoringComponent->fields['graph_template'], "PluginMonitoringService", $data['id'], "0", '2h', "div", "600");
         $div = ob_get_contents();
         ob_end_clean();
         $chart = "<table width='600' class='tab_cadre'><tr><td>" . $div . "</td></tr></table>";
         Html::showToolTip($chart, array('img' => $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/stats_32.png"));
         $pmServicegraph->displayGraph($pMonitoringComponent->fields['graph_template'], "PluginMonitoringService", $data['id'], "0", '2h', "js");
     }
     echo "</a>";
     echo "</td>";
     if ($displayhost == '1') {
         $pmComponentscatalog_Host->getFromDB($data["plugin_monitoring_componentscatalogs_hosts_id"]);
         if (isset($pmComponentscatalog_Host->fields['itemtype']) and $pmComponentscatalog_Host->fields['itemtype'] != '') {
             $itemtype = $pmComponentscatalog_Host->fields['itemtype'];
             $item = new $itemtype();
             $item->getFromDB($pmComponentscatalog_Host->fields['items_id']);
             echo "<td>";
             echo $item->getTypeName() . " : " . $item->getLink();
             if (!is_null($pMonitoringService->fields['networkports_id']) and $pMonitoringService->fields['networkports_id'] > 0) {
                 $networkPort->getFromDB($pMonitoringService->fields['networkports_id']);
                 echo " [" . $networkPort->getLink() . "]";
             }
             echo "</td>";
         } else {
             echo "<td>" . __('Resources', 'monitoring') . "</td>";
         }
     }
     echo "<td>" . $pMonitoringComponent->getLink();
     if (!is_null($pMonitoringService->fields['networkports_id']) and $pMonitoringService->fields['networkports_id'] > 0) {
         $networkPort->getFromDB($pMonitoringService->fields['networkports_id']);
         echo " [" . $networkPort->getLink() . "]";
     }
     echo "</td>";
     //      $nameitem = '';
     //      if (isset($itemmat->fields['name'])) {
     //         $nameitem = "[".$itemmat->getLink(1)."]";
     //      }
     //if ($pMonitoringService->fields['plugin_monitoring_services_id'] == '0') {
     //echo "<td>".$itemmat->getLink(1)."</td>";
     //      } else {
     //         $pMonitoringServiceH->getFromDB($pMonitoringService->fields['plugin_monitoring_services_id']);
     //         $itemtypemat = $pMonitoringServiceH->fields['itemtype'];
     //         $itemmat = new $itemtypemat();
     //         $itemmat->getFromDB($pMonitoringServiceH->fields['items_id']);
     //         echo "<td>".$pMonitoringService->getLink(1).$nameitem." ".__('on', 'monitoring')." ".$itemmat->getLink(1)."</td>";
     //      }
     //      unset($itemmat);
     echo "<td class='center'>";
     if ($shortstate == 'red') {
         echo "<table>";
         echo "<tr>";
         echo "<td>";
         echo $data['state'];
         echo "</td>";
         echo "<td>";
         echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/acknowledge.form.php?id=" . $data['id'] . "'>" . "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/acknowledge_checked.png'" . " alt='" . __('Define an acknowledge', 'monitoring') . "'" . " title='" . __('Define an acknowledge', 'monitoring') . "'/>" . "</a>";
         echo "</td>";
         echo "</tr>";
         echo "</table>";
     } else {
         echo $data['state'];
     }
     echo "</td>";
     echo "<td>";
     echo Html::convDate($data['last_check']) . ' ' . substr($data['last_check'], 11, 8);
     echo "</td>";
     echo "<td>";
     echo $data['event'];
     echo "</td>";
     echo "<td align='center'>";
     $segments = CalendarSegment::getSegmentsBetween($pMonitoringComponent->fields['calendars_id'], date('w', date('U')), date('H:i:s'), date('w', date('U')), date('H:i:s'));
     if (count($segments) == '0') {
         echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/service_pause.png' />";
     } else {
         echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/service_run.png' />";
     }
     echo "</td>";
     if ($displayhost == '0') {
         $pmUnavaibility = new PluginMonitoringUnavaibility();
         $pmUnavaibility->displayValues($pMonitoringService->fields['id'], 'currentmonth', 1);
         $pmUnavaibility->displayValues($pMonitoringService->fields['id'], 'lastmonth', 1);
         $pmUnavaibility->displayValues($pMonitoringService->fields['id'], 'currentyear', 1);
         echo "<td class='center'>";
         echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/unavaibility.php?" . "field[0]=2&searchtype[0]=equals&contains[0]=" . $pMonitoringService->fields['id'] . "&sort=3&order=DESC&itemtype=PluginMonitoringUnavaibility'>\n            <img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/info.png'/></a>";
         echo "</td>";
     }
     echo "<td>";
     if ($shortstate == 'redblue') {
         echo "<i>" . _n('User', 'Users', 1) . " : </i>";
         $user = new User();
         $user->getFromDB($data['acknowledge_users_id']);
         echo $user->getName(1);
         echo "<br/>";
         echo "<i>" . __('Comments') . " : </i>" . $data['acknowledge_comment'];
     }
     echo "</td>";
     if ($displayhost == '0') {
         echo "<td>";
         if (PluginMonitoringProfile::haveRight("componentscatalog", 'w')) {
             $a_arg = importArrayFromDB($pMonitoringService->fields['arguments']);
             $cnt = '';
             if (count($a_arg) > 0) {
                 $cnt = " (" . count($a_arg) . ")";
             }
             echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/servicearg.form.php?id=" . $data['id'] . "'>" . __('Configure', 'monitoring') . $cnt . "</a>";
         }
         echo "</td>";
     }
 }
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with Monitoring. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2013 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
PluginMonitoringProfile::checkRight("componentscatalog", "w");
//
//Html::header(__('Monitoring', 'monitoring'),$_SERVER["PHP_SELF"], "plugins",
//       "monitoring", "reports");
$pmComponentscatalog = new PluginMonitoringComponentscatalog();
if ($_POST['reporttype'] == 'simplereport') {
    $pmComponentscatalog->generateReport($_POST);
} else {
    $pmComponentscatalog->generateSyntheseReport($_POST);
}
  ------------------------------------------------------------------------

  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2013 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
PluginMonitoringProfile::checkRight("weathermap", "w");
Html::header(__('Monitoring', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "weathermaplink");
$pmWeathermaplink = new PluginMonitoringWeathermaplink();
if (isset($_POST["add"])) {
    $split = explode("-", $_POST['linksource']);
    $_POST['plugin_monitoring_weathermapnodes_id_1'] = $split[0];
    $_POST['plugin_monitoring_services_id'] = $split[1];
    $pmWeathermaplink->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $_POST['id'] = $_POST['id_update'];
        unset($_POST['plugin_monitoring_weathermapnodes_id_1']);
        unset($_POST['plugin_monitoring_weathermapnodes_id_2']);
        $_POST['bandwidth_in'] = $_POST['up_bandwidth_in'];
        $_POST['bandwidth_out'] = $_POST['up_bandwidth_out'];
Example #26
0
  it under the terms of the GNU Affero General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  Plugin Monitoring for GLPI is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with Monitoring. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2013 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
PluginMonitoringProfile::checkRight("check", "r");
Html::header(__('Monitoring', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "checks");
Search::show('PluginMonitoringCheck');
Html::footer();
Example #27
0
function plugin_headings_monitoring_profile($item)
{
    $pmProfile = new PluginMonitoringProfile();
    $pmProfile->showForm($item->getID());
}
 function canUndo()
 {
     return PluginMonitoringProfile::haveRight("componentscatalog", 'w');
 }
Example #29
0
  ------------------------------------------------------------------------

  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2013 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
PluginMonitoringProfile::checkRight("command", "w");
Html::header(__('Monitoring', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "command");
$pMonitoringCommand = new PluginMonitoringCommand();
if (isset($_POST["copy"])) {
    $pMonitoringCommand->showForm("", array(), $_POST);
    Html::footer();
    exit;
} else {
    if (isset($_POST["add"])) {
        $_POST = $pMonitoringCommand->convertPostdata($_POST);
        $pMonitoringCommand->add($_POST);
        Html::back();
    } else {
        if (isset($_POST["update"])) {
            $_POST = $pMonitoringCommand->convertPostdata($_POST);
            $pMonitoringCommand->update($_POST);
Example #30
0
  it under the terms of the GNU Affero General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  Plugin Monitoring for GLPI is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with Monitoring. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   Plugin Monitoring for GLPI
  @author    David Durieux
  @co-author 
  @comment   
  @copyright Copyright (c) 2011-2013 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
PluginMonitoringProfile::checkRight("component", "r");
Html::header(__('Monitoring', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "components");
Search::show('PluginMonitoringComponent');
Html::footer();