Switch port name in alert notifications

I am trying to get which port (Interface name and Description) is down in my switch by alert notifications. I only get a “Port status up/down” notification. I have no clue how to use ports.ifAlias in alert rules. Please help me. Thank you.

Please, post your alert rule and alert template.

@sakibmahmud
you’ve got the Doc helping you…he’s awesome. I’ll just throw a little of what i know into the mix.
port.ifAlias you can do one of two things:

  1. you can set on the switch / router itself. I run HP and the syntax is interface 0/1 name “my_server”
  2. librenms is amazing and allows you to alter this description without modifying the switch/router config. Click on a device–>cog on right for device–>port settings. Right hand column you will see “description” field where you can edit.

So for example you could have “Servers: Server01, Servers: Server01” or “Core: Link-to-switch-1 | Core: Link-to-switch-2” Then you can set an alert like this

some action when port.ifAlias = “Server:” or port.ifAlias = “Core:” meets some condition, like down or whatever.

1 Like

Sir, Currently I do not have any alert rule and alert template.

Thank you for your advice!

Take the Port status up/down from rule collection or, as you said you dont have none, click the green button that sais “Create the default ones”.

You should have a Ports template that comes by default.

Edit the template then attach the Port status up/down rule to that template

If you also want ifDescr in the template, just add (or edit) a new line with:
Port Descr: {{ $value['ifDescr'] }}

2 Likes

Thank you so much for your help. :slight_smile:

I did everything you said, but only get “Alert for device switch003.local - Port status up/down” on transport.

====================================

Component Version
LibreNMS 1.66-41-g73b7636c9
DB Schema 2020_07_29_143221_add_device_perf_index (172)
PHP 7.2.24-0ubuntu0.18.04.6
Python 3.6.9
MySQL 10.1.44-MariaDB-0ubuntu0.18.04.1
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 1.10.10
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

What transport are you using? What you get is the tittle, but is missing the body.

1 Like

SMS web API. I’m adding {{ $msg }} to transport. Thank you.

Remember SMSs have a text limitation, so you can end sending 4 or 5 SMSs for each notification.

I suggest you to edit the template so you get just the needed info.

1 Like

I’ll keep this in my mind. Thank you so much.

I applied the exact template

but i m Port Status I get blank space

can u suggest?