[racktables-users] Re: help with sql needed

  • From: Denis Ovsienko <infrastation@xxxxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Thu, 20 Jan 2011 19:00:15 +0300


20.01.2011, 17:40, "Frank Altpeter" <frank-racktables@xxxxxxxxxxx>:
> Moin,
>
> on 2011-01-20 at 15:23:10 CET, Denis Ovsienko wrote:
>
>>  [...]
>>>  Now I want to fetch every server object which has a specific service
>>>  contract set, and the corresponding customer tag as well.
>>  With version 0.18.6 you can do that without SQL (though RackCode 
>> expression). These attributes are mapped to {$attr_X_Y} autotags, which can 
>> be used together with customer tags in your case.
>
> The problem with that, I need this data from an external cron job... and I
> don't know how to use RackCode when coming from outside the web frontend.

Adjust this sample to your needs and use its stdout in the cronjob.

#!/usr/bin/php

<?php

chdir ('/rack/tables/dir');
$script_mode = TRUE;
include ('inc/init.php);

$myobjects = scanRealmByText ('object', '{this1} and {this2} and (not {$that3} 
or {that4}) and {$this5}');
dump ($myobjects);
// Don't use dump() in real code. Instead run foreach() and output the list in 
your format.

?>

-- 
    Denis Ovsienko

Other related posts: