Skip to content

Netwatch status missing for hosts that do not have disabled field set #148

Open
@knyar

Description

@knyar

I am using mikrotik-exporter to collect metrics from a RB4011iGS+5HacQ2HnD router running RouterOS 7.4.

When I add a new netwatch host, its status does not get exported:

$ ssh 10.11.12.1 '/tool/netwatch add host=1.1.1.1'
$ curl -s localhost:11223/metrics | grep 1.1.1.1
$ 

Explicitly setting disabled=no fixes this:

$ ssh 10.11.12.1 '/tool/netwatch set disabled=no [find host=1.1.1.1]'
$ curl -s localhost:11223/metrics | grep 1.1.1.1
mikrotik_netwatch_status{address="10.11.12.1",comment="",host="1.1.1.1",name="router"} 1
$

It seems that ?disabled=false condition does not hold true if disabled field is not set at all. Is this expected?

Silently omitting data from exported metrics does not seem like a great default. Would it make sense to remove the ?disabled=false condition while querying data via the API and either exclude disabled hosts in the exporter, or maybe just expose disabled as a separate metric label?

I will be happy to prepare a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions