travelping / capwap

Erlang CAPWAP AC implementation.
GNU Affero General Public License v3.0
13 stars 8 forks source link

Bug: Reported traffic counters are 0 via Exometer / Influxdb #48

Closed mgumz closed 3 years ago

mgumz commented 3 years ago

Branch: feature/ituma-specific-behaviour Commit: 5548406606b21402c86a5406cca89032b7f13bf5

Description

The Influxdb integration allows capwap-cp to report the observed traffic into a Influxdb instance. However, the reported values are always 0 for the WTP related traffic counters:

> select * from OutOctets where category = 'wtp' order by time desc limit 5;
name: OutOctets
time                        104 category host      thread type   value wtp
----                        --- -------- ----      ------ ----   ----- ---
2021-07-06T06:44:18.169195Z 98  wtp      capwap-db        capwap 0     CN1
2021-07-06T06:44:18.011311Z 98  wtp      capwap-db        capwap 0     CN2
2021-07-06T06:44:17.73734Z  98  wtp      capwap-db        capwap 0     CN3
2021-07-06T06:44:17.460274Z 98  wtp      capwap-db        capwap 0     CN4
2021-07-06T06:44:17.355297Z 98  wtp      capwap-db        capwap 0     CN5

Remarks

The handle_join() code initialises the exomete-data with proper zeros (L435-L438). These are the zeros which are reported to Influxdb.

At the end of the same function, the session-timers are launched (L#446):

Data = start_session_timers(Data2),

When following the start_session_timers/1 function, pattern matching takes place and, based upon the existence of timers in the data, a bunch of timers are started. If timers do not exist, no timers are started. Once a time expires, handle_session_timer() is called, which calls handle_session_timer_ev() which in turns calls accounting_update]() which updates the counters.

I have checked the counters of a running WTP association by applying the same code as in accounting_update() to the session data: The counters as part of the session data are ok and are updated. For now I conclude that accounting_update() is never called and thus the Exometer values are not updated which in turn leaves the value in Influxdb at 0.

The capwap-dp data (which is also exposed by capwap-cp) looks ok:

> select * from OutOctets where category = 'dp' and thread = 'all' order by time desc limit 5;
name: OutOctets
time                        104 category host       thread type   value        wtp
----                        --- -------- ----       ------ ----   -----        ---
2021-07-06T06:40:00.76453Z  98  dp       capwap-db  all    capwap 962843639093 
2021-07-06T06:39:30.764569Z 98  dp       capwap-db  all    capwap 962826961760 
2021-07-06T06:39:00.76478Z  98  dp       capwap-db  all    capwap 962805497849 
2021-07-06T06:38:30.764542Z 98  dp       capwap-db  all    capwap 962773766021 
2021-07-06T06:38:00.764097Z 98  dp       capwap-db  all    capwap 962737962764 
mgumz commented 3 years ago

Another, topic related commit in the branch: https://github.com/travelping/capwap/commit/7b1ee9413768eb3ac1f7e6f364df002c6e9279a9

RoadRunnr commented 3 years ago

configuration problem.

filling the WTP metrics is driven by the Acct-Interim-Interval of the attached AAA session and that session simply has no such setting.

Change the static settings in the Default service to include a sensible interim interval and it will work