Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


SQL Error

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Threshold)
Author Message
msw1970
Cacti User


Joined: 09 Jan 2007
Posts: 149

PostPosted: Tue Jan 08, 2008 6:39 am    Post subject: SQL Error Reply with quote

Hi

I've just installed the thold plugin and I'm getting the following message appear in the cacti log 2 or 3 times everytime the poller runs...

01/08/2008 11:30:32 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id) WHERE data_template_rrd.data_source_name != '' AND "

Any ideas why this is happening?
Back to top
tbaror



Joined: 05 Jun 2006
Posts: 49

PostPosted: Wed Jan 09, 2008 3:27 am    Post subject: having same sql errors Reply with quote

Hi,

looking on cacti log i discover that having the same sql error

Code:

 01/09/2008 10:25:18 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id) WHERE data_template_rrd.data_source_name != '' AND "
01/09/2008 10:25:17 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id) WHERE data_template_rrd.data_source_name != '' AND "
01/09/2008 10:25:16 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id) WHERE data_template_rrd.data_source_name != '' AND "


Quote:
Cacti Version - 0.8.7a
Plugin Architecture - 1.4
Poller Type - CMD.php
Server Info - Windows NT 5.2
Web Server - Microsoft-IIS/6.0
PHP - 5.2.4
PHP Extensions - bcmath, calendar, com_dotnet, ctype, session, filter, ftp, hash, iconv, json, odbc, pcre, Reflection, date, libxml, standard, tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, xmlreader, xmlwriter, ISAPI, soap, gd, mysql, mysqli, snmp, sockets, xmlrpc
MySQL - 5.0.45-community-nt
RRDTool - 1.2.15
SNMP - snmpwalk [OPTIONS] AGENT [OID]

Version: 5.4.1
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net

OPTIONS:
-h, --help display this help message
-H display configuration file directives understood
-v 1|2c|3 specifies SNMP version to use
-V, --version display package version number
SNMP Version 1 or 2c specific
-c COMMUNITY set the community string
SNMP Version 3 specific
-a PROTOCOL set authentication protocol (MD5|SHA)
-A PASSPHRASE set authentication protocol pass phrase
-e ENGINE-ID set security engine ID (e.g. 800000020109840301)
-E ENGINE-ID set context engine ID (e.g. 800000020109840301)
-l LEVEL set security level (noAuthNoPriv|authNoPriv|authPriv)
-n CONTEXT set context name (e.g. bridge1)
-u USER-NAME set security name (e.g. bert)
-x PROTOCOL set privacy protocol (DES)
-X PASSPHRASE set privacy protocol pass phrase
-Z BOOTS,TIME set destination engine boots/time
General communication options
-r RETRIES set the number of retries
-t TIMEOUT set the request timeout (in seconds)
Debugging
-d dump input/output packets in hexadecimal
-D TOKEN[,...] turn on debugging output for the specified TOKENs
(ALL gives extremely verbose debugging output)
General options
-m MIB[:...] load given list of MIBs (ALL loads everything)
-M DIR[:...] look in given list of directories for MIBs
-P MIBOPTS Toggle various defaults controlling MIB parsing:
u: allow the use of underlines in MIB symbols
c: disallow the use of "--" to terminate comments
d: save the DESCRIPTIONs of the MIB objects
e: disable errors when MIB symbols conflict
w: enable warnings when MIB symbols conflict
W: enable detailed warnings when MIB symbols conflict
R: replace MIB symbols from latest module
-O OUTOPTS Toggle various defaults controlling output display:
0: print leading 0 for single-digit hex characters
a: print all strings in ascii format
b: do not break OID indexes down
e: print enums numerically
E: escape quotes in string indices
f: print full OIDs on output
n: print OIDs numerically
q: quick print for easier parsing
Q: quick print with equal-signs
s: print only last symbolic element of OID
S: print MIB module-id plus last element
t: print timeticks unparsed as numeric integers
T: print human-readable text along with hex strings
u: print OIDs using UCD-style prefix suppression
U: don't print units
v: print values only (not OID = value)
x: print all strings in hex format
X: extended index format
-I INOPTS Toggle various defaults controlling input parsing:
b: do best/regex matching to find a MIB node
h: don't apply DISPLAY-HINTs
r: do not check values for range/type legality
R: do random access to OID labels
u: top-level OIDs must have '.' prefix (UCD-style)
s SUFFIX: Append all textual OIDs with SUFFIX before parsing
S PREFIX: Prepend all textual OIDs with PREFIX before parsing
-L LOGOPTS Toggle various defaults controlling logging:
e: log to standard error
o: log to standard output
n: don't log at all
f file: log to the specified file
s facility: log to syslog (via the specified facility)

(variants)
[EON] pri: log to standard error, output or /dev/null for level 'pri' and above
[EON] p1-p2: log to standard error, output or /dev/null for levels 'p1' to 'p2'
[FS] pri token: log to file/syslog for level 'pri' and above
[FS] p1-p2 token: log to file/syslog for levels 'p1' to 'p2'
-C APPOPTS Set various application specific behaviours:
p: print the number of variables found
i: include given OID in the search range
I: don't include the given OID, even if no results are returned
c: do not check returned OIDs are increasing
t: Display wall-clock time to complete the request
Plugins
    Global Plugin Settings (settings - v0.3)
    Update Checker (update - v0.4)
    Thresholds (thold - v0.3.9)
    Network Discovery (discovery - v0.8.3)
    PHP Network Weathermap (weathermap - v0.941)
    ReportIt (ReportIt - v0.5.1)
    Real-time statistics (zond - v0.34)
    Device Tracking (mactrack - v1.1)
    Host Info (hostinfo - v0.2)
    Syslog Monitoring (syslog - v0.5.2)
    local Syslog update (Syslogupd - v0.42)
Back to top
msw1970
Cacti User


Joined: 09 Jan 2007
Posts: 149

PostPosted: Fri Jan 18, 2008 8:09 am    Post subject: Reply with quote

Any ideas to this one anyone??
Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 634
Location: Psychic Amish Network Administrator

PostPosted: Sun Jan 20, 2008 10:08 pm    Post subject: Reply with quote

I'm not sure what this will affect. Maybe Jimmy can sound in and say if this makes a difference or not. But in setup.php in your thold directory replace line 202 with this:

Code:

        $thold_items = db_fetch_assoc("select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data LEFT JOIN data_template_rrd on data_template_rrd.id = thold_data.data_id WHERE data_template_rrd.data_source_name != ''");


Thold appears to still function, but no longer gives the error in the log.
Back to top
topstuff



Joined: 31 Jan 2008
Posts: 6

PostPosted: Mon Feb 04, 2008 6:27 pm    Post subject: Same Error Reply with quote

Hi,
I am receiving the same error after installing the thold plugin.
However thresholds seem to be working ok.
Any thoughts?

Thanks
Sam

Install Info:
Date Tue, 05 Feb 2008 10:29:12 +1100
Cacti Version 0.8.7a
Cacti OS win32
SNMP Version net-snmp
RRDTool Version RRDTool 1.2.x

Cacti Log:

02/05/2008 10:13:14 AM - SYSTEM STATS: Time:12.5468 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:3
02/05/2008 10:13:11 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id) WHERE data_template_rrd.data_source_name != '' AND "
02/05/2008 10:13:10 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id) WHERE data_template_rrd.data_source_name != '' AND "
02/05/2008 10:13:09 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', SQL:"select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id) WHERE data_template_rrd.data_source_name != '' AND "
Back to top
ejensen
Cacti User


Joined: 12 Jul 2004
Posts: 55

PostPosted: Mon Feb 11, 2008 8:54 am    Post subject: Reply with quote

any resolution to this?
Back to top
goodwillwm



Joined: 11 Feb 2008
Posts: 1

PostPosted: Mon Feb 11, 2008 3:46 pm    Post subject: CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1064', Reply with quote

I also am seeing this in my logs after installing MACTRACK
Back to top
jordan



Joined: 26 Aug 2007
Posts: 5

PostPosted: Wed Feb 20, 2008 4:17 pm    Post subject: Reply with quote

Hi everyone,

I had the same problem, and did something that builds on what streaker69 suggested, but is a little cleaner. I changed that line to an if statement:

Code:

        if ( $rra_ids ) {
                $thold_items = db_fetch_assoc("select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data
                                                 LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id)
                                                 WHERE data_template_rrd.data_source_name != '' AND $rra_ids");
        } else {
                $thold_items = db_fetch_assoc("select thold_data.cdef, thold_data.rra_id, thold_data.data_id, thold_data.lastread, thold_data.oldvalue, data_template_rrd.data_source_name as name, data_template_rrd.data_source_type_id from thold_data
                                                 LEFT JOIN data_template_rrd on (data_template_rrd.id = thold_data.data_id)
                                                 WHERE data_template_rrd.data_source_name != ''");
        }


When I also added some warnings to the if block, it looks as though $rra_ids is defined about half the time, and is undefined about half of the time.

I would appreciate if anyone has a cleaner fix to this problem, as this solution is more of a hack.
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 924
Location: B/CS Texas

PostPosted: Sun May 04, 2008 1:28 pm    Post subject: Reply with quote

Already fixed in SVN.
Back to top
kasimong



Joined: 02 Oct 2007
Posts: 34
Location: Bremerhaven,Bremen,Germany

PostPosted: Fri May 30, 2008 2:20 am    Post subject: Reply with quote

cigamit wrote:
Already fixed in SVN.

what must i do to apply the patch

kasimong
Back to top
johnrembo
Cacti User


Joined: 24 Apr 2006
Posts: 192

PostPosted: Fri Jul 04, 2008 5:16 am    Post subject: Reply with quote

several days ago it was working fine, but now svn.cacti.net responds with "404 - not found"

steaker69 and jordan - I think your pathces are wrong. Well yes, theoreticaly they do work, bu practicaly wich each poller thread thold will fetch all of it's cache and process it. So if you have 30 spine threads configured - most likely you'll got thold doing all of it's database 30 times during 5 minutes!

I think error lies within realation of thold to other plugins. If other plugin prior to thold uses poller_output plugin hook - thold will receive no rra's.

fix is simple:

add aditional plugin hook for thold at lib/poller.php line 234:
Code:
api_plugin_hook_function('poller_output_thold', $rrd_update_array);


and make thold use this hook:
change plugins/thold/setup.php line 40:
Code:
$plugin_hooks['poller_output_thold']['thold'] = 'thold_poller_output';


please note - this fix should be used only untill SVN will come available again.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Threshold) All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group