Skip to content

Commit 735ffdb

Browse files
author
Steve
committed
Added per second calculations
1 parent 30dd952 commit 735ffdb

File tree

1 file changed

+4
-2
lines changed
  • homemon-server/public/javascripts

1 file changed

+4
-2
lines changed

homemon-server/public/javascripts/snmp.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ socket.on('data', function(data) {
7171
updateCell.innerHTML = decodedData.ifName;
7272

7373
updateCell = document.getElementById(decodedData.device+"-"+decodedData.interface+"-ifInOctets");
74+
var timeDelta = decodedData.timeStamp - snmpHistory[decodedData.device+"-"+decodedData.interface].timestamp;
7475
var inBytes = decodedData.ifInOctets - snmpHistory[decodedData.device+"-"+decodedData.interface].ifInOctets;
75-
updateCell.innerHTML = readablizeBytes(inBytes) + "/sec";
76+
updateCell.innerHTML = readablizeBytes(inBytes / timeDelta) + "/sec";
7677

7778
updateCell = document.getElementById(decodedData.device+"-"+decodedData.interface+"-ifOutOctets");
79+
timeDelta = decodedData.timeStamp - snmpHistory[decodedData.device+"-"+decodedData.interface].timestamp;
7880
var outBytes = decodedData.ifOutOctets - snmpHistory[decodedData.device+"-"+decodedData.interface].ifOutOctets;
79-
updateCell.innerHTML = readablizeBytes(outBytes) + "/sec";
81+
updateCell.innerHTML = readablizeBytes(outBytes / timeDelta) + "/sec";
8082
}
8183

8284
// print the time the refresh happened

0 commit comments

Comments
 (0)