if (!isset($_GET['service']) || !isset($_GET['session_id'])) {
    exit;
}
list($hostId, $serviceId) = explode('-', $_GET['service']);
$db = new CentreonDB("centstorage");
$res = $db->query("SELECT `id`\n\t\t\t\t   FROM index_data\n    \t\t\t   WHERE host_id = " . $db->escape($hostId) . "\n    \t\t\t   AND service_id = " . $db->escape($serviceId) . "\n    \t\t\t   LIMIT 1");
if ($res->numRows()) {
    $row = $res->fetchRow();
    $index = $row["id"];
} else {
    $index = 0;
}
/**
 * Create XML Request Objects
 */
$obj = new CentreonGraph($_GET["session_id"], $index, 0, 1);
if (trim(session_id()) != trim($_GET['session_id'])) {
    $obj->displayError();
}
require_once $centreon_path . "www/include/common/common-Func.php";
/**
 * Set arguments from GET
 */
$graphPeriod = isset($_GET['tp']) ? $_GET['tp'] : 60 * 60 * 48;
$obj->setRRDOption("start", time() - $graphPeriod);
$obj->setRRDOption("end", time());
$obj->GMT->getMyGMTFromSession($obj->session_id, $db);
/**
 * Template Management
 */
$obj->setTemplate();
 /**
  * Constructor
  *
  * @param int $index The index data id
  * @param string $sid The session id
  */
 public function __construct($index, $sid)
 {
     parent::__construct($sid, $index, 0, 1);
 }