Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add network_route collector #1811

Merged
merged 3 commits into from
Jan 24, 2021
Merged

Conversation

kamijin-fanta
Copy link
Contributor

The routing table is an important monitoring metric when operating Linux as a router. The routing table actually set by BGP, OSPF, etc. is useful for troubleshooting.

reference issue #1639

example outputs

# HELP node_network_route network routing table
# TYPE node_network_route gauge
node_network_route{dest="10.0.0.0/24",gw="100.0.0.1",if="eth1",priority="20",proto="zebra",src="",weight="1"} 1
node_network_route{dest="10.0.0.0/24",gw="100.0.0.2",if="eth1",priority="20",proto="zebra",src="",weight="1"} 1
node_network_route{dest="100.0.0.0/24",gw="",if="eth1",priority="0",proto="kernel",src="100.0.0.3",weight=""} 1
node_network_route{dest="192.168.10.0/24",gw="",if="eth0",priority="0",proto="kernel",src="192.168.10.2",weight=""} 1
node_network_route{dest="default",gw="192.168.10.1",if="eth0",priority="0",proto="static",src="",weight=""} 1
# HELP node_network_routes_total network routing table
# TYPE node_network_routes_total gauge
node_network_routes_total{if="eth0"} 2
node_network_routes_total{if="eth1"} 3

@roidelapluie
Copy link
Member

roidelapluie commented Aug 13, 2020

thanks for working on this.

does it work with multiple routing tables?

@kamijin-fanta
Copy link
Contributor Author

@roidelapluie Thanks for your comment. Currently only the main table is referenced. Should I include a custom routing table?

@kamijin-fanta
Copy link
Contributor Author

What is the status this PR? Need some fixes?

@discordianfish
Copy link
Member

Haven't gotten time to review this in details but two things already:

  • We're using https://github.com/mdlayher/netlink already, could that be used instead of github.com/vishvananda/netlink?
  • Can you add some tests? Probably not as easy as with all the proc fixtures but would be great to have

@kamijin-fanta
Copy link
Contributor Author

@discordianfish Thank you for the review!

The github.com/jsimonetti/rtnetlink package doesn't seem to support the RTA_MULTIPATH attribute. Multipath is commonly used in routing daemons and I would like to support it.

https://github.com/jsimonetti/rtnetlink/blob/d699427278d3e451dcba83b009ac5a5e84d1d621/route.go#L183-L222

This exporter does not parse files etc. Which part of the test do you think would be better?

@discordianfish
Copy link
Member

@mdlayher Are you still maintaining your netlink package? And could we add RTA_MULTIPATH support? I'm going to assume you built the package in a testable way :)

@erolg
Copy link

erolg commented Nov 23, 2020

Hi everyone, as a node exporter user I am waiting this feature. Is there any update?

@kamijin-fanta
Copy link
Contributor Author

I will fix it if I need to change code.

@discordianfish
Copy link
Member

Seems like @mdlayher's netlink package isn't very active anymore.. So I'd say we can merge this and rather replace our current use of netlink by vishvananda's package as well. @SuperQ wdyt?

@mdlayher
Copy link
Contributor

mdlayher commented Nov 24, 2020

"Isn't very active" != "not maintained", my netlink package is widely used and it's effectively complete.

Netlink is not route netlink, and the mentioned "netlink" package conflates the two (among many other things) and adds an iproute2-like API. The equivalent layer in my ecosystem is https://github.com/jsimonetti/rtnetlink. I recently added RTA_MULTIPATH support.

Copy link
Member

@discordianfish discordianfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdlayher Thanks for clarifying! In that case I'd prefer keeping to use your netlink package.

@kamijin-fanta Can you update this PR to use https://github.com/jsimonetti/rtnetlink now that there is RTA_MULTIPATH support?

Signed-off-by: kamijin_fanta <[email protected]>
Signed-off-by: kamijin_fanta <[email protected]>
@kamijin-fanta
Copy link
Contributor Author

Thanks for the library update. and I rewrote PR to use it.

@erolg
Copy link

erolg commented Dec 14, 2020

LGTM. @discordianfish Did you have time to review ?

@discordianfish
Copy link
Member

I'd still like to have tests ideally.. We can merge if that's really not possible but somebody should look into that first.

@kamijin-fanta
Copy link
Contributor Author

I tried to mock the rtnetlink connection, but I couldn't do this because the function field interface is private.

https://github.com/jsimonetti/rtnetlink/blob/master/conn.go

Copy link
Member

@discordianfish discordianfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'd say let's merge it as is for now then.

@SuperQ
Copy link
Member

SuperQ commented Jan 24, 2021

I'm going to merge this and fix the go.sum separately.

@SuperQ SuperQ merged commit 0910f1b into prometheus:master Jan 24, 2021
@SuperQ SuperQ mentioned this pull request Feb 5, 2021
SuperQ added a commit that referenced this pull request Feb 5, 2021
* Update Build
  - Update CircleCI orb.
  - Update CIrcleCI Machine image.
  - Use golang-builder 1.15.
* Update Go modules.
* Fixup fixtures for XFS bug.

Changes:
* [CHANGE] Improve filter flag names. #1743
* [CHANGE] Add btrfs and powersupplyclass to list of exporters enabled by default #1897
* [FEATURE] Add fibre channel collector #1786
* [FEATURE] Expose cpu bugs and flags as info metrics. #1788
* [FEATURE] Add network_route collector #1811
* [FEATURE] Add zoneinfo collector #1922
* [ENHANCEMENT] Add more InfiniBand counters #1694
* [ENHANCEMENT] Add flag to aggr ipvs metrics to avoid high cardinality metrics #1709
* [ENHANCEMENT] Adding backlog/current queue length to qdisc collector #1732
* [ENHANCEMENT] Include TCP OutRsts in netstat metrics #1733
* [ENHANCEMENT] Add pool size to entropy collector #1753
* [ENHANCEMENT] Remove CGO dependencies for OpenBSD amd64 #1774
* [ENHANCEMENT] bcache: add writeback_rate_debug stats #1658
* [ENHANCEMENT] Add check state for mdadm arrays via node_md_state metric #1810
* [ENHANCEMENT] Expose XFS inode statistics #1870
* [ENHANCEMENT] Expose zfs zpool state #1878
* [ENHANCEMENT] Added an ability to pass collector.supervisord.url via SUPERVISORD_URL environment variable #1947
* [BUGFIX] filesystem_freebsd: Fix label values #1728
* [BUGFIX] Fix various procfs parsing errors #1735
* [BUGFIX] Handle no data from powersupplyclass #1747
* [BUGFIX] udp_queues_linux.go: s/upd/udp/ in two error strings #1769
* [BUGFIX] Fix node_scrape_collector_success behaviour #1816
* [BUGFIX] Fix NodeRAIDDegraded to not use a string rule expressions #1827
* [BUGFIX] fix: node_md_disks state label from fail to failed #1862
* [BUGFIX] Handle EPERM for syscall in timex collector #1938
* [BUGFIX] bcache: fix typo #1943
* [BUGFIX] Fix XFS read/write stats (prometheus/procfs#343)

Signed-off-by: Ben Kochie <[email protected]>
SuperQ added a commit that referenced this pull request Feb 5, 2021
* Update Build
  - Update CircleCI orb.
  - Update CIrcleCI Machine image.
  - Use golang-builder 1.15.
* Update Go modules.
* Fixup fixtures for XFS bug.

NOTE: We have improved some of the flag naming conventions (PR #1743). The old names are
      deprecated and will be removed in 2.0. They will continue to work for backwards
      compatibility.

* [CHANGE] Improve filter flag names #1743
* [CHANGE] Add btrfs and powersupplyclass to list of exporters enabled by default #1897
* [FEATURE] Add fibre channel collector #1786
* [FEATURE] Expose cpu bugs and flags as info metrics. #1788
* [FEATURE] Add network_route collector #1811
* [FEATURE] Add zoneinfo collector #1922
* [ENHANCEMENT] Add more InfiniBand counters #1694
* [ENHANCEMENT] Add flag to aggr ipvs metrics to avoid high cardinality metrics #1709
* [ENHANCEMENT] Adding backlog/current queue length to qdisc collector #1732
* [ENHANCEMENT] Include TCP OutRsts in netstat metrics #1733
* [ENHANCEMENT] Add pool size to entropy collector #1753
* [ENHANCEMENT] Remove CGO dependencies for OpenBSD amd64 #1774
* [ENHANCEMENT] bcache: add writeback_rate_debug stats #1658
* [ENHANCEMENT] Add check state for mdadm arrays via node_md_state metric #1810
* [ENHANCEMENT] Expose XFS inode statistics #1870
* [ENHANCEMENT] Expose zfs zpool state #1878
* [ENHANCEMENT] Added an ability to pass collector.supervisord.url via SUPERVISORD_URL environment variable #1947
* [BUGFIX] filesystem_freebsd: Fix label values #1728
* [BUGFIX] Fix various procfs parsing errors #1735
* [BUGFIX] Handle no data from powersupplyclass #1747
* [BUGFIX] udp_queues_linux.go: change upd to udp in two error strings #1769
* [BUGFIX] Fix node_scrape_collector_success behaviour #1816
* [BUGFIX] Fix NodeRAIDDegraded to not use a string rule expressions #1827
* [BUGFIX] Fix node_md_disks state label from fail to failed #1862
* [BUGFIX] Handle EPERM for syscall in timex collector #1938
* [BUGFIX] bcache: fix typo in a metric name #1943
* [BUGFIX] Fix XFS read/write stats (prometheus/procfs#343)

Signed-off-by: Ben Kochie <[email protected]>
oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this pull request Apr 9, 2024
* Update Build
  - Update CircleCI orb.
  - Update CIrcleCI Machine image.
  - Use golang-builder 1.15.
* Update Go modules.
* Fixup fixtures for XFS bug.

NOTE: We have improved some of the flag naming conventions (PR prometheus#1743). The old names are
      deprecated and will be removed in 2.0. They will continue to work for backwards
      compatibility.

* [CHANGE] Improve filter flag names prometheus#1743
* [CHANGE] Add btrfs and powersupplyclass to list of exporters enabled by default prometheus#1897
* [FEATURE] Add fibre channel collector prometheus#1786
* [FEATURE] Expose cpu bugs and flags as info metrics. prometheus#1788
* [FEATURE] Add network_route collector prometheus#1811
* [FEATURE] Add zoneinfo collector prometheus#1922
* [ENHANCEMENT] Add more InfiniBand counters prometheus#1694
* [ENHANCEMENT] Add flag to aggr ipvs metrics to avoid high cardinality metrics prometheus#1709
* [ENHANCEMENT] Adding backlog/current queue length to qdisc collector prometheus#1732
* [ENHANCEMENT] Include TCP OutRsts in netstat metrics prometheus#1733
* [ENHANCEMENT] Add pool size to entropy collector prometheus#1753
* [ENHANCEMENT] Remove CGO dependencies for OpenBSD amd64 prometheus#1774
* [ENHANCEMENT] bcache: add writeback_rate_debug stats prometheus#1658
* [ENHANCEMENT] Add check state for mdadm arrays via node_md_state metric prometheus#1810
* [ENHANCEMENT] Expose XFS inode statistics prometheus#1870
* [ENHANCEMENT] Expose zfs zpool state prometheus#1878
* [ENHANCEMENT] Added an ability to pass collector.supervisord.url via SUPERVISORD_URL environment variable prometheus#1947
* [BUGFIX] filesystem_freebsd: Fix label values prometheus#1728
* [BUGFIX] Fix various procfs parsing errors prometheus#1735
* [BUGFIX] Handle no data from powersupplyclass prometheus#1747
* [BUGFIX] udp_queues_linux.go: change upd to udp in two error strings prometheus#1769
* [BUGFIX] Fix node_scrape_collector_success behaviour prometheus#1816
* [BUGFIX] Fix NodeRAIDDegraded to not use a string rule expressions prometheus#1827
* [BUGFIX] Fix node_md_disks state label from fail to failed prometheus#1862
* [BUGFIX] Handle EPERM for syscall in timex collector prometheus#1938
* [BUGFIX] bcache: fix typo in a metric name prometheus#1943
* [BUGFIX] Fix XFS read/write stats (prometheus/procfs#343)

Signed-off-by: Ben Kochie <[email protected]>
oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this pull request Apr 9, 2024
* Update Build
  - Update CircleCI orb.
  - Update CIrcleCI Machine image.
  - Use golang-builder 1.15.
* Update Go modules.
* Fixup fixtures for XFS bug.

NOTE: We have improved some of the flag naming conventions (PR prometheus#1743). The old names are
      deprecated and will be removed in 2.0. They will continue to work for backwards
      compatibility.

* [CHANGE] Improve filter flag names prometheus#1743
* [CHANGE] Add btrfs and powersupplyclass to list of exporters enabled by default prometheus#1897
* [FEATURE] Add fibre channel collector prometheus#1786
* [FEATURE] Expose cpu bugs and flags as info metrics. prometheus#1788
* [FEATURE] Add network_route collector prometheus#1811
* [FEATURE] Add zoneinfo collector prometheus#1922
* [ENHANCEMENT] Add more InfiniBand counters prometheus#1694
* [ENHANCEMENT] Add flag to aggr ipvs metrics to avoid high cardinality metrics prometheus#1709
* [ENHANCEMENT] Adding backlog/current queue length to qdisc collector prometheus#1732
* [ENHANCEMENT] Include TCP OutRsts in netstat metrics prometheus#1733
* [ENHANCEMENT] Add pool size to entropy collector prometheus#1753
* [ENHANCEMENT] Remove CGO dependencies for OpenBSD amd64 prometheus#1774
* [ENHANCEMENT] bcache: add writeback_rate_debug stats prometheus#1658
* [ENHANCEMENT] Add check state for mdadm arrays via node_md_state metric prometheus#1810
* [ENHANCEMENT] Expose XFS inode statistics prometheus#1870
* [ENHANCEMENT] Expose zfs zpool state prometheus#1878
* [ENHANCEMENT] Added an ability to pass collector.supervisord.url via SUPERVISORD_URL environment variable prometheus#1947
* [BUGFIX] filesystem_freebsd: Fix label values prometheus#1728
* [BUGFIX] Fix various procfs parsing errors prometheus#1735
* [BUGFIX] Handle no data from powersupplyclass prometheus#1747
* [BUGFIX] udp_queues_linux.go: change upd to udp in two error strings prometheus#1769
* [BUGFIX] Fix node_scrape_collector_success behaviour prometheus#1816
* [BUGFIX] Fix NodeRAIDDegraded to not use a string rule expressions prometheus#1827
* [BUGFIX] Fix node_md_disks state label from fail to failed prometheus#1862
* [BUGFIX] Handle EPERM for syscall in timex collector prometheus#1938
* [BUGFIX] bcache: fix typo in a metric name prometheus#1943
* [BUGFIX] Fix XFS read/write stats (prometheus/procfs#343)

Signed-off-by: Ben Kochie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants