Invalid argument supplied foreach() in graphs_new.php on 841

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
vbugaian
Posts: 8
Joined: Thu Jul 14, 2011 10:38 am

Invalid argument supplied foreach() in graphs_new.php on 841

Post by vbugaian »

Hello all,

please help with this issue.

Warning: Invalid argument supplied for foreach() in /htdocs/cacti/graphs_new.php on line 841

I am running on Gentoo and performed a global upgrade(emerge --sync and others), after that I cant create graphs that use Data Query;

My cacti version is: 0.8.7g

tech support file is attached.

Please let me know where to dig in for a solution.

Thanks a lot in advance.

Vitalie.
Attachments
techsupport.txt
(29.4 KiB) Downloaded 213 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by gandalf »

Does this happen, when you are working on a Data Query without "<direction>input" fields?
If not, please explain as exact as possible which steps you were performing
R.
vbugaian
Posts: 8
Joined: Thu Jul 14, 2011 10:38 am

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by vbugaian »

Hello,

I am trying to create a new graph after adding a new device. For example for a specific host:

Associated Data Queries
Data Query Name
1) SNMP - Interface Statistics

I go to:
Create Graphs for this Host
then I get:

Warning: Invalid argument supplied for foreach() in /var/www/monit.eqnet.us/htdocs/cacti/graphs_new.php on line 841

Warning: Invalid argument supplied for foreach() in /var/www/monit.eqnet.us/htdocs/cacti/graphs_new.php on line 841

Warning: Invalid argument supplied for foreach() in /var/www/monit.eqnet.us/htdocs/cacti/graphs_new.php on line 841

Warning: Invalid argument supplied for foreach() in /var/www/monit.eqnet.us/htdocs/cacti/graphs_new.php on line 841
Data Query [SNMP - Interface Statistics]
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information.

When I run in debug mode (run this data query in debug mode) I get that:

Data Query Debug Information
+ Running data query [1].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/monit.eqnet.us/htdocs/cacti/resource/snmp_queries/interface.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.2.1.2.2.1.1'
+ No SNMP data returned
+ Found data query XML file at '/var/www/monit.eqnet.us/htdocs/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/monit.eqnet.us/htdocs/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/monit.eqnet.us/htdocs/cacti/resource/snmp_queries/interface.xml'

Thank you.
Vitalie.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by gandalf »

Does an snmpwalk report any valid interfaces?
What does s second snmpwalk of the given OID present?
R.
vbugaian
Posts: 8
Joined: Thu Jul 14, 2011 10:38 am

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by vbugaian »

Hello,

when I ran it last time there was a packet loss to that location...

I am attaching normal reply where you can see that it finds interfaces and returns values...

Thanks.

Vitalie.
Attachments
if_.txt
(924.21 KiB) Downloaded 165 times
vbugaian
Posts: 8
Joined: Thu Jul 14, 2011 10:38 am

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by vbugaian »

Snmpwalk result is attached.
Attachments
snmpwalk.txt
(63.84 KiB) Downloaded 196 times
vbugaian
Posts: 8
Joined: Thu Jul 14, 2011 10:38 am

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by vbugaian »

Any finding, advice?

Thanks.

Vitalie.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by gandalf »

Try to change the line prior to the offending line to

Code: Select all

if ($field_array["direction"] == "input" && sizeof($field_names)) {
in other words: add the test sizeof($field_names) that makes the foreach loop complain ...
R.
vbugaian
Posts: 8
Joined: Thu Jul 14, 2011 10:38 am

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by vbugaian »

gandalf, thanks for your reply.

I have tried and now I get no warning but the query does not return any values, so all the time I get empty values and cat graph anything.

Please advice.

Thanks.
vbugaian
Posts: 8
Joined: Thu Jul 14, 2011 10:38 am

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by vbugaian »

Hello,

issue solved:

SELECT DISTINCT field_name FROM host_snmp_cache WHERE host_id=78 AND snmp_query_id=14;
ERROR 145 (HY000): Table './cacti/host_snmp_cache' is marked as crashed and should be repaired

looks like it was not populating field_names...

After a table repair it works fine.

Thanks.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Invalid argument supplied foreach() in graphs_new.php on

Post by gandalf »

Thanks for the reply. I was getting out of ideas ...
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests