[racktables-users] query fails after update
- From: Frank Altpeter <frank-racktables@xxxxxxxxxxx>
- To: racktables-users <racktables-users@xxxxxxxxxxxxx>
- Date: Wed, 10 Jun 2009 15:54:24 +0200
Hi list,
I just managed to finally update from 0.16.4 to 0.17.1, but I'm stuck with
a little problem getting data from RackTables via script.
I've built a nagios script which checks the presence of a monitored object
and gets the uplink port(s). This used to work with 0.16.4 like this:
# How to query the uplink data from an oid - contains 1 %s for the oid
my $uplinkquery = "SELECT Port.name AS Port_name, RemotePort.name AS
RemotePort_name, RackObject.name AS RackObject_name FROM ( ( ( Port INNER
JOIN Dictionary ON Port.type = dict_key NATURAL JOIN Chapter ) LEFT JOIN
Link ON Port.id=Link.porta OR Port.id=Link.portb ) LEFT JOIN Port AS
RemotePort ON Link.portb=RemotePort.id OR Link.porta=RemotePort.id ) left
JOIN RackObject ON RemotePort.object_id=RackObject.id where Chapter.name =
'PortType' AND Port.object_id=%s AND (Port.id != RemotePort.id OR
RemotePort.id is null) AND RemotePort.name IS NOT NULL AND ( Port.type =
24 OR RemotePort.type = 24 ) ORDER BY Port_name;";
(where %s is, for example, my object_id 23)
I already changed "chapter_name" into "Chapter.Name" according to the
0.17.0 database upgrade block, but the query still fails for any object
with 0 results:
Did i miss something that has been changed in the database structure which
makes my query fail?
Le deagh dhùraghd,
Frank Altpeter
--
FA-RIPE || http://www.altpeter.de/
http://www.xing.com/go/invite/27666.2a971e
| "The story goes that I first had the idea for THHGTTG while
| lying drunk in a field in Innsbruck (or `Spain' as the BBC
| TV publicity department authoritatively has it, probably
| because it's easier to spell)." - Foreward by DNA.
|
| FORD Six pints of bitter. And quickly please, the world's about to
| end.
| BARMAN Oh yes, sir? Nice weather for it.
Other related posts: