Custom Alert for port status change (for a specific VLAN)

Tags: #<Tag:0x00007f84b20918a0>

Hello,

Is it possible to setup a custom alert that will fire if a port status on a monitored switch changes to UP and it is only part of a specific VLAN? I only want to be alerted when something gets plugged into a port that is part of this particular VLAN. I have tried a combination of different syntax for alerting to get this to work, but it does not appear to fire an alert.

Anyone know how the rule should be built to get this to work correctly?

Thanks.

I’m pretty sure this is possible, but I cannot tell you how, off the top of my head. Combining ports and ports_vlans tables should get you there. Most people miss the fact that you can reference other table fields to compare them aka ports.port_id = ports_vlans.port_id by enclosing the field in backticks `


Would it look something like this?


I thought the rule could be something as simple as this, but it doesn’t seem to work.

You are checking if a port with vlan 1 is up, not if vlan 1 is up. Ports and VLANs do not exist in the logical space within switches.

When you say “for a specific VLAN” what do you mean? A port can have many vlans. Individual VLANs cannot go up/down on a port, only the port can go up/down.

“You are checking if a port with vlan 1 is up, not if vlan 1 is up.” - This is basically what I want to do.

To be a little more specific… VLAN 1 was just an example. Let’s say I have a port that is an untagged/access port for VLAN 10 (or native VLAN 10). How can I setup a custom alert to let me know when something is plugged into a port that has those specific parameters?

Ex: I want a LibreNMS alert to fire if a port status changes to UP… ONLY if is an untagged/access port for VLAN 10 (or native VLAN 10).

Your alert rule is correct, BUT unfortunately, not all OS fill in the ifVlan field. (I think it is mostly Cisco)

You may need to check the ports_vlans table (doing an outer join) where untagged =1.

The other option is try to update the OS port polling code for whatever device(s) you need to populate the ifVlan field.