From 377b77dc8059c08bc6cc31681f1065eacddb0281 Mon Sep 17 00:00:00 2001 From: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com> Date: Tue, 11 Dec 2018 05:20:53 +0100 Subject: [PATCH] feature: Macros for xDP neighbours alert rules (#9531) * Macros for xDP devices * Documentation for macros.port_has_xdp_neighbours * Stupid typo while renaming macro port_has_xdp_neighbours_device --- doc/Alerting/Macros.md | 16 ++++++++++++++++ misc/macros.json | 2 ++ 2 files changed, 18 insertions(+) diff --git a/doc/Alerting/Macros.md b/doc/Alerting/Macros.md index 14ae005911..687a6646a5 100644 --- a/doc/Alerting/Macros.md +++ b/doc/Alerting/Macros.md @@ -168,6 +168,22 @@ Description: Ports that were previously up and have now gone down. Example: `macros.port_now_down = 1` +### Port has xDP neighbour (Boolean) + +Entity: `%macros.port AND %links.local_port_id = %ports.port_id` + +Description: Ports that have an xDP (lldp, cdp, etc) neighbour. + +Example: `macros.port_has_xdp_neighbours = 1` + +### Port has xDP neighbour already known in LibreNMS (Boolean) + +Entity: `%macros.port_has_neighbours AND (%links.remote_port_id IS NOT NULL)` + +Description: Ports that have an xDP (lldp, cdp, etc) neighbour that is already known in libreNMS. + +Example: `macros.port_has_xdp_neighbours_device = 1` + ### Device component down [JunOS] Entity: `sensors.sensor_class = "state" AND sensors.sensor_current != "6" AND sensors.sensor_type = "jnxFruState" AND sensors.sensor_current != "2"` diff --git a/misc/macros.json b/misc/macros.json index 7f7968d21d..72adff3e8d 100644 --- a/misc/macros.json +++ b/misc/macros.json @@ -25,6 +25,8 @@ "port_in_usage_perc": "((%ports.ifInOctets_rate*8) \/ %ports.ifSpeed)*100", "port_out_usage_perc": "((%ports.ifOutOctets_rate*8) \/ %ports.ifSpeed)*100", "port_now_down": "%ports.ifOperStatus != %ports.ifOperStatus_prev && %ports.ifOperStatus_prev = \"up\" && %ports.ifAdminStatus = \"up\" && %macros.port", + "port_has_xdp_neighbours": "(%macros.port && %links.local_port_id = %ports.port_id)", + "port_has_xdp_neighbours_device": "(%macros.port_has_xdp_neighbours && %links.remote_port_id IS NOT NULL)", "pdu_over_amperage_apc": "%sensors.sensor_class = \"current\" && %sensors.sensor_descr = \"Bank Total\" && %sensors.sensor_current > %sensors.sensor_limit && %devices.os = \"apc\"", "sensor": "(%sensors.sensor_alert = 1)", "sensor_port_link": "(%sensors.entPhysicalIndex_measured = 'ports' && %sensors.entPhysicalIndex = %ports.ifIndex && %macros.port_up)",