Skip to content

Commit

Permalink
Add Mikrotik ip dhcp-server lease print template (#1495)
Browse files Browse the repository at this point in the history
Co-authored-by: pskliarenko <“[email protected]”>
  • Loading branch information
PavloSkliarenko and pskliarenko authored Jul 22, 2024
1 parent 9c58c94 commit 8765b63
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions ntc_templates/templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ mikrotik_routeros_log_print_detail_without-paging.textfsm, .*, mikrotik_routeros
mikrotik_routeros_routing_bgp_peer_print_status.textfsm, .*, mikrotik_routeros, [[/]]r[[outing]] bg[[p]] p[[eer]] p[[rint]] s[[tatus]]
mikrotik_routeros_ip_arp_print_without-paging.textfsm, .*, mikrotik_routeros, [[/]]ip arp print without-paging
mikrotik_routeros_routing_ospf_neighbor_print.textfsm, .*, mikrotik_routeros, [[/]]r[[outing]] o[[spf]] nei[[ghbor]] p[[rint]]
mikrotik_routeros_ip_dhcp-server_lease_print.textfsm, .*, mikrotik_routeros, [[/]]ip dh[[cp-server]] l[[ease]] p[[rint]]
mikrotik_routeros_ip_address_export_verbose.textfsm, .*, mikrotik_routeros, [[/]]ip a[[ddress]] e[[xport]] [[verbose]]
mikrotik_routeros_interface_ethernet_print.textfsm, .*, mikrotik_routeros, [[/]]in[[terface]] et[[hernet]] pr[[int]]
mikrotik_routeros_ip_neighbor_print_detail.textfsm, .*, mikrotik_routeros, [[/]]ip n[[eighbor]] p[[rint]] d[[etail]]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Value NUMBER (\d+)
Value FLAGS ([XRDB]+)
Value ADDRESS (\S+)
Value MAC_ADDRESS ((?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})
Value HOST_NAME (\S+)
Value SERVER (\S+)
Value RATE_LIMIT (\S+)
Value STATUS (\S+)
Value LAST_SEEN (\S+)

Start
^\s*#\s+ADDRESS\s+MAC-ADDRESS\s+HOST-NAME\s+SERVER\s+RATE-LIMIT\s+STATUS\s+LAST-SEEN\s*$$ -> EntriesTable

EntriesTable
# Impossible to separate HOST-NAME and SERVER? Have the same regex, can be empty,
# are next to each other -> use '...print terse...' version of the command
^\s*${NUMBER}(?:\s+${FLAGS})?\s+${ADDRESS}(?:\s+${MAC_ADDRESS})?(?:\s+${HOST_NAME})?\s+${SERVER}(?:\s+${RATE_LIMIT})?\s+${STATUS}\s+${LAST_SEEN}\s*$$ -> Record
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Flags: X - disabled, R - radius, D - dynamic, B - blocked
# ADDRESS MAC-ADDRESS HOST-NAME SERVER RATE-LIMIT STATUS LAST-SEEN
0 192.168.60.254 *1 bound 35w13h13m15s
1 X 192.168.61.254 MikroTik DHCPv4_Server waiting never
1 192.168.62.254 12:34:56:78:90:AA DHCPv4_Server waiting never
2 D 192.168.88.254 12:34:56:78:90:AB MikroTik DHCPv4_Server waiting never
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
parsed_sample:
- address: "192.168.60.254"
flags: ""
host_name: ""
last_seen: "35w13h13m15s"
mac_address: ""
number: "0"
rate_limit: ""
server: "*1"
status: "bound"
- address: "192.168.61.254"
flags: "X"
host_name: "MikroTik"
last_seen: "never"
mac_address: ""
number: "1"
rate_limit: ""
server: "DHCPv4_Server"
status: "waiting"
- address: "192.168.62.254"
flags: ""
host_name: ""
last_seen: "never"
mac_address: "12:34:56:78:90:AA"
number: "1"
rate_limit: ""
server: "DHCPv4_Server"
status: "waiting"
- address: "192.168.88.254"
flags: "D"
host_name: "MikroTik"
last_seen: "never"
mac_address: "12:34:56:78:90:AB"
number: "2"
rate_limit: ""
server: "DHCPv4_Server"
status: "waiting"

0 comments on commit 8765b63

Please sign in to comment.