Add initial support for Proxmox VM network traffic. [WIP]

This commit is contained in:
Mark Schouten
2015-08-31 16:32:28 +02:00
parent 3798a0f569
commit bf913f5a3b
7 changed files with 248 additions and 3 deletions
@@ -3,7 +3,11 @@
if (is_numeric($vars['id']) && ($auth || application_permitted($vars['id']))) {
$app = get_application_by_id($vars['id']);
$device = device_by_id_cache($app['device_id']);
$title = generate_device_link($device);
$title .= $graph_subtype;
if ($app['app_type'] != 'proxmox') {
$title = generate_device_link($device);
$title .= $graph_subtype;
} else {
$title = $vars['port'].'@'.$vars['hostname'].' on '.generate_device_link($device);
}
$auth = true;
}
@@ -0,0 +1,15 @@
<?php
require 'includes/graphs/common.inc.php';
$mysql_rrd = $config['rrd_dir'].'/proxmox/'.$vars['cluster'].'/'.$vars['vmid'].'_netif_'.$vars['port'].'.rrd';
if (is_file($mysql_rrd)) {
$rrd_filename = $mysql_rrd;
}
$multiplier = 8;
$ds_in = 'INOCTETS';
$ds_out = 'OUTOCTETS';
require 'includes/graphs/generic_data.inc.php';
+20
View File
@@ -383,6 +383,26 @@ if ($_SESSION['userlevel'] >= '5' && ($app_count) > "0") {
<?php
}
if (isset($config['enable_proxmox']) && $config['enable_proxmox']) {
$pmxcl = dbFetchRows("SELECT DISTINCT(`app_instance`) FROM `applications` WHERE `app_type` = ?", array('proxmox'));
if(count($pmxcl) > 0) {
?>
<li class="dropdown">
<a href="proxmox/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><i class="fa fa-tasks fa-fw fa-lg fa-nav-icons"></i> Proxmox</a>
<ul class="dropdown-menu">
<?php
foreach ($pmxcl as $pmxc) {
echo('<li><a href="/proxmox/cluster='.$pmxc['app_instance'].'/"><i class="fa fa-angle-double-right fa-fw fa-lg"></i> '.nicecase($pmxc['app_instance']).' </a></li>');
}
?>
</ul>
</li>
<?php
}
}
$routing_count['bgp'] = dbFetchCell("SELECT COUNT(bgpPeer_id) from `bgpPeers` LEFT JOIN devices AS D ON bgpPeers.device_id=D.device_id WHERE D.device_id IS NOT NULL");
$routing_count['ospf'] = dbFetchCell("SELECT COUNT(ospf_instance_id) FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled'");
$routing_count['cef'] = dbFetchCell("SELECT COUNT(cef_switching_id) from `cef_switching`");