Exemplo n.º 1
0
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License v2.0
 * along with IXP Manager.  If not, see:
 *
 * http://www.gnu.org/licenses/gpl-2.0.html
 */
$SRCDIR_LOG = "/srv/mrtg";
$DESTDIR_LOG = "/srv/mrtg";
mb_internal_encoding('UTF-8');
mb_language('uni');
setlocale(LC_ALL, "en_IE.utf8");
require_once dirname(__FILE__) . '/../../../bin/utils.inc';
define('APPLICATION_ENV', scriptutils_get_application_env());
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../application'));
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->getBootstrap()->bootstrap('OSSAutoLoader');
$config = $application->getOption('resources');
$plugin = new OSS_Resource_Doctrine2($config['doctrine2']);
$application->getBootstrap()->registerPluginResource($plugin);
$em = $plugin->getDoctrine2('default');
foreach ($em->getRepository('\\Entities\\Customer')->findAll() as $cust) {
    $logs = [];
    foreach ($cust->getVirtualInterfaces() as $viInt) {
        foreach ($viInt->getPhysicalInterfaces() as $pInt) {
            $mrtg = sprintf("%s/members/%s/%s-%d-bits.log", $SRCDIR_LOG, $cust->getShortname(), $cust->getShortname(), $pInt->getMonitorindex());
Exemplo n.º 2
0
# more details.
#
# You should have received a copy of the GNU General Public License v2.0
# along with IXP Manager.  If not, see:
#
# http://www.gnu.org/licenses/gpl-2.0.html
#
# Description:
#
# This script uses rrdgraph to read in p2p traffic graphs and output a .png
# Turn off all error reporting
#error_reporting(0);
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . "/../../library");
require '../../library/Zend/Config/Ini.php';
require '../../bin/utils.inc';
$config = new Zend_Config_Ini('../../application/configs/application.ini', scriptutils_get_application_env());
$dbopts = $config->resources->doctrine2->connection->options;
# Zend likes to use "pdo_driver" instead of "driver".  This confuses.
$driver = $dbopts->driver;
$driver = preg_replace('/^pdo_/', '', $driver);
$db = new PDO($driver . ":host=" . $dbopts->host . ";dbname=" . $dbopts->dbname, $dbopts->user, $dbopts->password);
$sth = $db->query('
SELECT DISTINCT
	cu.name,
	vi.vlan,
	vi.vlaninterfaceid
FROM
	(view_vlaninterface_details_by_custid vi, cust cu)
WHERE
	vi.custid = cu.id
');