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

Initial support for EoIP, GRE and IPIP #206

Merged
merged 3 commits into from
Dec 23, 2024
Merged

Conversation

phibos
Copy link
Contributor

@phibos phibos commented Dec 11, 2024

This adds initial support for EoIP, GRE and IPIP interfaces and fixes #204

@phibos
Copy link
Contributor Author

phibos commented Dec 17, 2024

@akpw this PR adds the disabled label to interface_status. This might break backward compatibility. Should we add an additional metric like interface_disabled to add the disabled state?

@akpw
Copy link
Owner

akpw commented Dec 17, 2024

@phibos adding a label should be fine, however dropping existing labels or renaming existing metrics would result in breaking compatibility. from a quick glance there seems to be the case with status at least, can you pls double check to make sure all of the existing metrics and labels stay compatible?

@phibos
Copy link
Contributor Author

phibos commented Dec 19, 2024

Current status metrics

mktxp_interface_status{name="sfp1",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{name="sfp2",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{name="sfp3",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{name="sfp4",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{name="sfp5",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{name="sfp6",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{name="sfp7",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{name="sfp8",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{name="sfp9",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{name="sfp10",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{name="sfp11",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{name="sfp12",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{name="sfpplus1",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0

Status metrics after applying the changes:

mktxp_interface_status{disabled="0",name="sfp1",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="sfp2",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="1",name="sfp3",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="1",name="sfp4",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="1",name="sfp5",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="1",name="sfp6",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="1",name="sfp7",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="1",name="sfp8",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="1",name="sfp9",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="1",name="sfp10",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="1",name="sfp11",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="0",name="sfp12",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="1",name="sfpplus1",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 0.0
mktxp_interface_status{disabled="0",name="br-a",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="br-B",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="vrrp1",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="eoip-a",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="eoip-b",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="gre-a",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="gre-b",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="gre-c",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="gre-d",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0
mktxp_interface_status{disabled="0",name="gre-e",routerboard_address="192.168.1.1",routerboard_name="router.example.org"} 1.0

From a quick diff, the following changes:

  • Add "disabled" label
  • Add additional interfaces like:
    • Bridge
    • VRRP
    • EoIP
    • GRE

Current version:

The reported status is the status value from /interface/ethernet/monitor. Every 'link-ok' results in status=1, everything else ('no-link' and 'unknown') results in status=0.
https://help.mikrotik.com/docs/spaces/ROS/pages/8323191/Ethernet#Ethernet-Monitor

New version:

The status is the running value reported by /interface/print.

From the docs: https://help.mikrotik.com/docs/spaces/ROS/pages/8323191/Ethernet#Ethernet-Properties

Whether interface is running. Note that some interface does not have running check and they are always reported as "running".

At the moment I can't see any difference in the status reported. But if you like to keep the interface_status metric as link status I can rename the new metrics to interface_running.

@phibos
Copy link
Contributor Author

phibos commented Dec 19, 2024

One thing we should change is the handling of the use_comments_over_names setting.

For some metrics it is handled in the interface_ds ...

if include_comments and interface.get('comment'):
# combines names with comments
interface_monitor_record['name'] = interface['comment'] if router_entry.config_entry.use_comments_over_names else \
f"{interface['name']} ({interface['comment']})"

... and for some others it is handled by the interface_collector

if interface_traffic_record.get('comment'):
interface_traffic_record['name'] = interface_traffic_record['comment'] if router_entry.config_entry.use_comments_over_names \
else f"{interface_traffic_record['name']} ({interface_traffic_record['comment']})"

After this PR is merged I can proved a new PR to move the use_comments_over_names handling into the interface_ds.

@akpw
Copy link
Owner

akpw commented Dec 22, 2024

@phibos thanks for the thorough check. Looks like the docs indicate there could be a difference, and e.g. the default dashboard already uses the link status context as well. So yes if possible it'd be better to leave interface_status and monitor_collector as they are, introducing new interface_running` metric instead.

* Splitting the status and running metrics
  * interface_status is the link status
  * interface_running is the running state reported by RouterOS devices
  * interface_disabled is the disabled state
* Move the handling of the 'use_comments_over_names' setting to the
  DS, now it is also supported for GRE, IPIP, EoIP and other interfaces
@phibos
Copy link
Contributor Author

phibos commented Dec 23, 2024

@akpw I have

  • Splitting the status and running metrics
    • interface_status is the link status
    • interface_running is the running state reported by RouterOS devices
    • interface_disabled is the disabled state
  • Move the handling of the 'use_comments_over_names' setting to the
    DS, now it is also supported for GRE, IPIP, EoIP and other interfaces
  • Removed some unused code
  • Rebase with main, to get the latest changes

@akpw akpw merged commit 799aeb4 into akpw:main Dec 23, 2024
@phibos phibos deleted the eoip_gre_ipip branch December 23, 2024 10:39
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.

Non-Ethernet Interface status
2 participants