CLI Scripts unusable

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

Moderators: Moderators, Developers

Author
Message
User avatar
Alice
Cacti User
Posts: 107
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

CLI Scripts unusable

#1 Post by Alice » Wed Nov 21, 2007 7:04 am

Well... let's try this:
[email protected]:/home/cacti/cli# php add_graphs.php --list-input-fields --graph-template-id=47

The scripts gets to this query:
SELECT DISTINCT
data_input_fields.data_name AS `name`,
data_input_fields.name AS `description`,
data_input_data.value AS `default`,
data_template_data.data_template_id,
data_input_fields.id AS `data_input_field_id`
FROM data_input_data
INNER JOIN (((data_template_rrd
INNER JOIN (graph_templates
INNER JOIN graph_templates_item
ON graph_templates.id = graph_templates_item.graph_template_id)
ON data_template_rrd.id = graph_templates_item.task_item_id)
INNER JOIN data_template_data
ON data_template_rrd.data_template_id=data_template_data.data_template_id)
INNER JOIN data_input_fields
ON data_template_data.data_input_id=data_input_fields.data_input_id)
ON (data_input_data.data_template_data_id = data_template_data.id)
AND (data_input_data.data_input_field_id = data_input_fields.id)
WHERE (((graph_templates.id)=47)
AND ((data_input_data.t_value)='on')
AND ((data_input_fields.input_output)='in'))

which brings down MySQL.

mysql> select count(*) from data_input_fields;
+----------+
| count(*) |
+----------+
| 95 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from data_template_data;
+----------+
| count(*) |
+----------+
| 4773 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from graph_templates;
+----------+
| count(*) |
+----------+
| 47 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from data_template_rrd;
+----------+
| count(*) |
+----------+
| 9720 |
+----------+
1 row in set (0.00 sec)

mysql> select count(*) from graph_templates_item;
+----------+
| count(*) |
+----------+
| 40078 |
+----------+
1 row in set (0.00 sec)

MySQL it's on a sepparate server, with a P4 3.0 HT / 1GB RAM, with a CPU usage average of 9%
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs

User avatar
TheWitness
Developer
Posts: 14855
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#2 Post by TheWitness » Wed Nov 21, 2007 7:16 am

What version? It runs just fine on my system. You might also want to remove the brackets around the where clause below:

Code: Select all

WHERE (((graph_templates.id)=47) 
AND ((data_input_data.t_value)='on') 
AND ((data_input_fields.input_output)='in')) 
You might also want to repair the tables in question. Wierd.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

User avatar
Alice
Cacti User
Posts: 107
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

#3 Post by Alice » Wed Nov 21, 2007 7:18 am

Solved.
ALTER TABLE `data_input_data` ADD INDEX ( `t_value` )
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs

User avatar
TheWitness
Developer
Posts: 14855
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#4 Post by TheWitness » Wed Nov 21, 2007 7:19 am

Ahh, oh shit, you have a big installation...

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

User avatar
TheWitness
Developer
Posts: 14855
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#5 Post by TheWitness » Wed Nov 21, 2007 7:19 am

Can you open a bug report so that we don't loose that tidbit?

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

User avatar
Alice
Cacti User
Posts: 107
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

#6 Post by Alice » Wed Nov 21, 2007 7:20 am

What version what?
Cacti is 0.8.7a
MySQL is 5.0.37
Tables are OK, checked.
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs

User avatar
TheWitness
Developer
Posts: 14855
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#7 Post by TheWitness » Wed Nov 21, 2007 7:22 am

Alice, submit a bug report to http://bugs.cacti.net

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

User avatar
Alice
Cacti User
Posts: 107
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

#8 Post by Alice » Wed Nov 21, 2007 7:27 am

Done, http://bugs.cacti.net/view.php?id=1093 .I've posted the versions while you were posting.
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs

User avatar
TheWitness
Developer
Posts: 14855
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#9 Post by TheWitness » Wed Nov 21, 2007 7:29 am

Can you post your "/etc/my.cnf"...

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

User avatar
TheWitness
Developer
Posts: 14855
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#10 Post by TheWitness » Wed Nov 21, 2007 7:29 am

Also,

du -k /var/lib/mysq/cacti

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

User avatar
Alice
Cacti User
Posts: 107
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

#11 Post by Alice » Wed Nov 21, 2007 7:32 am

[email protected]:/var/lib/mysql# du -k cacti3/
23332 cacti3/

submited to mantis too.
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs

Tybio
Cacti User
Posts: 79
Joined: Thu Feb 16, 2006 8:14 am

#12 Post by Tybio » Wed Nov 21, 2007 9:43 am

I'm seeing something similar when I try to use the script. I'll try that fix and let you know if it works for me.

Tybio
Cacti User
Posts: 79
Joined: Thu Feb 16, 2006 8:14 am

#13 Post by Tybio » Wed Nov 21, 2007 9:57 am

FYI, this fixed the add_graphs.php problem I was having with my script.

User avatar
TheWitness
Developer
Posts: 14855
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

#14 Post by TheWitness » Wed Nov 21, 2007 10:10 am

Anyone post a "/etc/my.cnf" file?

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository


I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.

User avatar
Alice
Cacti User
Posts: 107
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

#15 Post by Alice » Wed Nov 21, 2007 10:19 am

[email protected]:~# free
total used free shared buffers cached
Mem: 1033036 624384 408652 0 197008 240520
-/+ buffers/cache: 186856 846180
Swap: 1004020 0 1004020


[email protected]:~# cat /etc/my.cnf |grep -v "#"

[client]
port = 3306
socket = /tmp/mysql.sock

[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 256M
max_allowed_packet = 32M
table_cache = 64k
sort_buffer_size = 64M
read_buffer_size = 64M
read_rnd_buffer_size = 64M
myisam_sort_buffer_size = 64M
thread_cache_size = 256
query_cache_size=64M
set-variable=key_buffer=64M
set-variable=max_connections=250
thread_concurrency = 2
net_buffer_length = 128K
max_heap_table_size = 128M
tmp_table_size = 256M
server-id = 1

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer = 256M
sort_buffer_size = 256M

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M

[mysqlhotcopy]
interactive-timeout
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs

Post Reply