Thold, using autocreate threshold.. SQL Error

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
User avatar
mpdsville1
Cacti User
Posts: 71
Joined: Wed Mar 16, 2005 12:11 pm
Location: Albany , NY , USA

Thold, using autocreate threshold.. SQL Error

Post by mpdsville1 »

I suspect i'm looking for a row (or more) on a table with
an incorrectly empty field, but i could use a nudge in the
direction of which table I should be looking closely at ..
I have a few select hostids that this happens for ..

http://www.xxx.yyy.zzz/cacti/thold.php? ... &hostid=47
Created threshold for data_id 738 and rrd_id 1680
Created threshold for data_id 711 and rrd_id 1610
Created threshold for data_id 711 and rrd_id 1609
Created threshold for data_id 712 and rrd_id 1612
Created threshold for data_id 712 and rrd_id 1611
Created threshold for data_id 713 and rrd_id 1614
Created threshold for data_id 713 and rrd_id 1613
Created threshold for data_id 714 and rrd_id 1616
Created threshold for data_id 714 and rrd_id 1615
Created threshold for data_id 715 and rrd_id 1618
Created threshold for data_id 715 and rrd_id 1617
Created threshold for data_id 716 and rrd_id 1620
Created threshold for data_id 716 and rrd_id 1619
Created threshold for data_id 717 and rrd_id 1622
Created threshold for data_id 717 and rrd_id 1621
Created threshold for data_id 718 and rrd_id 1624
Created threshold for data_id 718 and rrd_id 1623
Created threshold for data_id 719 and rrd_id 1626
Created threshold for data_id 719 and rrd_id 1625
Created threshold for data_id 720 and rrd_id 1628
Created threshold for data_id 720 and rrd_id 1627
Created threshold for data_id 721 and rrd_id 1632
Created threshold for data_id 721 and rrd_id 1631
Created threshold for data_id 721 and rrd_id 1630
Created threshold for data_id 721 and rrd_id 1629
Created threshold for data_id 722 and rrd_id 1636
Created threshold for data_id 722 and rrd_id 1635
Created threshold for data_id 722 and rrd_id 1634
Created threshold for data_id 722 and rrd_id 1633
Created threshold for data_id 723 and rrd_id 1640
Created threshold for data_id 723 and rrd_id 1639
Created threshold for data_id 723 and rrd_id 1638
Created threshold for data_id 723 and rrd_id 1637
Update failed:

INSERT INTO thold (element, rra) VALUES (, 724)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 724)' at line 1

Thanks !
Mike Donnelly , Albany , NY
| Cacti 0.8.7g | Spine 0.8.7g | MySQL 5.0.77 | Net-SNMP 5.3.2.2 | Apache 2.2.3 | PHP 5.3.3 | RRDtool 1.2.27 | Rhel6 | Dual Xeon E5410@2.33ghz | Sunfire x4150
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

You can try this (sorry no real patch since my thresholds functions are highly customized and the patch would work on yours)

Open
lib/thold-functions.php

Find this

Code: Select all

$rrdsql = mysql_fetch_array(mysql_query("SELECT id FROM data_template_rrd WHERE local_data_id=$local_data_id LIMIT 1"));
and replace it with

Code: Select all

$rrdsql = mysql_fetch_array(mysql_query("SELECT id FROM data_template_rrd WHERE local_data_id=$local_data_id order by id LIMIT 1"));
and let me know how that works for you. This was a pain to debug and find awhile back, but it has worked perfectly for me since.
zardoz
Posts: 7
Joined: Fri Jun 03, 2005 9:52 am

Post by zardoz »

I have seen this problem when my data sources did not match up with my graphs... The way round it was to delete and recreate the appropriate bits.
User avatar
mpdsville1
Cacti User
Posts: 71
Joined: Wed Mar 16, 2005 12:11 pm
Location: Albany , NY , USA

Post by mpdsville1 »

@ Cigamit
No Joy .. Script tanks sooner though .. :D

@ zardoz
recall specific table / field I'm looking for to examine with mysql for null
element #? Are you saying delete the device and associated datasources
for same and recreate it all? If i pick on a specific device,{hostid=47 in
this case} All my graphs are intact and updating.. Examining the
data_template_rrd table reveals no nulls in the id or local_data_id
columns..

Thanks Loads ..
Mike Donnelly , Albany , NY
| Cacti 0.8.7g | Spine 0.8.7g | MySQL 5.0.77 | Net-SNMP 5.3.2.2 | Apache 2.2.3 | PHP 5.3.3 | RRDtool 1.2.27 | Rhel6 | Dual Xeon E5410@2.33ghz | Sunfire x4150
memic
Posts: 5
Joined: Tue Jul 12, 2005 6:40 am
Contact:

thlod auto creation

Post by memic »

I have the same error with some hosts and the problem seems to be that
this query returns an empty result and the next result fails cause of that.

$rrdsql = mysql_fetch_array(mysql_query("SELECT id FROM data_template_rrd WHERE local_data_id=$local_data_id order by id LIMIT 1"));
memic
Posts: 5
Joined: Tue Jul 12, 2005 6:40 am
Contact:

funny thing

Post by memic »

is after deleting the host and recreating it the error was gone.
pipemajor
Posts: 4
Joined: Thu Mar 02, 2006 2:26 am

not with me

Post by pipemajor »

Hej
i have the same problem im using cacti 0.8.6h and thold 0.2.7
i got the same message and when i deleted the host and created it again i have the same error message!
torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

Post by torstentfk »

Hi,

I had the same problem here.
I searched a little time at my data sources and noticed 3 ds of the same interface with only ONE linked to a graph.
I deleted all ds and the graph, recreated the graph an now the auto-thold works fine.


Torsten
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest