diff --git a/ChangeLog b/ChangeLog index 90dd5b3..74c89f6 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2018-01-06 +- Merge pull request #51 Influxdb from Luca. Thx for the patch + 2018-01-01 - IPFIX time stamps - Fix elements #21,#22 offset calculation, but timestamps not yet evaluated. (#160) - IPFIX add fwd status tag #89 compatible to v9 (1byte) diff --git a/README.md b/README.md index c17f663..e6c2002 100755 --- a/README.md +++ b/README.md @@ -403,6 +403,17 @@ netflow data, even if sampling is configured. The number of bytes/packets in eac netflow record is automatically multiplied by the sampling rate. The total number of flows is not changed as this is not accurate enough. (Small flows versus large flows) +###InfluxDB +You can send nfprofile stats data to an influxdb database. The data are the same of rrd files. +For enable this option you need libcurl dev package installed, use --enable-influxdb for configure the project and the nfprofile command should be invoked with option: -i . +Example: -i http://localhost:8086/write?db=mydb&u=user&p=pass +The parameters for auth (&u=user&p=pass) are optional. +Then you get the stats data on influxdb mydb in the measurement nfsen_stats. + +For put the stats of live profile you need to apply a patch to nfsen (in extra/nfsen) and add in nfsen.conf the option: + $influxdb_url="http://mydbhost.local:8086/write?db=nfsen"; +as example I added a preconfigured grafana dashboard in extra/grafana/Nfsen_Stats.json . + --- For more information, see the GitHub Wiki diff --git a/bin/nfprofile.c b/bin/nfprofile.c index 27b32a2..a59bab0 100644 --- a/bin/nfprofile.c +++ b/bin/nfprofile.c @@ -1,8 +1,6 @@ /* - * Copyright (c) 2017, Peter Haag - * Copyright (c) 2014, Peter Haag - * Copyright (c) 2009, Peter Haag - * Copyright (c) 2004-2008, SWITCH - Teleinformatikdienste fuer Lehre und Forschung + * Copyright (c) 2009 - 2018, Peter Haag + * Copyright (c) 2004 - 2008, SWITCH - Teleinformatikdienste fuer Lehre und Forschung * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,6 +79,10 @@ extension_map_list_t *extension_map_list; uint32_t is_anonymized; char Ident[IDENTLEN]; +#ifdef HAVE_INFLUXDB + char influxdb_url[1024]=""; +#endif + /* Function Prototypes */ static void usage(char *name); @@ -88,7 +90,6 @@ static profile_param_info_t *ParseParams (char *profile_datadir); static void process_data(profile_channel_info_t *channels, unsigned int num_channels, time_t tslot); - /* Functions */ #include "nfdump_inline.c" @@ -108,6 +109,9 @@ static void usage(char *name) { "-Z\t\tCheck filter syntax and exit.\n" "-S subdir\tSub directory format. see nfcapd(1) for format\n" "-z\t\tCompress flows in output file.\n" +#ifdef HAVE_INFLUXDB + "-i \tInfluxdb url for stats (example: http://localhost:8086/write?db=mydb&u=pippo&p=paperino)\n" +#endif "-t