|
@@ -63,7 +63,8 @@ class StatsPonPortCommand extends BaseCommand
|
|
|
$_ponPorts[$pp->getPonPort()] = $pp->getId();
|
|
|
}
|
|
|
|
|
|
- $sendData = array();
|
|
|
+ $portsCounted = $sendData = array();
|
|
|
+ $onusStatus = array(0 => 0, 1 => 0); //total x olt
|
|
|
foreach($ponsCached as $index => $stats) {
|
|
|
|
|
|
$row = array();
|
|
@@ -96,10 +97,15 @@ class StatsPonPortCommand extends BaseCommand
|
|
|
|
|
|
if(isset($status[$ponPort])) {
|
|
|
$p = str_replace("/",".",$ponPort);
|
|
|
- $sendData["d_{$oltDeviceId}_s_{$oltServerId}_pon_state_on_$p"] = "{$status[$ponPort][1]}|g";
|
|
|
- $sendData["d_{$oltDeviceId}_s_{$oltServerId}_pon_state_off_$p"] = "{$status[$ponPort][0]}|g";
|
|
|
$row['online'] = $status[$ponPort][1];
|
|
|
$row['offline'] = $status[$ponPort][0];
|
|
|
+ if(!isset($portsCounted[$p])) {
|
|
|
+ $portsCounted[$p] = true;
|
|
|
+ $sendData["d_{$oltDeviceId}_s_{$oltServerId}_pon_state_on_$p"] = "{$status[$ponPort][1]}|g";
|
|
|
+ $sendData["d_{$oltDeviceId}_s_{$oltServerId}_pon_state_off_$p"] = "{$status[$ponPort][0]}|g";
|
|
|
+ $onusStatus[1] += $status[$ponPort][1];
|
|
|
+ $onusStatus[0] += $status[$ponPort][0];
|
|
|
+ }
|
|
|
} else {
|
|
|
$row['online'] = $row['offline'] = "NULL";
|
|
|
}
|
|
@@ -120,6 +126,9 @@ class StatsPonPortCommand extends BaseCommand
|
|
|
$conn->query($sql);
|
|
|
$conn->close();
|
|
|
|
|
|
+ $sendData["d_{$oltDeviceId}_s_{$oltServerId}_state_on"] = "{$onusStatus[1]}|g";
|
|
|
+ $sendData["d_{$oltDeviceId}_s_{$oltServerId}_state_off"] = "{$onusStatus[0]}|g";
|
|
|
+
|
|
|
if($sendData) {
|
|
|
$statsdService = $this->getContainer()->get('statsd');
|
|
|
$statsdService->send($sendData);
|