mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
29 lines
814 B
Text
29 lines
814 B
Text
#
|
|
# RouterOS script: gps-track
|
|
# Copyright (c) 2018 Christian Hesse <mail@eworm.de>
|
|
#
|
|
# track gps data by sending json data to http server
|
|
|
|
:global "identity";
|
|
:global "gps-track-url";
|
|
|
|
:local gps [ / system gps monitor once as-value ];
|
|
|
|
if ($gps->"valid" = true) do={
|
|
:tool fetch mode=http \
|
|
url=$"gps-track-url" \
|
|
check-certificate=yes-without-crl \
|
|
keep-result=no \
|
|
http-method=post \
|
|
http-content-type="application/json" \
|
|
http-data=("{" . \
|
|
"\"lat\":\"" . ($gps->"latitude") . "\"," . \
|
|
"\"lon\":\"" . ($gps->"longitude") . "\"," . \
|
|
"\"identity\":\"" . $identity . "\"" . \
|
|
"}");
|
|
:log debug ("Sending GPS data for tracking: " . \
|
|
"lat: " . ($gps->"latitude") . " " . \
|
|
"lon: " . ($gps->"longitude"));
|
|
} else={
|
|
:log debug ("GPS data not valid.");
|
|
}
|