NOC:ctwug updated
From CTWUG Wiki
Purpose
- This script builds an http get request from the routerboard identity and serial number.
- Example Request: http://noc.ctwug.za.net/web/api/update?id=Dade-RB1&serial=205E01E11CB3&update=1
My guess is that this script tells the NOC system that the RB making the request is alive and well.
It probably stores the identity, serialnumber and remote address with a timestamp in a database.
This script is scheduled to run every hour.
Dependencies
- http://noc.ctwug.za.net/web/api/update must be accepting requests.
Script
:local fid [/system identity get name]
:local fserial [/system routerboard get serial-number]
:local ffile "ctwug_version.rsc"
:local fpath ("web/api/update?id=".$fid."&serial=".$fserial."&update=1")
:local fpath2 $fpath
:local fpath ""
:for i from=0 to=( [:len $fpath2] - 1) do={
:local fchar [:pick $fpath2 $i]
:if ( $fchar = " ") do={
:set fchar "%20"
}
:set fpath ($fpath.$fchar)
}
/tool fetch host=noc.ctwug.za.net address=noc.ctwug.za.net src-path=$fpath dst-path=$ffile mode=http
:delay 1
:log info [/file get $ffile contents]