mikrotik-exporter icon indicating copy to clipboard operation
mikrotik-exporter copied to clipboard

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

Open knyar opened this issue 1 year ago • 0 comments

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.

knyar avatar Aug 05 '22 10:08 knyar