status: Calculate rates on port listeners
This commit is contained in:
parent
e876c9aaed
commit
2e1ce5f9d8
|
|
@ -1569,6 +1569,7 @@ int accept_listener_status(cJSON *listeners, cJSON *totals)
|
|||
continue;
|
||||
cJSON *jl = cJSON_CreateObject();
|
||||
cJSON_AddNumberToObject(jl, "fd", l->fd);
|
||||
cJSON_AddNumberToObject(jl, "id", l->id);
|
||||
cJSON_AddStringToObject(jl, "name", l->name);
|
||||
cJSON_AddStringToObject(jl, "proto", (l->udp) ? "udp" : "tcp");
|
||||
cJSON_AddStringToObject(jl, "addr", l->addr_s);
|
||||
|
|
|
|||
|
|
@ -918,7 +918,7 @@ function ratestr(rate)
|
|||
return prefix + rate;
|
||||
}
|
||||
|
||||
function rehash_clients(status)
|
||||
function rehash_clients_old(status)
|
||||
{
|
||||
var clients_id = {};
|
||||
|
||||
|
|
@ -930,6 +930,18 @@ function rehash_clients(status)
|
|||
status['clients_id'] = clients_id;
|
||||
}
|
||||
|
||||
function array_to_dict_by_id(arr)
|
||||
{
|
||||
var dict = {};
|
||||
|
||||
for (var c in arr) {
|
||||
var cl = arr[c];
|
||||
dict[cl['id']] = cl;
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
function calculate_rates(status_old, status_new)
|
||||
{
|
||||
var i = 0;
|
||||
|
|
@ -1088,7 +1100,8 @@ app.controller('aprscc', [ '$scope', '$http', 'graphs', function($scope, $http,
|
|||
if ($scope.status) {
|
||||
d.tick_dif = d.server.tick_now - $scope.status.server.tick_now;
|
||||
calculate_rates($scope.status, d);
|
||||
rehash_clients($scope.status);
|
||||
$scope.status['clients_id'] = array_to_dict_by_id($scope.status.clients);
|
||||
$scope.status['listeners_id'] = array_to_dict_by_id($scope.status.listeners);
|
||||
}
|
||||
|
||||
$scope.status_prev = $scope.status;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,20 @@
|
|||
<table class='table table-hover table-condensed table-striped'>
|
||||
<tr><th ng-repeat="title in setup.cols_listener">{{ title }}</th></tr>
|
||||
<tr ng-repeat="l in status.listeners">
|
||||
<td ng-repeat="(k, title) in setup.cols_listener">{{ l[k] }} {{ status_prev.listeners[$parent.$index][k] }}</td>
|
||||
<td>{{ l.proto }}</td>
|
||||
<td>{{ l.addr }}</td>
|
||||
<td>{{ l.name }}</td>
|
||||
<td>{{ l.clients }}</td>
|
||||
<td>{{ l.clients_peak }}</td>
|
||||
<td>{{ l.clients_max }}</td>
|
||||
<td>{{ l.connects }}</td>
|
||||
<td><span ng-show='status.tick_dif'>{{ (l.connects - status_prev.listeners_id[l.id].connects) / status.tick_dif | ratestr }}</span></td>
|
||||
<td>{{ l.pkts_tx }}</td>
|
||||
<td>{{ l.pkts_rx }}</td>
|
||||
<td>{{ l.bytes_tx }}</td>
|
||||
<td>{{ l.bytes_rx }}</td>
|
||||
<td><span ng-show='status.tick_dif'>{{ (l.bytes_tx - status_prev.listeners_id[l.id].bytes_tx) / status.tick_dif | ratestr }}
|
||||
/ {{ (l.bytes_rx - status_prev.clisteners_id[l.id].bytes_rx) / status.tick_dif | ratestr }}</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue