السلام عليكم ورحمة الله تعالي وبركاته
موضوع انهارده جديد والحمد لله وصلتله بعد بحث كتير وناس كتير كانت عايزاه الا وهو انا لو عندي روتر بورد ازاي ادخل عليه من اي مكان او لو عندي كيسه الموضوع هيكون صعب ...بس احنا هنستخدم موقع من خلاله هتقدر تشوف الميكروتك شغال ولا لا وتشوف عدد العملا اللي فاتحين ومميزات تانيه كتير والمفاجاه زي مقولنا هي سهولة الطريقه ومش هنكلفك بأي بي ثابت او الكلام دا
نبدأ الطريقه ....
هتفتح system ثم scripts وتعمل اضافه
موضوع انهارده جديد والحمد لله وصلتله بعد بحث كتير وناس كتير كانت عايزاه الا وهو انا لو عندي روتر بورد ازاي ادخل عليه من اي مكان او لو عندي كيسه الموضوع هيكون صعب ...بس احنا هنستخدم موقع من خلاله هتقدر تشوف الميكروتك شغال ولا لا وتشوف عدد العملا اللي فاتحين ومميزات تانيه كتير والمفاجاه زي مقولنا هي سهولة الطريقه ومش هنكلفك بأي بي ثابت او الكلام دا
نبدأ الطريقه ....
هتفتح system ثم scripts وتعمل اضافه
زي اللي في الصوره كدا وهتضيف الاسكربتscriptي
متنساش تغيى كروت الدخل والخرج في الاسكربت
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
#
# MikroTik RouterOS Script
# This script has two parts: 1) RouterOS statistics collector 2) Push router stats up to dweet.io
#
# This script can be adapted to send the collected statistics to any NMS system that supports
# receiving data via http get/post requests.
#
# Tested on RouterOS v6.40.3
# Learn more about this script and dweet.io by reading...
# http://jcutrer.com/howto/networking/mikrotik/mikrotik-script-dweet-io-stats
#
# Script Revision: 1.0.2
# Author Name: Jonathan Cutrer
# Author URL: http://jcutrer.com
#
# Change Log
#
# 1.0.2 Reworked stats collection in groups, you can turn each on/off below
# Changed dweet.io call to use SSL (https://)
# Added VPN stats collection
# Added Health stats collection
# Added Routing Protocol stats collection
#
# 1.0.1 Added keep-result=no to last line
#
# 1.0.0 Initial Release
#
#
# Begin Setup
#
:local interfaceWAN "ether1";
:local interfaceWLAN "wlan1";
:local interfaceWLANGuest "wlan2";
:local prefix "mikrotik-stats";
:local dweetURL "https://dweet.io/dweet/for/";
:local dataParams;
#
# Collection Groups
# Define what gets groups of statistics get collected and sent
#
:local enBoard true
:local enPerf true
:local enHealth true
:local enRouter true
:local enRouting true
:local enFirewall true
:local enWireless true
:local enVPN true
#
# End Setup
#
# Collect Stats: Board
#
:local boardData; :local identity; :local model; :local serial;
if ( $enBoard ) do={
:put "Collecting Board data..."
:set identity [/system identity get name];
:set model [/system routerboard get model];
:set serial [/system routerboard get serial-number];
:setboardData "identity=$identity&model=$model&serial=$serial"
:set dataParams $boardData;
}
# Set the thing name
:local thing "$prefix-$serial"
#
# Collect Stats: Perf
#
:local perfData; :local cpuLoad; :local memFree; :local uptime;
if ( $enPerf ) do={
:put "Collecting Performance data..."
:delay 5
:set cpuLoad [/system resource get cpu-load];
:set memFree [/system resource get free-memory];
:set uptime [/system resource get uptime];
:set perfData "cpu-load=$cpuLoad&uptime=$uptime&mem-free=$memFree"
:set dataParams ( $dataParams . "&" . $perfData);
}
#
# Collect Stats: Health
#
:local healthData; :local volts; :local amps; :local watts;:local temp; :local cpuTemp; :local fanSpeed;
if ( $enHealth ) do={
:put "Collecting Health data..."
:set volts [/system health get voltage];
:set amps [/system health get current];
:set watts [/system health get power-consumption];
:set temp [/system health get temperature];
:set cpuTemp [/system health get cpu-temperature];
:set fanSpeed [/system health get fan1-speed];
:set healthData"volts=$volts&s=$amps&watts=$watts&temp=$temp&cpu-temp=$cpuTemp&fan-speed=$fanSpeed"
:set dataParams ( $dataParams . "&" . $healthData);
}
#
# Collect Stats: Router
#
:local routerData; :local ipRoutes;
if ( $enRouter ) do={
:put "Collecting Router data..."
:set ipRoutes [:len [/ip route find]];
:set routerData "ip-routes=$ipRoutes"
:set dataParams ( $dataParams . "&" . $routerData);
}
#
# Collect Stats: Routing
#
:local routingData; :local bgpPeers; :local ospfNeighbors;
if ( $enRouting ) do={
: put "Collecting Routing Protocol data..." ;
:set bgpPeers [:len [/routing bgp peer find]];
:set ospfNeighbors [:len [/routing ospf neighbor find]];
:set routingData "bgp-peers=$bgpPeers&ospf-neighbors=$ospfNeighbors";
:set dataParams ( $dataParams . "&" . $routingData);
}
#
# Collect Stats: Wireless
#
:local wirelessData; :local wlanClients; :local wlanGuests;
if ( $enWireless ) do={
:put "Collecting Wireless data...";
:set wlanClients [/interface wireless registration-tableprint count-only where interface="$interfaceWLAN"];
:set wlanGuests [/interface wireless registration-table printcount-only where interface="$interfaceWLANGuest"];
:set wirelessData "wlan-clients=$wlanClients&wlan-guests=$wlanGuests";
:set dataParams ( $dataParams . "&" . $wirelessData);
}
#
# Collect Stats: Firewall
#
:local firewallData; :local ipFwConx;
if ( $enFirewall ) do={
:put "Collecting Firewall data...";
:set ipFwConx [/ip firewall connection tracking get total-entries];
:set firewallData "ip-fw-conx=$ipFwConx";
:set dataParams ( $dataParams . "&" . $firewallData);
}
#
# Collect Stats: VPN
#
:local vpnData; :local vpnPppConx; :local vpnIpsecPeers; :localvpnIpsecPolicy;
if ( $enFirewall ) do={
:put "Collecting VPN data...";
:set vpnPppConx [:len [/ppp active find]];
:set vpnIpsecPeers [:len [/ip ipsec remote-peers find]];
:set vpnIpsecPolicy [:len [/ip ipsec policy find]];
:set vpnData "vpn-ppp-conx=$vpnPppConx&vpn-ipsec-peers=$vpnIpsecPeers&vpn-ipsec-policys=$vpnIpsecPolicy";
:set dataParams ( $dataParams . "&" . $vpnData);
}
#
# Test Output of Collected Data
#
:put $boardData
:put $perfData
:put $healthData
:put $routerData
:put $routingData
:put $wirelessData
:put $firewallData
:put $vpnData
#
# Build the Final Request URL
#
:local finalURL;
:set finalURL "$dweetURL$thing?$dataParams"
# print the final url
:put $finalURL
#
# Push data to dweet.io
#
/tool fetch url="$finalURL" mode=https keep-result=no
|





0 تعليقات