Commit 9c45a875 authored by Gary Wong's avatar Gary Wong

Use new interpretation of "bps" in the monitoring schema.

It used to mean bytes per second.  Now it means bits per second.  To
avoid worrying about client-side versions and updating, we'll keep the
client unmodified and convert statistics on their way through the server.
Who doesn't like ugly hacks?
parent fae16db7
......@@ -47,7 +47,13 @@ void notification( event_handle_t h, event_notification_t n, void *unused ) {
( *p >= 'A' && *p <= 'Z' ) ||
*p == '_' ) )
return;
/* The schema interpretation of "bps" changed from bytes per second
to bits per second in June 2015. To avoid client-side version
headaches, we'll do the conversion here. */
if( strstr( tab, "_bps" ) )
sprintf( v, "%.1f", atof( v ) * 8.0 );
mysql_real_escape_string( &db, eid, id, strlen( id ) );
mysql_real_escape_string( &db, ev, v, strlen( v ) );
......
......@@ -156,8 +156,8 @@ sub AddInterfaces($$$) {
$speed = 1000000;
}
$speed *= 100;
$packets = $speed / 80;
$speed *= 1000;
$packets = $speed / 800;
emdbi::DBQueryWarnN( $db, "INSERT INTO ops_interface SET " .
"\$schema='http://www.gpolab.bbn.com/monitoring/schema/20140828/interface#', " .
......@@ -541,6 +541,9 @@ while (1) {
my $tx_b = ( $counts[ 2 ] - $$oldcounts[ 2 ] ) / $INTERVAL;
my $tx_p = ( $counts[ 3 ] - $$oldcounts[ 3 ] ) / $INTERVAL;
$rx_b *= 8;
$tx_b *= 8;
if( ( $rx_b >= 0 ) && ( $rx_p >= 0 ) &&
( $rx_b >= 0 ) && ( $rx_p >= 0 ) ) {
emdbi::DBQueryWarnN( $db, "INSERT INTO " .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment