Показаны различия между двумя версиями страницы.
| Следующая версия | Предыдущая версия | ||
|
mikrotik:rb3011uias:routeros:system:scripts:state [2020/10/10 20:00] Николай Солошин создано |
mikrotik:rb3011uias:routeros:system:scripts:state [2022/02/12 11:40] (текущий) |
||
|---|---|---|---|
| Строка 93: | Строка 93: | ||
| ===== Код для импорта ===== | ===== Код для импорта ===== | ||
| - | 1 | + | <file rsc state.rsc>/ |
| + | add comment=" | ||
| + | \EE\FF\ED\E8\FF \F1\E8\F1\F2\E5\EC\FB \F7\E5\F0\E5\E7 SMS" \ | ||
| + | dont-require-permissions=no name=state owner=petya policy=\ | ||
| + | read, | ||
| + | shin.su) for RouterOS v6.46.3 on RB3011UiAS (arm) @ 2020.08\r\ | ||
| + | \n\r\ | ||
| + | \n:global sendEvent; | ||
| + | \n\r\ | ||
| + | \n:local cDate;\r\ | ||
| + | \n:local cTime;\r\ | ||
| + | \n:local idName; | ||
| + | \n:local bName;\r\ | ||
| + | \n:local utm;\r\ | ||
| + | \n:local ver;\r\ | ||
| + | \n:local fMem;\r\ | ||
| + | \n:local tMem;\r\ | ||
| + | \n:local fSpace; | ||
| + | \n:local tSpace; | ||
| + | \n:local cpu0arr; | ||
| + | \n:local cpu1arr; | ||
| + | \n:local uMem;\r\ | ||
| + | \n:local uSpace; | ||
| + | \n:local cpu0Load; | ||
| + | \n:local cpu0Disk; | ||
| + | \n:local cpu1Load; | ||
| + | \n:local cpu1Disk; | ||
| + | \n:local cpuAvr; | ||
| + | \n:local diskAvr; | ||
| + | \n\r\ | ||
| + | \n/system clock {\r\ | ||
| + | \n :set cDate [get date];\r\ | ||
| + | \n :set cTime [get time];\r\ | ||
| + | \n}\r\ | ||
| + | \n\r\ | ||
| + | \n/system identity {\r\ | ||
| + | \n :set idName [get name];\r\ | ||
| + | \n}\r\ | ||
| + | \n\r\ | ||
| + | \n/system resource {\r\ | ||
| + | \n :set bName [get board-name]; | ||
| + | \n :set utm [get uptime]; | ||
| + | \n :set ver [get version]; | ||
| + | \n :set fMem ([get free-memory]/ | ||
| + | \n :set tMem ([get total-memory]/ | ||
| + | \n :set fSpace ([get free-hdd-space]/ | ||
| + | \n :set tSpace ([get total-hdd-space]/ | ||
| + | \n}\r\ | ||
| + | \n\r\ | ||
| + | \n:set uMem (\$tMem-\$fMem); | ||
| + | \n:set uSpace (\$tSpace-\$fSpace); | ||
| + | \n\r\ | ||
| + | \n/system resource cpu {\r\ | ||
| + | \n :set cpu0arr [get 0];\r\ | ||
| + | \n :set cpu1arr [get 1];\r\ | ||
| + | \n}\r\ | ||
| + | \n\r\ | ||
| + | \n:set cpu0Load (\$cpu0arr -> \" | ||
| + | \n:set cpu1Load (\$cpu1arr -> \" | ||
| + | \n:set cpu0Disk (\$cpu0arr -> \" | ||
| + | \n:set cpu1Disk (\$cpu1arr -> \" | ||
| + | \n\r\ | ||
| + | \n:set cpuAvr ((\$cpu0Load+\$cpu1Load)/ | ||
| + | \n:set diskAvr ((\$cpu0Disk+\$cpu1Disk)/ | ||
| + | \n\r\ | ||
| + | \n:local txtMsg1 \" | ||
| + | nt time: \\\r\ | ||
| + | \n\$cDate \$cTime; | ||
| + | \n:local txtMsg2 \" | ||
| + | \\nHDD \\\r\ | ||
| + | \nused/ | ||
| + | VG \\\r\ | ||
| + | \n\$cpuAvr/ | ||
| + | 1Disk).\"; | ||
| + | \n\r\ | ||
| + | \n\$sendEvent mode=sms msg=\$txtMsg1; | ||
| + | \n\$sendEvent mode=sms msg=\$txtMsg2; | ||
| + | \n\r\ | ||
| + | \n# With love from Vladivostok."</ | ||
| ===== Запуск скрипта ===== | ===== Запуск скрипта ===== | ||
| - | 1 | + | Скрипт запускается через SMS на номер модема с синтаксисом '': |
| + | |||
| + | ==== Пример ответных SMS ==== | ||
| + | |||
| + | < | ||
| + | Current time: oct/10/2020 19:51:32; | ||
| + | Uptime: 11w6d02: | ||
| + | |||
| + | < | ||
| + | HDD used/free: 41/87 MiB (total 128); | ||
| + | CPU load/disk: AVG 4/0% (cp0 - 1/0, cp1 - 7/ | ||
| ==== Политики запуска ==== | ==== Политики запуска ==== | ||