Port down/up alarm error

Hello,

I pretty new with LibreNMS. I want to configure an alarm for port down/up to work in the next way:

  1. When the port is down, it sends a notification with port down
  2. When the port recovers from down to up, it sends a notification with port up

The rule is: SELECT * FROM devices,ports WHERE (devices.device_id = ? AND devices.device_id = ports.device_id) AND ports.ifOperStatus = “down” AND ports.ifOperStatus_prev = “up”

My problem is that I receive notification only when the port is down. Even if it recovers, I still receive notification with port down. I must turn off the alarm to don’t receive any more notifications with port down. It’s like getting in a loop.

Thanks!

This is my port rule which does exactly what you’re looking for, and it gives me the recovery alert

SELECT * FROM devices,ports WHERE (devices.device_id = ? AND devices.device_id = ports.device_id) AND (ports.ifOperStatus = “down” && ports.ifAdminStatus != “down” && (ports.deleted = 0 && ports.ignore = 0 && ports.disabled = 0)) = 1

For my Alert Template i use the following template

{{ $alert->title }}
Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
#{{ $key }}: {{ $value[‘string’] }}
Port: {{ $value[‘ifName’] }}
Port Name: {{ $value[‘ifAlias’] }}
Port Status: {{ $value[‘message’] }}
@endforeach
@endif

Thank you for the solution. The rule works, it triggers when the port comes back UP, but unfortunately I still receive alerts that the port is DOWN.

Do you know what it can be?

Can you show me the alert you receive that shows the port is DOWN?




I’m thinking it’s the way your rule is structured with the ports.ifOperStatus_prev. Try removing the ports.ifOperStatus_prev so the rule will alert if the port status = down, but when the port is anything other then down then send recovery alert.

I have deleted ports.ifOperStatus_prev and I receive notifications only with port down. I don’t get notifications when the port goes up.

Beats me, as long as you have recovery email ticked (which you do per your last screenshot) it should be emailing you once the port is not Down reporting as recovered

Try my exact rule using the macros_port_down and settings as mine 100% works for down and up.

Unfortunately it didn’t work. Anyway, thanks for your help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.