-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathsend-leases-to-activemq.rsc
22 lines (20 loc) · 1.23 KB
/
send-leases-to-activemq.rsc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#-------------------------------------------------------------------------------
# MikroTik RouterOS Send Leases to ActiveMQ
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Settings
#-------------------------------------------------------------------------------
:local ACTIVEMQHOST "activemq.tld"
:local ACTIVEMQPORT 8161
:local ACTIVEMQUSER "admin"
:local ACTIVEMQPASSWORD "admin"
:local ACTIVEMQTOPIC "leases"
#-------------------------------------------------------------------------------
# Send Leases to ActiveMQ
#-------------------------------------------------------------------------------
:local url "http://$ACTIVEMQHOST:$ACTIVEMQPORT/api/message/$ACTIVEMQTOPIC"
:local date [/system clock get date]
:local time [/system clock get time]
:local systemIdentity [/system identity get name]
:local message "{\"date\":\"$date\",\"time\":\"$time\",\"systemIdentity\":\"$systemIdentity\",\"bound\":$leaseBound,\"serverName\":\"$leaseServerName\",\"mac\":\"$leaseActMAC\",\"ip\":\"$leaseActIP\"}"
/tool fetch url="$url" http-method="post" user="$ACTIVEMQUSER" password="$ACTIVEMQPASSWORD" http-data="body=$message" keep-result="no"