[racktables-users] Re: query fails after update

> I'm not sure what you mean with that. Working with the predefined PHP
> function getObjectPortsAndLinks() from inc/database.php doesn't work for
> me, since the monitoring script is running on a different machine and
> connects remotely to the mysql database running racktables db.
> 
> Do you have any other idea how to do this as long-term solution?

The basic idea is that multiple RackTables instances can access the same
database. You can have one copy on web-server and another copy on a
monitoring server. The former would work as a standard web-interface,
and the latter would only provide its "library" to a local PHP script
run in CLI. There is a work on API and a documentation for it:
https://racktables.org/trac/wiki/RackTablesDevelGuide#API

It's not yet finished, but you can try it:

<?php

function findObjectUplink ($object_id)
{
        $myobject = spotEntity ('object', $object_id);
        amplifyCell ($myobject);
        // Now the ports are available as $myobject['ports']
        foreach ($myobject['ports'] as $port(
        {
                if ($port['type_id'] == 24)
                // ...
        }
}

?>

P.S. I have just checked, the remote port type isn't available in this
structure, at least in 0.17.1. Fixing this in repository, should be
there for 0.17.2.

Other related posts: