[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cacti-user
Subject:    Re: [cacti-user] Undefined index: local_data_id in graphs_new.php
From:       Reinhard Scheck <Reinhard.Scheck () team-scheck ! de>
Date:       2009-12-15 22:39:52
Message-ID: 4B281038.1050203 () team-scheck ! de
[Download RAW message or body]

At this time, you should have received some message from generating the graph. 
What does it tell you?
At that piece of code, we require an array. It is obviouly possible to capture 
the situation where that array is empty to avoid the php error.
But in fact it is wrong that the array returned is empty.

The function is create_complete_graph_from_template and it seems to have some 
problems with your template.

R.

On 15.12.2009 21:56, Teodor wrote:
> Hello,
>
> I've created a CPU load template (attached) that used to work up to
> version 0.8.7b, but on the latest Cacti version 0.8.7e I'm receiving
> this error message every time I'm creating a graph:
> | Notice: Undefined index: local_data_id in
> |   /usr/share/cacti/site/graphs_new.php on line 202
> |
> | Warning: Invalid argument supplied for foreach() in
> |   /usr/share/cacti/site/graphs_new.php on line 202
> |
> | Warning: Cannot modify header information - headers already sent by
> |   (output started at /usr/share/cacti/site/graphs_new.php:202) in
> |   /usr/share/cacti/site/graphs_new.php on line 330
>
> Can you tell me if I can safely disable the "foreach" cycle on line 202?
>
> Thanks
>
>
> --------------------
> doru@frost:~$ diff -U0 gnew_087b.php gnew_087e.php
> --- gnew_087b.php	2008-02-14 00:07:53.000000000 +0200
> +++ gnew_087e.php	2009-06-28 19:07:11.000000000 +0300
> @@ -4 +4 @@
> - | Copyright (C) 2004-2008 The Cacti Group                                 |
> + | Copyright (C) 2004-2009 The Cacti Group                                 |
> @@ -199,0 +200,5 @@
> +
> +				/* lastly push host-specific information to our data sources */
> +				foreach($return_array["local_data_id"] as $item) {
> +					push_out_host($_POST["host_id"], $item);
> +				}
> @@ -206,0 +212,5 @@
> +
> +					/* lastly push host-specific information to our data sources */
> +					foreach($return_array["local_data_id"] as $item) {
> +						push_out_host($_POST["host_id"], $item);
> +					}
> @@ -211,3 +220,0 @@
> -
> -	/* lastly push host-specific information to our data sources */
> -	push_out_host($_POST["host_id"],0);
> @@ -340,8 +346,0 @@
> -function check_changed($request, $session) {
> -	if ((isset($_REQUEST[$request]))&&  (isset($_SESSION[$session]))) {
> -		if ($_REQUEST[$request] != $_SESSION[$session]) {
> -			return 1;
> -		}
> -	}
> -}
> -
> @@ -359,0 +359,5 @@
> +	/* clean up search string */
> +	if (isset($_REQUEST["filter"])) {
> +		$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
> +	}
> +
> @@ -368,0 +373,2 @@
> +
> +		$changed = true;
> @@ -608 +614,5 @@
> -			$page = $_REQUEST["page" . $snmp_query["id"]];
> +			if (!$changed) {
> +				$page = $_REQUEST["page" . $snmp_query["id"]];
> +			}else{
> +				$page = 1;
> +			}
> @@ -754 +764,2 @@
> -					$rows_query = "SELECT host_id, snmp_query_id, snmp_index FROM
> host_snmp_cache
> +					$rows_query = "SELECT host_id, snmp_query_id, snmp_index
> +						FROM host_snmp_cache
> @@ -764 +775 @@
> -					if (($page-1) * $row_limit>  $total_rows) {
> +					if (($page - 1) * $row_limit>  $total_rows) {
>
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
>
>
>
> _______________________________________________
> cacti-user mailing list
> cacti-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cacti-user

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
cacti-user mailing list
cacti-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cacti-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic