Bug in api_automation_tools.php in displayTreeNodes?

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

Moderators: Developers, Moderators

Post Reply
greginmadison
Posts: 30
Joined: Fri Mar 07, 2008 8:58 am

Bug in api_automation_tools.php in displayTreeNodes?

Post by greginmadison »

I am attempting to get a node listing when running the cli command and get an empty list:

nwlmad0p0101:/san/www/htdocs/cacti/cli # ./add_tree.php --list-nodes --tree-id=23

Before displayTreeNodesKnown Tree Nodes:
type id text

BUT, there is a tree 23 from the output of:

nwlmad0p0101:/san/www/htdocs/cacti/cli # ./add_tree.php --list-trees

Known Trees:
id sort method name
1 Manual Ordering (No Sorting) Default Tree
16 Alphabetic Ordering Firewall
17 Alphabetic Ordering Data Center Network
18 Manual Ordering (No Sorting) Servers
23 Manual Ordering (No Sorting) Agency
The /add_tree.php --list-nodes --tree-id=16 and /add_tree.php --list-nodes --tree-id=18 commands do return the expected results.


I have verified the MYSQL select statement by running from the MYSQL cli on the tree_id=23 and get about 9000 returned rows.

I've put some echo statements in pi_automation_tools.php and see that I get no output after the SELECT statement (the echo Database query returned sizeof($node) never prints:

function displayTreeNodes($tree_id, $quietMode = FALSE) {
echo "\nInside function displayTreeNodes tree_id=$tree_id=";
global $tree_sort_types, $tree_item_types, $host_group_types;

if (!$quietMode) {
echo "Known Tree Nodes:\n";
echo "type\tid\ttext\n";
}
echo "\nBefore select statement";
$nodes = db_fetch_assoc("SELECT
id,
local_graph_id,
rra_id,
title,
host_id,
host_grouping_type,
sort_children_type
FROM graph_tree_items
WHERE graph_tree_id=$tree_id
ORDER BY id");
echo "\nDatabase query returned sizeof($nodes)\n";


I download the latest pi_automation_tools.php from the SVN with the same results.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

When running this exact SQL statement from mysql command line (replacing the variable by the value 23), what does it provide?
reinhard
greginmadison
Posts: 30
Joined: Fri Mar 07, 2008 8:58 am

sql result run by hand in attached file

Post by greginmadison »

Here is the results of the command (in the attached file);

SELECT id, local_graph_id, rra_id, title, host_id, host_grouping_type, sort_children_type FROM graph_tree_items WHERE graph_tree_id=23 ORDER BY id into outfile "/tmp/sqlout";

I have the same trouble running this on 0.8.7a or 0.8.7.b.

Again, this working when I issue the command: ./add_tree.php --list-nodes --tree-id=18 and get the following (but when doing tree-id=23 nothing with the cli):


Graph 25295 APWMAD0P0627 Physical Memory Daily (5 Minute Average)
Graph 25296 APWMAD0P0627 Virtual Memory Daily (5 Minute Average)
Graph 25297 APWMAD0P0630 Physical Memory Daily (5 Minute Average)
Graph 25298 APWMAD0P0630 Virtual Memory Daily (5 Minute Average)
Graph 25304 Local Linux Machine - Memory Usage Daily (5 Minute Average)
Graph 25840 Websense Network Agent DOA C: Label: Serial Number f47387ea Daily (5 Minute Average)
Graph 25841 Websense Network Agent DOA E: Label:e_drive Serial Number b873b136 Daily (5 Minute Average)
Graph 25842 Websense Network Agent DOA Physical Memory Daily (5 Minute Average)
Graph 25843 Websense Network Agent DOA Virtual Memory Daily (5 Minute Average)
Graph 25844 Websense Policy Server - DOA C: Label: Serial Number f47387ea Daily (5 Minute Average)
Graph 25845 Websense Policy Server - DOA E: Label: Serial Number e4480a3f Daily (5 Minute Average)
Graph 25846 Websense Policy Server - DOA Physical Memory Daily (5 Minute Average)
Graph 25847 Websense Policy Server - DOA Virtual Memory Daily (5 Minute Average)
Graph 25848 Websense Reporter - DOA C: Label:Main Serial Number 58515ffe Daily (5 Minute Average)
Graph 25849 Websense Reporter - DOA E: Label: Serial Number 78a39a8b Daily (5 Minute Average)
Graph 25850 Websense Reporter - DOA F: Label: Serial Number 7cdad6cd Daily (5 Minute Average)
Graph 25851 Websense Reporter - DOA Physical Memory Daily (5 Minute Average)
Graph 25852 Websense Reporter - DOA Virtual Memory Daily (5 Minute Average)
Graph 25857 Websense backend dB Physical Memory Daily (5 Minute Average)
Graph 25858 Websense backend dB Virtual Memory Daily (5 Minute Average)
Graph 25859 APWMAD0P0627 C: Label: Serial Number f47387ea Daily (5 Minute Average)
Graph 25860 APWMAD0P0627 E: Label:e_drive Serial Number ba2a5be7 Daily (5 Minute Average)
Graph 25861 Websense backend dB C: Label: Serial Number 4009d606 Daily (5 Minute Average)
Graph 25862 Websense backend dB D: Label:SQL Backup Serial Number 5ca99920 Daily (5 Minute Average)
Graph 25863 Websense backend dB E: Label: Serial Number bc35c79f Daily (5 Minute Average)
Graph 25864 Websense backend dB F: Label: Serial Number 9cfb925b Daily (5 Minute Average)
Graph 25865 Cisco Security Manager - Used Space - Physical Memory Daily (5 Minute Average)
Graph 25866 Cisco Security Manager - Used Space - Virtual Memory Daily (5 Minute Average)
Graph 25867 Cisco Security Manager - Used Space - E: Label: Serial Number 1aa67270 Daily (5 Minute Average)
Header 31804 DHCP Manual Ordering (No Sorting)
Header 31805 UTWMAD1P0647 Alphabetic Ordering
Graph 31806 DHCP UTWMAD1P0647.doa - Processes Daily (5 Minute Average)
Graph 31807 DHCP UTWMAD1P0647.doa-Traffic |query_IfName| |query_ifAlias| Daily (5 Minute Average)
Graph 31808 DHCP UTWMAD1P0647.doa - Used Space - C: Label: Serial Number f4aa9fd0 Daily (5 Minute Average)
Graph 31809 DHCP UTWMAD1P0647.doa - Used Space - E: Label:e_drive Serial Number b690dd45 Daily (5 Minute Average)
Graph 31810 DHCP UTWMAD1P0647.doa - Used Space - Physical Memory Daily (5 Minute Average)
Graph 31811 DHCP UTWMAD1P0647.doa - Used Space - Virtual Memory Daily (5 Minute Average)
Header 31812 UTWMAD1P0345 Manual Ordering (No Sorting)
Graph 31813 DHCP UTWMAD1P0345.sasi - Processes Daily (5 Minute Average)
Graph 31814 DHCP UTWMAD1P0345.sasi-Traffic |query_IfName| |query_ifAlias| Daily (5 Minute Average)
Graph 31815 DHCP UTWMAD1P0345.sasi - Used Space - C: Label: Serial Number b87d98f9 Daily (5 Minute Average)
Graph 31816 DHCP UTWMAD1P0345.sasi - Used Space - Physical Memory Daily (5 Minute Average)
Graph 31817 DHCP UTWMAD1P0345.sasi - Used Space - Virtual Memory Daily (5 Minute Average)
Header 31818 NWWMAD1P0471 Manual Ordering (No Sorting)
Graph 31819 DHCP NWWMAD1P0471.corrections - Processes Daily (5 Minute Average)
Graph 31820 DHCP NWWMAD1P0471.corrections-Traffic |query_IfName| |query_ifAlias| Daily (5 Minute Average)
Graph 31821 DHCP NWWMAD1P0471.corrections - Used Space - C: Label: Serial Number 58515ffe Daily (5 Minute Average)
Graph 31822 DHCP NWWMAD1P0471.corrections - Used Space - Physical Memory Daily (5 Minute Average)
Graph 31823 DHCP NWWMAD1P0471.corrections - Used Space - Virtual Memory Daily (5 Minute Average)
Header 31824 NWWMAD1P0429 Manual Ordering (No Sorting)
Graph 31825 DHCP NWWMAD1P0429.dnr-Traffic |query_IfName| |query_ifAlias| Daily (5 Minute Average)
Graph 31826 DHCP NWWMAD1P0429.dnr - Used Space - C: Label: Serial Number 58515ffe Daily (5 Minute Average)
Graph 31827 DHCP NWWMAD1P0429.dnr - Used Space - Physical Memory Daily (5 Minute Average)
Graph 31828 DHCP NWWMAD1P0429.dnr - Used Space - Virtual Memory Daily (5 Minute Average)
Attachments
sqlout.txt
results of mysql command
(200.43 KiB) Downloaded 156 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please try attached add_tree.php and post findings
Reinhard
Attachments
add_tree.php.txt
Please remove .txt extension before using
(9.34 KiB) Downloaded 187 times
greginmadison
Posts: 30
Joined: Fri Mar 07, 2008 8:58 am

Same results with new add_tree.php file

Post by greginmadison »

nwlmad0p0101:/san/www/htdocs/cacti/cli # ./add_tree.php --list-trees

Known Trees:
id sort method name
1 Manual Ordering (No Sorting) Default Tree
16 Alphabetic Ordering Firewall
17 Alphabetic Ordering Data Center Network
18 Manual Ordering (No Sorting) Servers
23 Manual Ordering (No Sorting) Agency

nwlmad0p0101:/san/www/htdocs/cacti/cli # ./add_tree.php --list-nodes --tree-id=23


Inside function displayTreeNodes tree_id=23=Known Tree Nodes:
type id text

Before select statementnwlmad0p0101:/san/www/htdocs/cacti/cli #
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Are you able to post a tar.gz of an mysqldump of your cacti db via pm?
Reinhard
greginmadison
Posts: 30
Joined: Fri Mar 07, 2008 8:58 am

Dump tar and gzip is 6.8 meg, too big from PM

Post by greginmadison »

Dump tar and gzip is 6.8 meg, too big from PM.

I put the file up on a ftp server, see you PM for details.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

What's the setting of "memory_limit" in /etc/php.ini?
I suppose it's low. Please increase to at least 64 M
Reinhard
greginmadison
Posts: 30
Joined: Fri Mar 07, 2008 8:58 am

fixed!. Php cli current memory limits

Post by greginmadison »

My cli php memory was set to 8M and the apache was set at 600M, as soon as I changed the cli to 128 Meg I got a good listing from ./add_tree.php --list-nodes --tree-id=23.

Thanks for the help.

BTW, cacti really is a fantastic tool. I am replacing a system that cost my organization $80,000 a year in maintenance fees with two open source servers running cacti.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests