Dimitrii
Messages postés686Date d'inscriptionlundi 4 février 2008StatutMembreDernière intervention24 août 2013
-
5 févr. 2009 à 13:28
rasta35 -
8 mars 2010 à 10:46
Bonjour,
j'ai un souci qui me .... RRRrrrr !
Je fais appel aux maîtres de la programmation.
Voila je travail sur la surveillances des éléments actifs du réseaux avec cacti + rrdtool + WAMP.
J'ai suivi le tuto suivant : http://www.nagios-fr.org/wiki/cacti/windows-install Tout c'est bien déroulé jusqu'à l'installation de cacti ! La j'ai un pb :s
je rentre les commandes suivante :
1 out of 1 hunk FAILED -- saving rejects to file fix_search_session_clear_issue.
patch.rej
La configuratrion du mon host.php est la suivante :
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004 Ian Berry |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program 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 General Public License for more details. |
+-------------------------------------------------------------------------+
| cacti: a php-based graphing solution |
+-------------------------------------------------------------------------+
| Most of this code has been designed, written and is maintained by |
| Ian Berry. See about.php for specific developer credit. Any questions |
| or comments regarding this code should be directed to: |
| - iberry@raxnet.net |
+-------------------------------------------------------------------------+
| - raXnet - http://iankberry.com/ |
+-------------------------------------------------------------------------+
*/
/* ------------------------
The "actions" function
------------------------ */
function form_actions() {
global $colors, $device_actions, $fields_host_edit;
/* if we are to save this form, instead of display it */
if (isset($_POST["selected_items"])) {
$selected_items = unserialize(stripslashes($_POST["selected_items"]));
if (!isset($_POST["delete_type"])) { $_POST["delete_type"] = 2; }
switch ($_POST["delete_type"]) {
case '1': /* leave graphs and data_sources in place, but disable the data sources */
$data_sources = db_fetch_assoc("select
data_local.id as local_data_id
from data_local
where " . array_to_sql_or($selected_items, "data_local.host_id"));
if (sizeof($data_sources) > 0) {
foreach ($data_sources as $data_source) {
api_data_source_disable($data_source["local_data_id"]);
}
}
break;
case '2': /* delete graphs/data sources tied to this device */
$data_sources = db_fetch_assoc("select
data_local.id as local_data_id
from data_local
where " . array_to_sql_or($selected_items, "data_local.host_id"));
if (sizeof($data_sources) > 0) {
foreach ($data_sources as $data_source) {
api_data_source_remove($data_source["local_data_id"]);
}
}
$graphs = db_fetch_assoc("select
graph_local.id as local_graph_id
from graph_local
where " . array_to_sql_or($selected_items, "graph_local.host_id"));
if (sizeof($graphs) > 0) {
foreach ($graphs as $graph) {
api_graph_remove($graph["local_graph_id"]);
}
}
break;
}
api_device_remove($selected_items[$i]);
}
}elseif (ereg("^tr_([0-9]+)$", $_POST["drp_action"], $matches)) { /* place on tree */
for ($i=0;($i<count($selected_items));$i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
input_validate_input_number(get_request_var_post("tree_id"));
input_validate_input_number(get_request_var_post("tree_item_id"));
/* ==================================================== */
/* loop through each of the host templates selected on the previous page and get more info about them */
while (list($var,$val) = each($_POST)) {
if (ereg("^chk_([0-9]+)$", $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
$host_list .= "<li>" . db_fetch_cell("select description from host where id=" . $matches[1]) . "<br>";
$host_array[$i] = $matches[1];
}
$i++;
}
include_once("./include/top_header.php");
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
if ((read_config_option("remove_verification") == "on") && (!isset($_GET["confirm"]))) {
include("./include/top_header.php");
form_confirm("Are You Sure?", "Are you sure you want to delete the host <strong>'" . db_fetch_cell("select description from host where id=" . $_GET["id"]) . "'</strong>?", "host.php", "host.php?action=remove&id=" . $_GET["id"]);
include("./include/bottom_footer.php");
exit;
}
if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) {
api_device_remove($_GET["id"]);
}
}
function host_edit() {
global $colors, $fields_host_edit, $reindex_types;
/* preserve the host template id if passed in via a GET variable */
if (!empty($_GET["host_template_id"])) {
$fields_host_edit["host_template_id"]["value"] = $_GET["host_template_id"];
}
$selected_graph_templates = db_fetch_assoc("select
graph_templates.id,
graph_templates.name
from (graph_templates,host_graph)
where graph_templates.id=host_graph.graph_template_id
and host_graph.host_id=" . $_GET["id"] . "
order by graph_templates.name");
$available_graph_templates = db_fetch_assoc("SELECT
graph_templates.id, graph_templates.name
FROM snmp_query_graph RIGHT JOIN graph_templates
ON (snmp_query_graph.graph_template_id = graph_templates.id)
WHERE (((snmp_query_graph.name) Is Null)) ORDER BY graph_templates.name");
$i = 0;
if (sizeof($selected_graph_templates) > 0) {
foreach ($selected_graph_templates as $item) {
$i++;
/* get status information for this graph template */
$is_being_graphed = (sizeof(db_fetch_assoc("select id from graph_local where graph_template_id=" . $item["id"] . " and host_id=" . $_GET["id"])) > 0) ? true : false;
$selected_data_queries = db_fetch_assoc("select
snmp_query.id,
snmp_query.name,
host_snmp_query.reindex_method
from (snmp_query,host_snmp_query)
where snmp_query.id=host_snmp_query.snmp_query_id
and host_snmp_query.host_id=" . $_GET["id"] . "
order by snmp_query.name");
$available_data_queries = db_fetch_assoc("select
snmp_query.id,
snmp_query.name
from snmp_query
order by snmp_query.name");
$keeper = array();
foreach ($available_data_queries as $item) {
if (sizeof(db_fetch_assoc("SELECT snmp_query_id FROM host_snmp_query " .
" WHERE ((host_id=" . $_GET["id"] . ")" .
" and (snmp_query_id=" . $item["id"] ."))")) > 0) {
/* do nothing */
} else {
array_push($keeper, $item);
}
}
$available_data_queries = $keeper;
$i = 0;
if (sizeof($selected_data_queries) > 0) {
foreach ($selected_data_queries as $item) {
$i++;
/* get status information for this data query */
$num_dq_items = sizeof(db_fetch_assoc("select snmp_index from host_snmp_cache where host_id=" . $_GET["id"] . " and snmp_query_id=" . $item["id"]));
$num_dq_rows = sizeof(db_fetch_assoc("select snmp_index from host_snmp_cache where host_id=" . $_GET["id"] . " and snmp_query_id=" . $item["id"] . " group by snmp_index"));
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_device_current_page");
kill_session_var("sess_device_filter");
kill_session_var("sess_device_host_template_id");
kill_session_var("sess_host_status");
if (!empty($_SESSION["sess_host_status"])) {
if ($_SESSION["sess_host_status"] != $_REQUEST["host_status"]) {
$_REQUEST["page"] = 1;
}
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_device_current_page", "1");
load_current_session_value("filter", "sess_device_filter", "");
load_current_session_value("host_template_id", "sess_device_host_template_id", "-1");
load_current_session_value("host_status", "sess_host_status", "-1");
/* form the 'where' clause for our main sql query */
$sql_where = "where (host.hostname like '%%" . $_REQUEST["filter"] . "%%' OR host.description like '%%" . $_REQUEST["filter"] . "%%')";
if ($_REQUEST["host_status"] == "-1") {
/* Show all items */
}elseif ($_REQUEST["host_status"] == "-2") {
$sql_where .= " and host.disabled='on'";
}else {
$sql_where .= " and (host.status=" . $_REQUEST["host_status"] . " AND host.disabled = '')";
}
if ($_REQUEST["host_template_id"] == "-1") {
/* Show all items */
}elseif ($_REQUEST["host_template_id"] == "0") {
$sql_where .= " and host.host_template_id=0";
}elseif (!empty($_REQUEST["host_template_id"])) {
$sql_where .= " and host.host_template_id=" . $_REQUEST["host_template_id"];
}
- if (!empty($_SESSION["sess_host_status"])) {
- if ($_SESSION["sess_host_status"] != $_REQUEST["host_status"]) {
- $_REQUEST["page"] = 1;
- }
- }
-
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_device_current_page", "1");
load_current_session_value("filter", "sess_device_filter", "");
load_current_session_value("host_template_id", "sess_device_host_template_id", "-1");
load_current_session_value("host_status", "sess_host_status", "-1");