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-2014 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     2013

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkRight("plugin_monitoring_restartshinken", READ);
$pmShinkenwebservice = new PluginMonitoringShinkenwebservice();
if (isset($_GET["tag"])) {
    $pmShinkenwebservice->sendRestartArbiter(1, $_GET["tag"], isset($_GET["action"]) ? $_GET["action"] : 'reload');
} else {
    $pmShinkenwebservice->sendRestartArbiter(1);
}
Html::back();
 /**
  * Get modifications of resources (if have modifications);
  */
 function configurationchangesMessage()
 {
     global $DB;
     $input = '';
     $pmLog = new PluginMonitoringLog();
     // Get id of last Shinken restart
     $id_restart = 0;
     $a_restarts = $pmLog->find("(`action`='restart' OR `action`='restart_planned')", "`id` DESC", 1);
     if (count($a_restarts) > 0) {
         $a_restart = current($a_restarts);
         $id_restart = $a_restart['id'];
     }
     // get number of modifications
     $nb_delete = 0;
     $nb_add = 0;
     $nb_update = 0;
     $nb_delete = countElementsInTable(getTableForItemType('PluginMonitoringLog'), "`id` > '" . $id_restart . "'\n         AND `action`='delete'");
     $nb_add = countElementsInTable(getTableForItemType('PluginMonitoringLog'), "`id` > '" . $id_restart . "'\n         AND `action`='add'");
     $nb_update = countElementsInTable(getTableForItemType('PluginMonitoringLog'), "`id` > '" . $id_restart . "'\n         AND `action`='update'");
     if ($nb_delete > 0 or $nb_add > 0 or $nb_update > 0) {
         $input .= __('The configuration has changed', 'monitoring') . "<br/>";
         if ($nb_add > 0) {
             $input .= "<a onClick='Ext.get(\"added_elements\").toggle();'>" . $nb_add . "</a> " . __('resources added', 'monitoring');
             echo "<div style='position:absolute;z-index:10;left: 50%;\n               margin-left: -350px;margin-top:40px;display:none'\n               class='msgboxmonit msgboxmonit-grey' id='added_elements'>";
             $query = "SELECT * FROM `" . getTableForItemType('PluginMonitoringLog') . "`\n               WHERE `id` > '" . $id_restart . "' AND `action`='add'\n               ORDER BY `id` DESC";
             $result = $DB->query($query);
             while ($data = $DB->fetch_array($result)) {
                 echo "[" . Html::convDateTime($data['date_mod']) . "] Add " . $data['value'] . "<br/>";
             }
             echo "</div>";
         }
         if ($nb_delete > 0) {
             if ($nb_add > 0) {
                 $input .= " / ";
             }
             $input .= "<a onClick='Ext.get(\"deleted_elements\").toggle();'>" . $nb_delete . "</a> " . __('resources deleted', 'monitoring');
             echo "<div style='position:absolute;z-index:10;left: 50%;\n               margin-left: -350px;margin-top:40px;display:none'\n               class='msgboxmonit msgboxmonit-grey' id='deleted_elements'>";
             $query = "SELECT * FROM `" . getTableForItemType('PluginMonitoringLog') . "`\n               WHERE `id` > '" . $id_restart . "' AND `action`='delete'\n               ORDER BY `id` DESC";
             $result = $DB->query($query);
             while ($data = $DB->fetch_array($result)) {
                 echo "[" . Html::convDateTime($data['date_mod']) . "] Delete " . $data['value'] . "<br/>";
             }
             echo "</div>";
         }
         if ($nb_update > 0) {
             if ($nb_add > 0 or $nb_delete > 0) {
                 $input .= " / ";
             }
             $input .= "<a onClick='Ext.get(\"updated_elements\").toggle();'>" . $nb_update . "</a> " . __('resources updated', 'monitoring');
             echo "<div style='position:absolute;z-index:10;left: 50%;\n               margin-left: -350px;margin-top:40px;display:none'\n               class='msgboxmonit msgboxmonit-grey' id='updated_elements'>";
             $query = "SELECT * FROM `" . getTableForItemType('PluginMonitoringLog') . "`\n               WHERE `id` > '" . $id_restart . "' AND `action`='update'\n               ORDER BY `id` DESC";
             $result = $DB->query($query);
             while ($data = $DB->fetch_array($result)) {
                 echo "[" . Html::convDateTime($data['date_mod']) . "] Update " . $data['value'] . "<br/>";
             }
             echo "</div>";
         }
         $input .= "<br/>";
         // Try to restart Shinken via webservice
         $pmShinkenwebservice = new PluginMonitoringShinkenwebservice();
         $pmShinkenwebservice->sendRestartArbiter();
         $input .= __('Shinken is restarted automatically', 'monitoring');
         //$input .= __('Restart Shinken to reload this new configuration', 'monitoring');
     }
     return $input;
 }
예제 #3
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     2013

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
PluginMonitoringProfile::checkRight("command", "w");
$pmShinkenwebservice = new PluginMonitoringShinkenwebservice();
$pmShinkenwebservice->sendRestartArbiter(1);
Html::back();