X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/8f7f273fa4ce32e983f4437a7efa89d75062a2f9..fc23cd7aa9a29eef1c7e37fe12fcef5bbd3dc126:/package/wprobe/src/exporter/wprobe-export.c diff --git a/package/wprobe/src/exporter/wprobe-export.c b/package/wprobe/src/exporter/wprobe-export.c index b09260692..a0e52e2f4 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,14 @@ 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.lens[f] = 8; + g_data.addrs[f++] = &map[i].val->s; + + g_data.lens[f] = 8; + 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; @@ -194,6 +194,7 @@ int main ( int argc, char **argv ) int port = IPFIX_PORTNO; int verbose_level = 0; int opt, i = 10; + char *err = NULL; while ((opt = getopt(argc, argv, "hi:c:p:vstu")) != EOF) { switch (opt) { @@ -252,9 +253,9 @@ int main ( int argc, char **argv ) return -1; } - dev = wprobe_get_auto(ifname); + dev = wprobe_get_auto(ifname, &err); if (!dev || (list_empty(&dev->global_attr) && list_empty(&dev->link_attr))) { - fprintf(stderr, "Cannot connect to wprobe on interface '%s'\n", ifname); + fprintf(stderr, "Cannot connect to wprobe on interface '%s': %s\n", ifname, (err ? err : "Unknown error")); return -1; }