From f87f98d0c5b344b0973990cc628caf4afab4f928 Mon Sep 17 00:00:00 2001 From: nbd Date: Sat, 19 Dec 2009 22:19:09 +0000 Subject: wprobe: export raw values (n, s, ss) to ipfix collectors for improved measurement accuracy git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18852 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/libipfix/extra/append-wprobe-ie.pl | 11 +++-- package/libipfix/patches/110-wprobe_ie.patch | 72 ++++++++++++++-------------- package/wprobe/src/exporter/wprobe-export.c | 15 +++--- 3 files changed, 48 insertions(+), 50 deletions(-) diff --git a/package/libipfix/extra/append-wprobe-ie.pl b/package/libipfix/extra/append-wprobe-ie.pl index 3a8db3fe1..fa838ff76 100644 --- a/package/libipfix/extra/append-wprobe-ie.pl +++ b/package/libipfix/extra/append-wprobe-ie.pl @@ -1,9 +1,9 @@ use strict; my @fields = ( - [ "_avg", "FLOAT", " - Average" ], - [ "_stdev", "FLOAT", " - Standard deviation" ], - [ "_n", "UINT", " - Number of samples" ] + [ "_n", "UINT", " - Number of samples", 4 ], + [ "_s", "UINT", " - Sum of samples", 8 ], + [ "_ss", "UINT", " - Sum of squared samples", 8 ], ); my $file = $ARGV[0] or die "Syntax: $0 \n"; @@ -23,7 +23,7 @@ while () { my $descr = $4; my @f; if ($counter) { - @f = [ "", "UINT", "" ]; + @f = [ "", "UINT", "", 4]; } else { @f = @fields; } @@ -33,7 +33,8 @@ while () { my $N = uc $n; my $ftype = $f->[1]; my $fdesc = $f->[2]; - print "$nr, IPFIX_FT_WPROBE_$rfield$N, 4, IPFIX_CODING_$ftype, \"$nfield$n\", \"$descr$fdesc\"\n"; + my $size = $f->[3]; + print "$nr, IPFIX_FT_WPROBE_$rfield$N, $size, IPFIX_CODING_$ftype, \"$nfield$n\", \"$descr$fdesc\"\n"; } }; } diff --git a/package/libipfix/patches/110-wprobe_ie.patch b/package/libipfix/patches/110-wprobe_ie.patch index bbfa33120..5b9ba887c 100644 --- a/package/libipfix/patches/110-wprobe_ie.patch +++ b/package/libipfix/patches/110-wprobe_ie.patch @@ -4,41 +4,41 @@ 313, IPFIX_FT_OWDVARMIN_NSEC, 4, IPFIX_CODING_INT, "owdvarmin_nsec", "FOKUS minimum owd variance in ns" 314, IPFIX_FT_OWDVARMAX_NSEC, 4, IPFIX_CODING_INT, "owdvarmax_nsec", "FOKUS maximum ow variance in ns" -+315, IPFIX_FT_WPROBE_NOISE_AVG, 4, IPFIX_CODING_FLOAT, "global_noise_avg", "wprobe global noice floor - Average" -+316, IPFIX_FT_WPROBE_NOISE_STDEV, 4, IPFIX_CODING_FLOAT, "global_noise_stdev", "wprobe global noice floor - Standard deviation" -+317, IPFIX_FT_WPROBE_NOISE_N, 4, IPFIX_CODING_UINT, "global_noise_n", "wprobe global noice floor - Number of samples" -+318, IPFIX_FT_WPROBE_PHY_BUSY_AVG, 4, IPFIX_CODING_FLOAT, "global_phy_busy_avg", "wprobe global airtime total - Average" -+319, IPFIX_FT_WPROBE_PHY_BUSY_STDEV, 4, IPFIX_CODING_FLOAT, "global_phy_busy_stdev", "wprobe global airtime total - Standard deviation" -+320, IPFIX_FT_WPROBE_PHY_BUSY_N, 4, IPFIX_CODING_UINT, "global_phy_busy_n", "wprobe global airtime total - Number of samples" -+321, IPFIX_FT_WPROBE_PHY_RX_AVG, 4, IPFIX_CODING_FLOAT, "global_phy_rx_avg", "wprobe global airtime total from rx-frame - Average" -+322, IPFIX_FT_WPROBE_PHY_RX_STDEV, 4, IPFIX_CODING_FLOAT, "global_phy_rx_stdev", "wprobe global airtime total from rx-frame - Standard deviation" -+323, IPFIX_FT_WPROBE_PHY_RX_N, 4, IPFIX_CODING_UINT, "global_phy_rx_n", "wprobe global airtime total from rx-frame - Number of samples" -+324, IPFIX_FT_WPROBE_PHY_TX_AVG, 4, IPFIX_CODING_FLOAT, "global_phy_tx_avg", "wprobe global airtime total from tx-frame - Average" -+325, IPFIX_FT_WPROBE_PHY_TX_STDEV, 4, IPFIX_CODING_FLOAT, "global_phy_tx_stdev", "wprobe global airtime total from tx-frame - Standard deviation" -+326, IPFIX_FT_WPROBE_PHY_TX_N, 4, IPFIX_CODING_UINT, "global_phy_tx_n", "wprobe global airtime total from tx-frame - Number of samples" -+327, IPFIX_FT_WPROBE_RSSI_AVG, 4, IPFIX_CODING_FLOAT, "link_rssi_avg", "wprobe link received signal strength indication - Average" -+328, IPFIX_FT_WPROBE_RSSI_STDEV, 4, IPFIX_CODING_FLOAT, "link_rssi_stdev", "wprobe link received signal strength indication - Standard deviation" -+329, IPFIX_FT_WPROBE_RSSI_N, 4, IPFIX_CODING_UINT, "link_rssi_n", "wprobe link received signal strength indication - Number of samples" -+330, IPFIX_FT_WPROBE_SIGNAL_AVG, 4, IPFIX_CODING_FLOAT, "link_signal_avg", "wprobe link signal strength in dB - Average" -+331, IPFIX_FT_WPROBE_SIGNAL_STDEV, 4, IPFIX_CODING_FLOAT, "link_signal_stdev", "wprobe link signal strength in dB - Standard deviation" -+332, IPFIX_FT_WPROBE_SIGNAL_N, 4, IPFIX_CODING_UINT, "link_signal_n", "wprobe link signal strength in dB - Number of samples" -+333, IPFIX_FT_WPROBE_IEEE_RX_RATE_AVG, 4, IPFIX_CODING_FLOAT, "link_ieee_rx_rate_avg", "wprobe link IEEE 802.11 RX data rate - Average" -+334, IPFIX_FT_WPROBE_IEEE_RX_RATE_STDEV, 4, IPFIX_CODING_FLOAT, "link_ieee_rx_rate_stdev", "wprobe link IEEE 802.11 RX data rate - Standard deviation" -+335, IPFIX_FT_WPROBE_IEEE_RX_RATE_N, 4, IPFIX_CODING_UINT, "link_ieee_rx_rate_n", "wprobe link IEEE 802.11 RX data rate - Number of samples" -+336, IPFIX_FT_WPROBE_IEEE_TX_RATE_AVG, 4, IPFIX_CODING_FLOAT, "link_ieee_tx_rate_avg", "wprobe link IEEE 802.11 TX data rate - Average" -+337, IPFIX_FT_WPROBE_IEEE_TX_RATE_STDEV, 4, IPFIX_CODING_FLOAT, "link_ieee_tx_rate_stdev", "wprobe link IEEE 802.11 TX data rate - Standard deviation" -+338, IPFIX_FT_WPROBE_IEEE_TX_RATE_N, 4, IPFIX_CODING_UINT, "link_ieee_tx_rate_n", "wprobe link IEEE 802.11 TX data rate - Number of samples" -+339, IPFIX_FT_WPROBE_RETRANSMIT_200_AVG, 4, IPFIX_CODING_FLOAT, "link_retransmit_200_avg", "wprobe link total retransmissions per packet - <200 bytes - Average" -+340, IPFIX_FT_WPROBE_RETRANSMIT_200_STDEV, 4, IPFIX_CODING_FLOAT, "link_retransmit_200_stdev", "wprobe link total retransmissions per packet - <200 bytes - Standard deviation" -+341, IPFIX_FT_WPROBE_RETRANSMIT_200_N, 4, IPFIX_CODING_UINT, "link_retransmit_200_n", "wprobe link total retransmissions per packet - <200 bytes - Number of samples" -+342, IPFIX_FT_WPROBE_RETRANSMIT_400_AVG, 4, IPFIX_CODING_FLOAT, "link_retransmit_400_avg", "wprobe link total retransmissions per packet - <400 bytes - Average" -+343, IPFIX_FT_WPROBE_RETRANSMIT_400_STDEV, 4, IPFIX_CODING_FLOAT, "link_retransmit_400_stdev", "wprobe link total retransmissions per packet - <400 bytes - Standard deviation" -+344, IPFIX_FT_WPROBE_RETRANSMIT_400_N, 4, IPFIX_CODING_UINT, "link_retransmit_400_n", "wprobe link total retransmissions per packet - <400 bytes - Number of samples" -+345, IPFIX_FT_WPROBE_RETRANSMIT_800_AVG, 4, IPFIX_CODING_FLOAT, "link_retransmit_800_avg", "wprobe link total retransmissions per packet - <800 bytes - Average" -+346, IPFIX_FT_WPROBE_RETRANSMIT_800_STDEV, 4, IPFIX_CODING_FLOAT, "link_retransmit_800_stdev", "wprobe link total retransmissions per packet - <800 bytes - Standard deviation" -+347, IPFIX_FT_WPROBE_RETRANSMIT_800_N, 4, IPFIX_CODING_UINT, "link_retransmit_800_n", "wprobe link total retransmissions per packet - <800 bytes - Number of samples" -+348, IPFIX_FT_WPROBE_RETRANSMIT_1600_AVG, 4, IPFIX_CODING_FLOAT, "link_retransmit_1600_avg", "wprobe link total retransmissions per packet - >800 bytes - Average" -+349, IPFIX_FT_WPROBE_RETRANSMIT_1600_STDEV, 4, IPFIX_CODING_FLOAT, "link_retransmit_1600_stdev", "wprobe link total retransmissions per packet - >800 bytes - Standard deviation" -+350, IPFIX_FT_WPROBE_RETRANSMIT_1600_N, 4, IPFIX_CODING_UINT, "link_retransmit_1600_n", "wprobe link total retransmissions per packet - >800 bytes - Number of samples" ++315, IPFIX_FT_WPROBE_NOISE_N, 4, IPFIX_CODING_UINT, "global_noise_n", "wprobe global noice floor - Number of samples" ++316, IPFIX_FT_WPROBE_NOISE_S, 8, IPFIX_CODING_UINT, "global_noise_s", "wprobe global noice floor - Sum of samples" ++317, IPFIX_FT_WPROBE_NOISE_SS, 8, IPFIX_CODING_UINT, "global_noise_ss", "wprobe global noice floor - Sum of squared samples" ++318, IPFIX_FT_WPROBE_PHY_BUSY_N, 4, IPFIX_CODING_UINT, "global_phy_busy_n", "wprobe global airtime total - Number of samples" ++319, IPFIX_FT_WPROBE_PHY_BUSY_S, 8, IPFIX_CODING_UINT, "global_phy_busy_s", "wprobe global airtime total - Sum of samples" ++320, IPFIX_FT_WPROBE_PHY_BUSY_SS, 8, IPFIX_CODING_UINT, "global_phy_busy_ss", "wprobe global airtime total - Sum of squared samples" ++321, IPFIX_FT_WPROBE_PHY_RX_N, 4, IPFIX_CODING_UINT, "global_phy_rx_n", "wprobe global airtime total from rx-frame - Number of samples" ++322, IPFIX_FT_WPROBE_PHY_RX_S, 8, IPFIX_CODING_UINT, "global_phy_rx_s", "wprobe global airtime total from rx-frame - Sum of samples" ++323, IPFIX_FT_WPROBE_PHY_RX_SS, 8, IPFIX_CODING_UINT, "global_phy_rx_ss", "wprobe global airtime total from rx-frame - Sum of squared samples" ++324, IPFIX_FT_WPROBE_PHY_TX_N, 4, IPFIX_CODING_UINT, "global_phy_tx_n", "wprobe global airtime total from tx-frame - Number of samples" ++325, IPFIX_FT_WPROBE_PHY_TX_S, 8, IPFIX_CODING_UINT, "global_phy_tx_s", "wprobe global airtime total from tx-frame - Sum of samples" ++326, IPFIX_FT_WPROBE_PHY_TX_SS, 8, IPFIX_CODING_UINT, "global_phy_tx_ss", "wprobe global airtime total from tx-frame - Sum of squared samples" ++327, IPFIX_FT_WPROBE_RSSI_N, 4, IPFIX_CODING_UINT, "link_rssi_n", "wprobe link received signal strength indication - Number of samples" ++328, IPFIX_FT_WPROBE_RSSI_S, 8, IPFIX_CODING_UINT, "link_rssi_s", "wprobe link received signal strength indication - Sum of samples" ++329, IPFIX_FT_WPROBE_RSSI_SS, 8, IPFIX_CODING_UINT, "link_rssi_ss", "wprobe link received signal strength indication - Sum of squared samples" ++330, IPFIX_FT_WPROBE_SIGNAL_N, 4, IPFIX_CODING_UINT, "link_signal_n", "wprobe link signal strength in dB - Number of samples" ++331, IPFIX_FT_WPROBE_SIGNAL_S, 8, IPFIX_CODING_UINT, "link_signal_s", "wprobe link signal strength in dB - Sum of samples" ++332, IPFIX_FT_WPROBE_SIGNAL_SS, 8, IPFIX_CODING_UINT, "link_signal_ss", "wprobe link signal strength in dB - Sum of squared samples" ++333, IPFIX_FT_WPROBE_IEEE_RX_RATE_N, 4, IPFIX_CODING_UINT, "link_ieee_rx_rate_n", "wprobe link IEEE 802.11 RX data rate - Number of samples" ++334, IPFIX_FT_WPROBE_IEEE_RX_RATE_S, 8, IPFIX_CODING_UINT, "link_ieee_rx_rate_s", "wprobe link IEEE 802.11 RX data rate - Sum of samples" ++335, IPFIX_FT_WPROBE_IEEE_RX_RATE_SS, 8, IPFIX_CODING_UINT, "link_ieee_rx_rate_ss", "wprobe link IEEE 802.11 RX data rate - Sum of squared samples" ++336, IPFIX_FT_WPROBE_IEEE_TX_RATE_N, 4, IPFIX_CODING_UINT, "link_ieee_tx_rate_n", "wprobe link IEEE 802.11 TX data rate - Number of samples" ++337, IPFIX_FT_WPROBE_IEEE_TX_RATE_S, 8, IPFIX_CODING_UINT, "link_ieee_tx_rate_s", "wprobe link IEEE 802.11 TX data rate - Sum of samples" ++338, IPFIX_FT_WPROBE_IEEE_TX_RATE_SS, 8, IPFIX_CODING_UINT, "link_ieee_tx_rate_ss", "wprobe link IEEE 802.11 TX data rate - Sum of squared samples" ++339, IPFIX_FT_WPROBE_RETRANSMIT_200_N, 4, IPFIX_CODING_UINT, "link_retransmit_200_n", "wprobe link total retransmissions per packet - <200 bytes - Number of samples" ++340, IPFIX_FT_WPROBE_RETRANSMIT_200_S, 8, IPFIX_CODING_UINT, "link_retransmit_200_s", "wprobe link total retransmissions per packet - <200 bytes - Sum of samples" ++341, IPFIX_FT_WPROBE_RETRANSMIT_200_SS, 8, IPFIX_CODING_UINT, "link_retransmit_200_ss", "wprobe link total retransmissions per packet - <200 bytes - Sum of squared samples" ++342, IPFIX_FT_WPROBE_RETRANSMIT_400_N, 4, IPFIX_CODING_UINT, "link_retransmit_400_n", "wprobe link total retransmissions per packet - <400 bytes - Number of samples" ++343, IPFIX_FT_WPROBE_RETRANSMIT_400_S, 8, IPFIX_CODING_UINT, "link_retransmit_400_s", "wprobe link total retransmissions per packet - <400 bytes - Sum of samples" ++344, IPFIX_FT_WPROBE_RETRANSMIT_400_SS, 8, IPFIX_CODING_UINT, "link_retransmit_400_ss", "wprobe link total retransmissions per packet - <400 bytes - Sum of squared samples" ++345, IPFIX_FT_WPROBE_RETRANSMIT_800_N, 4, IPFIX_CODING_UINT, "link_retransmit_800_n", "wprobe link total retransmissions per packet - <800 bytes - Number of samples" ++346, IPFIX_FT_WPROBE_RETRANSMIT_800_S, 8, IPFIX_CODING_UINT, "link_retransmit_800_s", "wprobe link total retransmissions per packet - <800 bytes - Sum of samples" ++347, IPFIX_FT_WPROBE_RETRANSMIT_800_SS, 8, IPFIX_CODING_UINT, "link_retransmit_800_ss", "wprobe link total retransmissions per packet - <800 bytes - Sum of squared samples" ++348, IPFIX_FT_WPROBE_RETRANSMIT_1600_N, 4, IPFIX_CODING_UINT, "link_retransmit_1600_n", "wprobe link total retransmissions per packet - >800 bytes - Number of samples" ++349, IPFIX_FT_WPROBE_RETRANSMIT_1600_S, 8, IPFIX_CODING_UINT, "link_retransmit_1600_s", "wprobe link total retransmissions per packet - >800 bytes - Sum of samples" ++350, IPFIX_FT_WPROBE_RETRANSMIT_1600_SS, 8, IPFIX_CODING_UINT, "link_retransmit_1600_ss", "wprobe link total retransmissions per packet - >800 bytes - Sum of squared samples" +351, IPFIX_FT_WPROBE_FRAMES, 4, IPFIX_CODING_UINT, "global_frames", "wprobe global number of 802.11 frames seen" +352, IPFIX_FT_WPROBE_PROBEREQ, 4, IPFIX_CODING_UINT, "global_probereq", "wprobe global number of 802.11 probe requests seen" diff --git a/package/wprobe/src/exporter/wprobe-export.c b/package/wprobe/src/exporter/wprobe-export.c index 48be5f36b..9255d76c4 100644 --- a/package/wprobe/src/exporter/wprobe-export.c +++ b/package/wprobe/src/exporter/wprobe-export.c @@ -25,7 +25,6 @@ static int do_close = 0; struct wprobe_mapping { int id; bool counter; - float scale; const char *wprobe_id; struct wprobe_value *val; }; @@ -36,16 +35,14 @@ struct wprobe_mapping { #define WMAP(_id, _name, ...) \ { \ - .scale = 1.0f, \ .counter = false, \ - .id = IPFIX_FT_WPROBE_##_id##_AVG, \ + .id = IPFIX_FT_WPROBE_##_id##_N, \ .wprobe_id = _name \ , ## __VA_ARGS__ \ } #define WMAP_COUNTER(_id, _name, ...) \ { \ - .scale = 1.0f, \ .counter = true, \ .id = IPFIX_FT_WPROBE_##_id, \ .wprobe_id = _name \ @@ -144,7 +141,7 @@ add_template_fields(ipfix_t *handle, ipfix_template_t *t, struct wprobe_mapping if (map[i].counter) g_data.addrs[f++] = &map[i].val->U32; else - g_data.addrs[f++] = &map[i].val->avg; + g_data.addrs[f++] = &map[i].val->n; if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 0, 4) < 0) exit(1); @@ -152,11 +149,11 @@ add_template_fields(ipfix_t *handle, ipfix_template_t *t, struct wprobe_mapping if (map[i].counter) continue; - g_data.addrs[f++] = &map[i].val->stdev; - g_data.addrs[f++] = &map[i].val->n; - if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 1, 4) < 0) + g_data.addrs[f++] = &map[i].val->s; + g_data.addrs[f++] = &map[i].val->ss; + if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 1, 8) < 0) exit(1); - if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 2, 4) < 0) + if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 2, 8) < 0) exit(1); } g_data.maxfields = f; -- cgit v1.2.3