|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * ------------------------------------------------------------------------- |
| 5 | + * Centreon plugin for GLPI |
| 6 | + * ------------------------------------------------------------------------- |
| 7 | + * |
| 8 | + * LICENSE |
| 9 | + * |
| 10 | + * This file is part of Centreon. |
| 11 | + * |
| 12 | + * Centreon is free software; you can redistribute it and/or modify |
| 13 | + * it under the terms of the GNU General Public License as published by |
| 14 | + * the Free Software Foundation; either version 3 of the License, or |
| 15 | + * (at your option) any later version. |
| 16 | + * |
| 17 | + * Centreon is distributed in the hope that it will be useful, |
| 18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | + * GNU General Public License for more details. |
| 21 | + * |
| 22 | + * You should have received a copy of the GNU General Public License |
| 23 | + * along with Centreon. If not, see <http://www.gnu.org/licenses/>. |
| 24 | + * ------------------------------------------------------------------------- |
| 25 | + * @copyright Copyright (C) 2022-2023 by Centreon plugin team. |
| 26 | + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html |
| 27 | + * @link https://github.com/pluginsGLPI/centreon |
| 28 | + * ------------------------------------------------------------------------- |
| 29 | + */ |
| 30 | + |
| 31 | +use GlpiPlugin\Centreon\Host; |
| 32 | + |
| 33 | +use function Safe\json_encode; |
| 34 | + |
| 35 | +Session::checkRight('computer', UPDATE); |
| 36 | + |
| 37 | +header('Content-Type: application/json'); |
| 38 | + |
| 39 | +if (!isset($_GET['host_id'])) { |
| 40 | + echo json_encode(['error' => 'Missing host_id']); |
| 41 | +} else { |
| 42 | + $host_id = $_GET['host_id']; |
| 43 | + $host = new Host(); |
| 44 | + $res = $host->oneHost($host_id); |
| 45 | + echo json_encode(['in_downtime' => $res['in_downtime'] ?? null]); |
| 46 | +} |
0 commit comments