-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCAPsMAN_Interfaces_Count.rsc
41 lines (30 loc) · 1.14 KB
/
CAPsMAN_Interfaces_Count.rsc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# RouterOS Script
# Copyright (c) Grzegorz Budny
# Version 1.0
# Last update: 2/8/2020
# Makes a full copy to file all defined CAPsMAN interfaces.
# Script must be run on primary CAPsMAN in your environment.
:global capIntCount;
:local fileName "int_number.txt";
:local intFileName caps_int.rsc;
:local smtpServer #smtp server IP
:local smtpPort #smtp port
:local from #sender email
:local to #recipients email
:local cc #cc email
:local subject "Interfaces Sync Notification"
:local body "CAPsMAN Ready for Interfaces Sync Process"
:log info "..::Interfaces count and export started::..";
:set capIntCount [/caps-man interface print count-only];
:if ([:len [/file find name=$fileName]] <= 0) do={
:log info "File not found, creating file";
file print file=$fileName;
}
:if ([:len [/file find name=$fileName]] > 0) do={
:log info "File found";
file set $fileName contents=$capIntCount;
}
:log info "..::Exporting Interfaces";
caps-man interface export file=$intFileName;
:log info "..::Interfaces count and export finished::..";
tool e-mail send server=$smtpServer port=$smtpPort from=$from to=$to cc=$cc subject=$subject body=$body;