71 Commits

Author SHA1 Message Date
pv2b
0284c689c3 Fix per-link stats in extractstats
There was a bug where traffic would be attributed to the wrong links.
The root cause was that "values %knownlinks" was used to get a list
of keys corresponding to database columns, that was then used to
insert values into the database, in the same order.

The problem is that there's no guarantee that "values %knownlinks"
will always generate the tags in the same order. Indeed on my system,
it generates different order every time.

To make sure the order the column names is generated in is stable,
from now on, it will sort the column names. Also, it will check the
database schema to see if the column names are in the expected order,
and if required re-create the database if the column order has
changed.
2023-04-24 16:18:48 +02:00
Alarig Le Lay
5c32090035
bin/asstatd.pl: parse_sflow: switching to RFC2863 ifIndex 2021-10-27 22:28:45 +02:00
schadom
3b4c4075db
Fix syntax error 2021-02-06 01:22:53 +01:00
Alexandre Bruyelles
696037ef08
netflowv9: always try to map IP to ASN
Some netflow agents truncates 32b ASN to a 16b fields
Always checking the received ASN against our mapping should fix
that issue

Signed-off-by: Alexandre Bruyelles <git@jack.fr.eu.org>
2021-01-08 11:45:13 +01:00
Matthieu Cerda
569e8334c1 rrd-extractstats.pl: fix bareword (disallowed by use strict, fixes #91) 2020-08-10 13:56:38 +02:00
Manuel Kasper
ab8a48e33e
Merge pull request #87 from rlanyi/extractstats-skipifnotmodified
Skip analyzing traffic data if RRD file hasn't changed since last run
2020-03-23 08:49:58 +01:00
Robert Lanyi
e4a06d5b9d Skip getting traffic data if RRD file hasn't changed since last run 2020-03-22 20:30:39 +01:00
Robert Lanyi
a0ffd9d867 Fix warning when THREADS env var is missing 2020-03-22 14:59:37 +01:00
Robert Lanyi
858c646e01 Change default number of threads to 1 (original behavior) 2020-03-22 14:44:17 +01:00
Robert Lanyi
37a7633ded Add THREADS env var to control number of threads 2020-03-21 18:44:10 +01:00
Robert Lanyi
245dcd591a Add multi-threading to rrd-extractstats.pl 2020-03-21 15:26:53 +01:00
Manuel Kasper
52e0848aa3
Merge pull request #77 from JackSlateur/cleanup
Do not import inet_pton, we never use it
2018-08-06 09:17:51 +02:00
Alexandre Bruyelles
ca26c5a179
do not import inet_pton, we never use it
Signed-off-by: Alexandre Bruyelles <git@jack.fr.eu.org>
2018-08-04 23:41:51 +02:00
Alexandre Bruyelles
b741f6704c
Escape sqlite's tablenames
Fix https://github.com/manuelkasper/AS-Stats/issues/68
This is a commit from https://github.com/falz, thanks to him

Signed-off-by: Alexandre Bruyelles <git@jack.fr.eu.org>
2018-08-04 23:14:58 +02:00
Alexandre Bruyelles
761520b725
netflow_v9: support ip2asn mapping for ipv4 as well
Signed-off-by: Alexandre Bruyelles <abruyelles@odiso.com>
2018-07-16 20:32:01 +02:00
Raf
fc8e8e8683 Use ip2asn to provide a workaround for CSCuf86015 in NetFlow v9 2018-05-12 15:18:32 +02:00
jack
2017097b30
Fix typo
Signed-off-by: jack <jack@k-net.pro>
2017-04-02 14:08:17 +02:00
jack
d0599e60ae
Support optional IP to ASN mapping for sFlow
Signed-off-by: jack <jack@k-net.pro>
2017-03-16 15:54:06 +01:00
jack
c447f9d096
Support optional IP to ASN mapping for netflow v5
Signed-off-by: jack <jack@k-net.pro>
2017-03-10 15:11:05 +01:00
jack
d6c4c0ff95
Store statistics into a sqlite3 database. This way, we can quickly filter links on the top page, deprecating the linkusage page
Signed-off-by: jack <jack@k-net.pro>
2017-02-25 15:58:28 +01:00
jack
84931f2eca Don't set asn as value, but key, thanks manuelkasper
Signed-off-by: jack <jack@k-net.pro>
2017-01-20 20:44:05 +01:00
jack
79abab60d3 sFlow: handle multiple ASN, if you want to merge the statistics when you own more than a single network
Signed-off-by: jack <jack@k-net.pro>
2017-01-19 15:02:21 +01:00
jack
d649faf8d8 Forgot that code ..
Signed-off-by: jack <jack@k-net.pro>
2016-11-18 17:44:24 +01:00
jack
fc940ce20f Support extendedflow
Signed-off-by: jack <jack@k-net.pro>
2016-11-18 17:39:27 +01:00
Shane Mc Cormack
586e5f2d2c Allow separate samplerates for in/out traffic 2016-04-15 15:13:24 +01:00
Manuel Kasper
cb6f4c317b Fix missing stats entries
Fix for link tags that are substrings of other link tags.
2015-11-24 09:14:09 +01:00
Manuel Kasper
5bf3c07994 Make top N AS intervals configurable
* make top N AS intervals configurable (see config.inc), and allow
separate top stats file to be used per interval (enables e.g. proper
weekly/monthly stats)
* add Terabyte formatting
2014-09-11 15:12:58 +02:00
Manuel Kasper
ac2faaf01b peer-as improvements
* add warning when trying to use peer-as stats with NetFlow
* slightly optimize packet handling when peer-as is disabled
* default peer-as stats to disable
2014-09-11 14:59:24 +02:00
jack
705fc9c262 store peer-as data 2014-06-25 17:05:29 +02:00
jack
0063facbb8 add the forgotten 'type' in recursive handflow() 2014-06-25 16:17:06 +02:00
jack
a7ccd7568d wait for children before exit; avoid a 'socket already used' issue on restart; 2014-06-25 15:32:19 +02:00
jack
3050e0bbe5 add a filter in find, so it won't look for deeper sub-tree (another "rrd-tree" stored in the same root) 2014-06-25 15:31:06 +02:00
jack
cf5a549db0 Revert "wait for children before exit; avoid a 'socket already used' issue on restart;"
This reverts commit 86ddfe44b48afd55f741c6bcce91a2e5627d80a4.
2014-06-25 15:28:07 +02:00
jack
faaec24eca Revert "store peer-as in /peeras/* (only for sFlow)"
This reverts commit 4662f2f75dab181ce05bfb60bc903704dab88b15.
2014-06-25 15:28:06 +02:00
jack
f3f697399e Revert "add a filter in find, so it will count as OR peeras, not both of them (same tree..)"
This reverts commit 7920698595fa2447ec38b6f0d0dd70a9e1105c17.
2014-06-25 15:28:05 +02:00
jack
e8009e9e00 Revert "fix help info to add the 'n' switch"
This reverts commit c67e0bc0d9b5f53545a9c087126a7c2fa34dd9de.
2014-06-25 15:27:31 +02:00
jack
c67e0bc0d9 fix help info to add the 'n' switch 2014-06-20 13:53:29 +02:00
jack
7920698595 add a filter in find, so it will count as OR peeras, not both of them (same tree..) 2014-06-20 13:46:07 +02:00
jack
4662f2f75d store peer-as in /peeras/* (only for sFlow) 2014-06-20 13:34:48 +02:00
jack
86ddfe44b4 wait for children before exit; avoid a 'socket already used' issue on restart; 2014-06-20 13:23:42 +02:00
Alexandre Bruyelles
788bdc338f flush cache on exit 2014-06-16 12:26:27 +02:00
Alexandre Bruyelles
705e1687ff fix bug: GatewayIpVersionNextHopRouter is 255.255.255.255 sometimes 2014-06-16 11:28:42 +02:00
Andre Grueneberg
b14b2ff392 Avoid warnings about undefined values 2014-06-14 20:31:07 +02:00
Andre Grueneberg
cde7650819 Corrected paramters to handleflow() 2014-06-14 20:25:58 +02:00
Andre Grueneberg
5c84c03765 Add support for multiple VLANs per ifIndex
sFlow and Netflow v9/v10 may provide VLAN information in flows, so
one can distinguish between different logical links on the same
physical connection (e.g. transit via private VLAN over IXP).
2014-06-14 20:16:05 +02:00
Manuel Kasper
1da6825579 Merge netflow/sflow-asstatd.pl into one script
Contributed by Wouter de Jong
2014-01-07 16:45:12 +01:00
Manuel Kasper
d7b806349c Sync with netflow-asstatd.pl
Fixes race condition when forking (commit 07eccf65bb)
2013-11-15 09:51:54 +01:00
Manuel Kasper
32f68227d9 Use big endian for NetFlow v9 64-bit counters too
This was most likely incorrect in previous versions, but nobody
noticed. Repeat count * not necessary.
2013-04-29 15:58:27 +02:00
Manuel Kasper
47239a8b5c Merge pull request #3 from dpiekacz/master
Remove Math::BigInt
2013-04-29 06:54:56 -07:00
Daniel Piekacz
52c0306055 There is no need to use Math::BigInt 2013-04-29 14:46:34 +01:00