Git Product home page Git Product logo

gobgp_exporter's Introduction

GoBGP Exporter

Export GoBGP data to Prometheus.

To run it:

cd $GOPATH/src
mkdir -p github.com/greenpau
cd github.com/greenpau
git clone https://github.com/greenpau/gobgp_exporter.git
cd gobgp_exporter
make
make qtest

Exported Metrics

Metric Description Labels
gobgp_router_up Is GoBGP up and responds to queries (1) or is it down (0).
gobgp_router_id What is GoBGP router ID. id
gobgp_router_asn What is GoBGP AS number.
gobgp_router_failed_req_count The number of failed requests to GoBGP router.
gobgp_router_next_poll The timestamp of the next potential scrape of the router.
gobgp_router_scrape_time The amount of time it took to scrape the router.
gobgp_route_total_destination_count The number of routes on per address family and route table basis address_family, route_table, vrf_name
gobgp_route_total_path_count The number of available paths to destinations on per address family and route table basis address_family, route_table, vrf_name
gobgp_route_accepted_path_count The number of accepted paths to destinations on per address family and route table basis address_family, route_table, vrf_name
gobgp_peer_count The number of BGP peers
gobgp_peer_up Is the peer up and in established state (1) or it is not (0). name
gobgp_peer_asn What is the AS number of the peer name
gobgp_peer_local_asn What is the AS number presented to the peer by this router. name
gobgp_peer_admin_state Is the peer configured for being Up (0), Down (1), or PFX_CT (2) name
gobgp_peer_session_state What is the state of BGP session to the peer - unknown (0), idle (1), connect (2), active (3), opensent (4), openconfirm (5), established (6) name
gobgp_peer_received_message_total_count The total number of messages the BGP peer sent to this router (limited to IPv4). name
gobgp_peer_received_notification_message_count How many Notification messages did the BGP peer sent to this router (limited to IPv4). name
gobgp_peer_received_update_message_count How many Update messages did the BGP peer sent to this router (limited to IPv4). name
gobgp_peer_received_open_message_count How many Open messages did the BGP peer sent to this router (limited to IPv4). name
gobgp_peer_received_keepalive_message_count How many messages did the BGP peer sent to this router (limited to IPv4). name
gobgp_peer_received_refresh_message_count How many Refresh messages did the BGP peer sent to this router (limited to IPv4). name
gobgp_peer_received_withdraw_update_message_count How many WithdrawUpdate messages did the BGP peer sent to this router (limited to IPv4). name
gobgp_peer_received_withdraw_prefix_message_count How many messages did the BGP peer sent to this router (limited to IPv4). name
gobgp_peer_sent_message_total_count The total number of messages this router sent to this BGP peer (limited to IPv4). name
gobgp_peer_sent_notification_message_count How many Notification messages did this router sent to this BGP peer (limited to IPv4). name
gobgp_peer_sent_update_message_count How many Update messages did this router sent to this BGP peer (limited to IPv4). name
gobgp_peer_sent_open_message_count How many Open messages did this router sent to this BGP peer (limited to IPv4). name
gobgp_peer_sent_keepalive_message_count How many messages did this router sent to this BGP peer (limited to IPv4). name
gobgp_peer_sent_refresh_message_count How many Refresh messages did this router sent to this BGP peer (limited to IPv4). name
gobgp_peer_sent_withdraw_update_message_count How many WithdrawUpdate messages did this router sent to this BGP peer (limited to IPv4). name
gobgp_peer_sent_withdraw_prefix_message_count How many messages did this router sent to this BGP peer (limited to IPv4). name
gobgp_peer_out_queue_count PeerState.OutQ name
gobgp_peer_flop_count PeerState.Flops name
gobgp_peer_send_community PeerState.SendCommunity name
gobgp_peer_remove_private_as PeerState.RemovePrivateAs name
gobgp_peer_password_set Whether the GoBGP peer has been configured (1) for authentication or not (0) name
gobgp_peer_type PeerState.PeerType name

For example:

# HELP gobgp_peer_admin_state Is the peer configured for being Up (0), Down (1), or PFX_CT (2)
# TYPE gobgp_peer_admin_state gauge
gobgp_peer_admin_state{name="10.0.2.100"} 0
# HELP gobgp_peer_asn What is the AS number of the peer
# TYPE gobgp_peer_asn gauge
gobgp_peer_asn{name="10.0.2.100"} 65001
# HELP gobgp_peer_count The number of BGP peers
# TYPE gobgp_peer_count gauge
gobgp_peer_count 1
# HELP gobgp_peer_flop_count PeerState.Flops
# TYPE gobgp_peer_flop_count gauge
gobgp_peer_flop_count{name="10.0.2.100"} 0
# HELP gobgp_peer_local_asn What is the AS number presented to the peer by this router.
# TYPE gobgp_peer_local_asn gauge
gobgp_peer_local_asn{name="10.0.2.100"} 0
# HELP gobgp_peer_out_queue_count PeerState.OutQ
# TYPE gobgp_peer_out_queue_count gauge
gobgp_peer_out_queue_count{name="10.0.2.100"} 0
# HELP gobgp_peer_password_set Whether the GoBGP peer has been configured (1) for authentication or not (0)
# TYPE gobgp_peer_password_set gauge
gobgp_peer_password_set{name="10.0.2.100"} 0
# HELP gobgp_peer_received_keepalive_message_count How many messages did the BGP peer sent to this router (limited to IPv4).
# TYPE gobgp_peer_received_keepalive_message_count gauge
gobgp_peer_received_keepalive_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_received_message_total_count The total number of messages the BGP peer sent to this router (limited to IPv4).
# TYPE gobgp_peer_received_message_total_count gauge
gobgp_peer_received_message_total_count{name="10.0.2.100"} 0
# HELP gobgp_peer_received_notification_message_count How many Notification messages did the BGP peer sent to this router (limited to IPv4).
# TYPE gobgp_peer_received_notification_message_count gauge
gobgp_peer_received_notification_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_received_open_message_count How many Open messages did the BGP peer sent to this router (limited to IPv4).
# TYPE gobgp_peer_received_open_message_count gauge
gobgp_peer_received_open_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_received_refresh_message_count How many Refresh messages did the BGP peer sent to this router (limited to IPv4).
# TYPE gobgp_peer_received_refresh_message_count gauge
gobgp_peer_received_refresh_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_received_update_message_count How many Update messages did the BGP peer sent to this router (limited to IPv4).
# TYPE gobgp_peer_received_update_message_count gauge
gobgp_peer_received_update_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_received_withdraw_prefix_message_count How many messages did the BGP peer sent to this router (limited to IPv4).
# TYPE gobgp_peer_received_withdraw_prefix_message_count gauge
gobgp_peer_received_withdraw_prefix_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_received_withdraw_update_message_count How many WithdrawUpdate messages did the BGP peer sent to this router (limited to IPv4).
# TYPE gobgp_peer_received_withdraw_update_message_count gauge
gobgp_peer_received_withdraw_update_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_remove_private_as PeerState.RemovePrivateAs
# TYPE gobgp_peer_remove_private_as gauge
gobgp_peer_remove_private_as{name="10.0.2.100"} 0
# HELP gobgp_peer_send_community PeerState.SendCommunity
# TYPE gobgp_peer_send_community gauge
gobgp_peer_send_community{name="10.0.2.100"} 0
# HELP gobgp_peer_sent_keepalive_message_count How many messages did this router sent to this BGP peer (limited to IPv4).
# TYPE gobgp_peer_sent_keepalive_message_count gauge
gobgp_peer_sent_keepalive_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_sent_message_total_count The total number of messages this router sent to this BGP peer (limited to IPv4).
# TYPE gobgp_peer_sent_message_total_count gauge
gobgp_peer_sent_message_total_count{name="10.0.2.100"} 0
# HELP gobgp_peer_sent_notification_message_count How many Notification messages did this router sent to this BGP peer (limited to IPv4).
# TYPE gobgp_peer_sent_notification_message_count gauge
gobgp_peer_sent_notification_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_sent_open_message_count How many Open messages did this router sent to this BGP peer (limited to IPv4).
# TYPE gobgp_peer_sent_open_message_count gauge
gobgp_peer_sent_open_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_sent_refresh_message_count How many Refresh messages did this router sent to this BGP peer (limited to IPv4).
# TYPE gobgp_peer_sent_refresh_message_count gauge
gobgp_peer_sent_refresh_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_sent_update_message_count How many Update messages did this router sent to this BGP peer (limited to IPv4).
# TYPE gobgp_peer_sent_update_message_count gauge
gobgp_peer_sent_update_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_sent_withdraw_prefix_message_count How many messages did this router sent to this BGP peer (limited to IPv4).
# TYPE gobgp_peer_sent_withdraw_prefix_message_count gauge
gobgp_peer_sent_withdraw_prefix_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_sent_withdraw_update_message_count How many WithdrawUpdate messages did this router sent to this BGP peer (limited to IPv4).
# TYPE gobgp_peer_sent_withdraw_update_message_count gauge
gobgp_peer_sent_withdraw_update_message_count{name="10.0.2.100"} 0
# HELP gobgp_peer_session_state What is the state of BGP session to the peer - unknown (0), idle (1), connect (2), active (3), opensent (4), openconfirm (5), established (6)
# TYPE gobgp_peer_session_state gauge
gobgp_peer_session_state{name="10.0.2.100"} 3
# HELP gobgp_peer_type PeerState.PeerType
# TYPE gobgp_peer_type gauge
gobgp_peer_type{name="10.0.2.100"} 0
# HELP gobgp_peer_up Is the peer up and in established state (1) or it is not (0).
# TYPE gobgp_peer_up gauge
gobgp_peer_up{name="10.0.2.100"} 0
# HELP gobgp_route_accepted_path_count The number of accepted paths to destinations on per address family and route table basis
# TYPE gobgp_route_accepted_path_count gauge
gobgp_route_accepted_path_count{address_family="evpn",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="evpn",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_encap",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_encap",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_mpls",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_mpls",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_vpn",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_vpn",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_vpn_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv4_vpn_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_encap",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_encap",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_mpls",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_mpls",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_vpn",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_vpn",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_vpn_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="ipv6_vpn_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="l2_vpn_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_accepted_path_count{address_family="l2_vpn_flowspec",route_table="local",vrf_name="default"} 0
# HELP gobgp_route_total_destination_count The number of routes on per address family and route table basis
# TYPE gobgp_route_total_destination_count gauge
gobgp_route_total_destination_count{address_family="evpn",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="evpn",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4",route_table="global",vrf_name="default"} 3
gobgp_route_total_destination_count{address_family="ipv4",route_table="local",vrf_name="default"} 3
gobgp_route_total_destination_count{address_family="ipv4_encap",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4_encap",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4_mpls",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4_mpls",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4_vpn",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4_vpn",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4_vpn_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv4_vpn_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_encap",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_encap",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_mpls",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_mpls",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_vpn",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_vpn",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_vpn_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="ipv6_vpn_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="l2_vpn_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_destination_count{address_family="l2_vpn_flowspec",route_table="local",vrf_name="default"} 0
# HELP gobgp_route_total_path_count The number of available paths to destinations on per address family and route table basis
# TYPE gobgp_route_total_path_count gauge
gobgp_route_total_path_count{address_family="evpn",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="evpn",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4",route_table="global",vrf_name="default"} 3
gobgp_route_total_path_count{address_family="ipv4",route_table="local",vrf_name="default"} 3
gobgp_route_total_path_count{address_family="ipv4_encap",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4_encap",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4_mpls",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4_mpls",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4_vpn",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4_vpn",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4_vpn_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv4_vpn_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_encap",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_encap",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_mpls",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_mpls",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_vpn",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_vpn",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_vpn_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="ipv6_vpn_flowspec",route_table="local",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="l2_vpn_flowspec",route_table="global",vrf_name="default"} 0
gobgp_route_total_path_count{address_family="l2_vpn_flowspec",route_table="local",vrf_name="default"} 0
# HELP gobgp_router_asn What is GoBGP AS number.
# TYPE gobgp_router_asn gauge
gobgp_router_asn 65001
# HELP gobgp_router_failed_req_count The number of failed requests to GoBGP router.
# TYPE gobgp_router_failed_req_count counter
gobgp_router_failed_req_count 0
# HELP gobgp_router_id What is GoBGP router ID.
# TYPE gobgp_router_id gauge
gobgp_router_id 1
# HELP gobgp_router_next_poll The timestamp of the next potential scrape of the router.
# TYPE gobgp_router_next_poll counter
gobgp_router_next_poll 0
# HELP gobgp_router_scrape_time The amount of time it took to scrape the router.
# TYPE gobgp_router_scrape_time gauge
gobgp_router_scrape_time 0.019395555
# HELP gobgp_router_up Is GoBGP up and responds to queries (1) or is it down (0).
# TYPE gobgp_router_up gauge
gobgp_router_up 1

Flags

$ bin/gobgp-exporter --help

gobgp-exporter - Prometheus Exporter for GoBGP

Usage: gobgp-exporter [arguments]

  -auth.token string
        The X-Token for accessing the exporter itself (default "anonymous")
  -gobgp.address string
        gRPC API address of GoBGP server. (default "127.0.0.1:50051")
  -gobgp.poll-interval int
        The minimum interval (in seconds) between collections from a GoBGP server. (default 15)
  -gobgp.timeout int
        Timeout on gRPC requests to a GoBGP server. (default 2)
  -gobgp.tls
        Whether to enable TLS for gRPC API access.
  -gobgp.tls-ca string
        Optional path to PEM file with CA certificates to be trusted for gRPC API access.
  -gobgp.tls-client-cert string
        Optional path to PEM file with client certificate to be used for client authentication.
  -gobgp.tls-client-key string
        Optional path to PEM file with client key to be used for client authentication.
  -gobgp.tls-server-name string
        Optional hostname to verify API server as.
  -log.level string
        logging severity level (default "info")
  -metrics
        Display available metrics
  -version
        version information
  -web.listen-address string
        Address to listen on for web interface and telemetry. (default ":9474")
  -web.telemetry-path string
        Path under which to expose metrics. (default "/metrics")

Documentation: https://github.com/greenpau/gobgp_exporter/
  • gobgp.address: Address (host and port) of the GoBGP instance we should connect to. This could be a local GoBGP server (127.0.0.0:50051, for instance), or the address of a remote GoBGP server.
  • gobgp.tls: Enable TLS for the GoBGP connection. (default: false)
  • gobgp.tls-ca: Optional path to a PEM file containing certificate authorities to verify GoBGP server certificate against. If empty, the host's root CA set is used instead. (default: empty)
  • gobgp.tls-client-cert: Optional path to a PEM file containing the client certificate to authenticate with. (default: empty)
  • gobgp.tls-client-key: Optional path to a PEM file containing the key for theclient certificate to authenticate with. (default: empty)
  • gobgp.tls-server-name: Optional server name to verify GoBGP server certificate against. If empty, verification will be using the hostname or IP used in gobgp.address. (default: empty)
  • gobgp.timeout: Timeout on gRPC requests to GoBGP.
  • gobgp.poll-interval: The minimum interval (in seconds) between collections from GoBGP server. (default: 15 seconds)
  • gobgp.peers: The file containing the mapping between router_id and the name (e.g. hostname) of a remote peer.
  • auth.token: Enable X-Token authentication for accessing the exporter itself.
  • version: Show application version.
  • web.listen-address: Address to listen on for web interface and telemetry.
  • web.telemetry-path: Path under which to expose metrics.

gobgp_exporter's People

Contributors

greenpau avatar icedream avatar mrueg avatar sebastien-coavoux avatar vj396 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gobgp_exporter's Issues

Add metric for listen_port

Add metric for listen_port:

(*gobgpapi.Global)(0xc0000b0e00)(as:65001 router_id:"10.0.2.15" listen_port:179 listen_addresses:"0.0.0.0" listen_addresses:"::" )

Reference:

type Global struct {
    As                    uint32                       `protobuf:"varint,1,opt,name=as" json:"as,omitempty"`
    RouterId              string                       `protobuf:"bytes,2,opt,name=router_id,json=routerId" json:"router_id,omitempty"`
    ListenPort            int32                        `protobuf:"varint,3,opt,name=listen_port,json=listenPort" json:"listen_port,omitempty"`
    ListenAddresses       []string                     `protobuf:"bytes,4,rep,name=listen_addresses,json=listenAddresses" json:"listen_addresses,omitempty"`
    Families              []uint32                     `protobuf:"varint,5,rep,packed,name=families" json:"families,omitempty"`
    UseMultiplePaths      bool                         `protobuf:"varint,6,opt,name=use_multiple_paths,json=useMultiplePaths" json:"use_multiple_paths,omitempty"`
    RouteSelectionOptions *RouteSelectionOptionsConfig `protobuf:"bytes,7,opt,name=route_selection_options,json=routeSelectionOptions" json:"route_selection_options,  omitempty"`
    DefaultRouteDistance  *DefaultRouteDistance        `protobuf:"bytes,8,opt,name=default_route_distance,json=defaultRouteDistance" json:"default_route_distance,     omitempty"`
    Confederation         *Confederation               `protobuf:"bytes,9,opt,name=confederation" json:"confederation,omitempty"`
    GracefulRestart       *GracefulRestart             `protobuf:"bytes,10,opt,name=graceful_restart,json=gracefulRestart" json:"graceful_restart,omitempty"`
    ApplyPolicy           *ApplyPolicy                 `protobuf:"bytes,11,opt,name=apply_policy,json=applyPolicy" json:"apply_policy,omitempty"`
}

Expose build info for gobgp

It would be nice if gobgp exporter would expose build information of gobgp, e.g. which version it is running.

gobgp-exporter failed to init properly: context deadline exceeded source="main.go:73" - help needed

HI there,

I have followed the document to install the gobgp exporter locally. everything went well until execution of $make.
However $make qtest fails with following error..
$make qtest
INFO[0000] Starting gobgp-exporter (version=1.1.3, branch=master, revision=v1.1.3-1-g1eeeea6) source="main.go:68"
INFO[0000] Build context (go=go1.16.5, user=chimaya.dash, date=2021-07-14) source="main.go:69"
ERRO[0002] gobgp-exporter failed to init properly: context deadline exceeded source="main.go:73"

moreover when i manually run gobgp-exporter command, it works for --help, -metrics, -version flags and it fails for others flags.

Please assist. Thank you!

IPV6 compatibility for gobgp exporter

Hi,

I have noticed that GOBGP exporter is not compatible with IPV6 address. It gives parsing error when I use IPV6 address to connect to remote server.

while scanning we found, the below piece of code is throwing the error after validating the format.

arr := strings.Split(s, ":")
if len(arr) != 2 {
return fmt.Errorf("invalid address %s, expected 'ipaddress:port'", s)

Will it be possible to make it work for both IPV4 and IPV6? Please confirm.

Thank you!

Vendor packages

Would it be possible to vendor packages or provide a vendor lockfile?

Add metric for ListenAddresses

Add metric for ListenAddresses.

    if len(g.ListenAddresses) > 0 {
        fmt.Printf("Listening Port: %d, Addresses: %s\n", g.ListenPort, strings.Join(g.ListenAddresses, ", "))

Project status

Hello,

I'm considering to implement gobgp exporter but I noticed that last update was almost year ago so I'm wondering if this project is still maintained?

Thank you in advance!

Add metrics for VRF-related stuff

Currently RIB metrics only capture "default" VRF. Add an attribute to RouterNode for the holding of VRF information. Then add metrics for non-default VRF.

Unable to build

pkg/gobgp_exporter/collect.go:45:14: undefined: gobgpapi.GetServerRequest pkg/gobgp_exporter/collect.go:46:32: n.client.Gobgp.GetServer undefined (type gobgpapi.GobgpApiClient has no field or method GetServer) pkg/gobgp_exporter/collect_peers.go:28:21: undefined: gobgpapi.GetNeighborRequest pkg/gobgp_exporter/collect_peers.go:31:37: n.client.Gobgp.GetNeighbor undefined (type gobgpapi.GobgpApiClient has no field or method GetNeighbor)

Using CentOS 7
go1.13.8

I haven't much experience with building Go applications so the fault might be on me. Earlier I've been getting errors regarding vendor/github.com/osrg/gobgp/api/gobgp.pb.extended.go being nonexistant, so I cloned the gobgp repository in the above directory and the build commenced, until it ran into the aforementioned issue.

runtime error: invalid memory address or nil pointer dereference

Unfortunately gobgp_exporter sometimes seems to segfault.

time="2019-05-16T12:54:26Z" level=error msg="Can't query GoBGP: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: <nil>" source="collect.go:49"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa43bad]

goroutine 1128 [running]:
github.com/ovnworks/gobgp_exporter/pkg/gobgp_exporter.(*RouterNode).GatherMetrics(0x3cce41f0100)
       /var/tmp/portage/app-metrics/gobgp_exporter-1.1.0/work/gobgp_exporter-1.1.0/src/github.com/ovnworks/gobgp_exporter/pkg/gobgp_exporter/collect.go:61 +0x1dd
github.com/ovnworks/gobgp_exporter/pkg/gobgp_exporter.(*RouterNode).Collect(0x3cce41f0100, 0x3cce4095560)
       /var/tmp/portage/app-metrics/gobgp_exporter-1.1.0/work/gobgp_exporter-1.1.0/src/github.com/ovnworks/gobgp_exporter/pkg/gobgp_exporter/router_node.go:122 +0x8c
github.com/ovnworks/gobgp_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
       github.com/prometheus/client_golang/prometheus/registry.go:434 +0x19d
created by github.com/ovnworks/gobgp_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Gather
       github.com/prometheus/client_golang/prometheus/registry.go:445 +0x571

Using gobgp_exporter with a dns address

Hi,
seems like the validation for hostnames it's not happy with not using ip addresses.

scrubbing-engine-gobgp-exporter | ts=2023-12-22T14:29:17.620Z caller=main.go:218 level=error msg="failed to init properly" error="invalid IP address in gobgp:50051"

while trying to use the dns:// like in https://github.com/greenpau/gobgp_exporter/blob/main/pkg/gobgp_exporter/router_node.go#L96 prefix returns another error

scrubbing-engine-gobgp-exporter  | ts=2023-12-22T14:38:11.123Z caller=main.go:218 level=error msg="failed to init properly" error="address dns://gobgp:50051: too many colons in address"

Now this logic seems a bit weird to me and i want to make sure this is intended before sending out a patch especially cause the test have a lot of bad cases, for rejection but none of the good ones for ensuring that positive cases don't get rejected

https://github.com/greenpau/gobgp_exporter/blob/main/pkg/gobgp_exporter/gobgp_exporter_test.go#L35

and adding in the {address: "dns://localhost:50051", ok: true}, in the list does get it rejected.

But if i read this correctly is rejecting anything that is not an IP address

SplitHostPort tries to split in host/port but any colon before the port address will throw the too many colons error (https://cs.opensource.google/go/go/+/refs/tags/go1.21.5:src/net/ipsock.go;l=164)

so the dns:// that is saying it's valid will always throw an error, and if there's any host it will only trigger the first branch of the if/then/else statament so it's impossible for a dns name to pass.

	host, strport, err := net.SplitHostPort(s)
	if err != nil {
		return err
	} else if host != "" {
		if addr := net.ParseIP(host); addr == nil {
			return fmt.Errorf("invalid IP address in %s", s)
		}
	} else if !strings.HasPrefix(s, "dns://") {
		return fmt.Errorf("invalid address format in %s", s)
	} else {
		// "dns://" prefix for hostname is allowed per go grpc documentation
		// see https://pkg.go.dev/google.golang.org/grpc#DialContext
		idx := strings.LastIndex(s, ":")
		host = s[0:idx]
		strport = s[idx+1:]
	}

Now what was your intention for valid endpoints for gobgp? i think it make sense to give the option to give a full fledged URI and then validate, i can send the patch if that's the case and i can improve the validation method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.