This data query returned 0 rows / PHP-Warning

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
sigi
Posts: 12
Joined: Mon May 19, 2008 1:42 am
Location: Switzerland, Meiringen

This data query returned 0 rows / PHP-Warning

Post by sigi »

Hi
all is working fine 0.8.7b freebsd7 amd64. This system is working and updated since Years.
But for now, i cannot add new graphs:

This data query returned 0 rows

"run this data query in debug mode" seems to work fine.

Code: Select all

Invalid argument supplied for foreach() in /usr/local/share/cacti/graphs_new.php on line 797, referer: https://my.server.com/cacti/host.php?action=edit&id=5
This is what i found in httpd-error.log




Code: Select all

                                       while (list($field_name, $field_array) = each($xml_array["fields"])) {
                                                if ($field_array["direction"] == "input") {
                                                        foreach($field_names as $row) {
                                                                if ($row["field_name"] == $field_name) {
                                                                        $html_dq_header .= "<td height='1'><strong><font color='#" . $colors["header_text"] $
                                                                        break;
[/code]
797 is the foreach($field_names as $row) part..

Any Ideas?
Kind regards, Beat
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

This may occur, if the table snmp_cache is empty for that host/data query. Please visit this table from "System Utilities" and filter for your host. Do you find cache entries for that very data query?
Reinhard
sigi
Posts: 12
Joined: Mon May 19, 2008 1:42 am
Location: Switzerland, Meiringen

Post by sigi »

Yes, it is all there. Done a rebuild, no change.

btw: The debug output looks good for me

Code: Select all

+ Running data query [1].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/usr/local/share/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'
+ Located input field 'ifIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.1'
+ Found item [ifIndex='1'] index: 1 [from value]
+ Found item [ifIndex='2'] index: 2 [from value]
+ Found item [ifIndex='3'] index: 3 [from value]
+ Located input field 'ifOperStatus' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.8'
+ Found item [ifOperStatus='Up'] index: 1 [from value]
+ Found item [ifOperStatus='Up'] index: 2 [from value]
+ Found item [ifOperStatus='Up'] index: 3 [from value]
+ Located input field 'ifDescr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.2'
+ Found item [ifDescr='fxp0'] index: 1 [from value]
+ Found item [ifDescr='lo0'] index: 2 [from value]
+ Found item [ifDescr='tun1'] index: 3 [from value]
+ Located input field 'ifName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.31.1.1.1.1'
+ Located input field 'ifAlias' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.31.1.1.1.18'
+ Located input field 'ifType' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.3'
+ Found item [ifType='ethernetCsmacd(6)'] index: 1 [from value]
+ Found item [ifType='softwareLoopback(24)'] index: 2 [from value]
+ Found item [ifType='ppp(23)'] index: 3 [from value]
+ Located input field 'ifSpeed' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.5'
+ Found item [ifSpeed='100000000'] index: 1 [from value]
+ Found item [ifSpeed='0'] index: 2 [from value]
+ Found item [ifSpeed='0'] index: 3 [from value]
+ Located input field 'ifHwAddr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.6'
+ Found item [ifHwAddr='00:00:02:A5:35:E8:88'] index: 1 [from value]
+ Found item [ifHwAddr=''] index: 2 [from value]
+ Found item [ifHwAddr=''] index: 3 [from value]
+ Located input field 'ifIP' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.4.20.1.2'
+ Found item [ifIP='127.0.0.1'] index: 2 [from regexp oid parse]
+ Found item [ifIP='192.168.2.85'] index: 1 [from regexp oid parse]
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/interface.xml'
sigi
Posts: 12
Joined: Mon May 19, 2008 1:42 am
Location: Switzerland, Meiringen

Post by sigi »

Upps did I read snmp_cache?
This Table is absolute empty...

Googling around....
sigi
Posts: 12
Joined: Mon May 19, 2008 1:42 am
Location: Switzerland, Meiringen

solved

Post by sigi »

run
php repair_database.php => no errors found

run
mysqlcheck --auto-repair --databases cacti

result:
error : Table upgrade required. Please do "REPAIR TABLE `host_snmp_cache`" to fix it!

myisamchk -r host_snmp_cache.MYI

Back in the race :-)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests