czerwonk / bird_exporter

Bird protocol state exporter for bird routing daemon to use with https://prometheus.io/
MIT License
176 stars 45 forks source link

RPKI support issue when used with IPv4 and IPv6 ROAs #73

Open appliedprivacy opened 2 years ago

appliedprivacy commented 2 years ago

bird_exporter got RPKI support in #42, thanks for that!

birdcl s p all r3k 
BIRD 2.0.7 ready.
Name       Proto      Table      State  Since         Info
r3k        RPKI       ---        up     2022-08-10 07:28:24  Established
  Cache server:     ...
  Status:           Established
  Transport:        Unprotected over TCP
  Protocol version: 1
  Session ID:       64843
  Serial number:    687
  Last update:      before 466.296 s
  Refresh timer   : 433.703/900
  Retry timer     : ---
  Expire timer    : 6733.703/7200
  Channel roa4
    State:          UP
    Table:          r4
    Preference:     100
    Input filter:   ACCEPT
    Output filter:  REJECT
    Routes:         299609 imported, 0 exported, 299609 preferred
    Route change stats:     received   rejected   filtered    ignored   accepted
      Import updates:         640636          0          0     185644     454992
      Import withdraws:         5711          0        ---       1583     155383
      Export updates:              0          0          0        ---          0
      Export withdraws:            0        ---        ---        ---          0
  Channel roa6
    State:          UP
    Table:          r6
    Preference:     100
    Input filter:   ACCEPT
    Output filter:  REJECT
    Routes:         73686 imported, 0 exported, 73686 preferred
    Route change stats:     received   rejected   filtered    ignored   accepted
      Import updates:          76912          0          0        808      76104
      Import withdraws:         2648          0        ---        324       2418
      Export updates:              0          0          0        ---          0
      Export withdraws:            0        ---        ---        ---          0

The two primarily relevant values besides the status are:

but the exporter only covers the last section (channel roa6):

bird_protocol_changes_update_import_accept_count{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI"} 76104
bird_protocol_changes_update_import_ignore_count{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI"} 808
bird_protocol_changes_update_import_receive_count{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI"} 76912
bird_protocol_changes_withdraw_import_accept_count{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI"} 2418
bird_protocol_changes_withdraw_import_ignore_count{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI"} 324
bird_protocol_changes_withdraw_import_receive_count{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI"} 2648
bird_protocol_prefix_import_count{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI"} 73686
bird_protocol_prefix_preferred_count{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI"} 73686
bird_protocol_up{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI",state="Established"} 1
bird_protocol_uptime{export_filter="REJECT",import_filter="ACCEPT",ip_version="",name="r3k",proto="RPKI"} 276447

The information regarding Channel roa4 is missing in the output of bird_exporter.

Since RPKI output is special it will probably need dedicated handling when parsing.

bird RPKI config:

roa4 table r4;
roa6 table r6;

protocol rpki r3k {

        roa4 { table r4; };
        roa6 { table r6; };

...
}