Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GR-IX
bird-route-server-stats
Commits
6180d920
Commit
6180d920
authored
Jul 29, 2021
by
root
Browse files
Birdseye API did not respond appropriately sometimes -> sleep and retry approach was included
parent
57c1c369
Changes
1
Hide whitespace changes
Inline
Side-by-side
route_server_stats_class.py
View file @
6180d920
...
...
@@ -75,6 +75,10 @@ class Route_Server_stat:
else
:
requested_large_community_url
=
"http://"
+
str
(
self
.
rs
)
+
"/api/routes/count/lc-zwild/protocol/"
+
str
(
peer
)
+
expand_community_tuple_to_rest
(
large_community
)
requested_large_community_response
=
requests
.
get
(
url
=
requested_large_community_url
)
# if we do not get a proper response from Birdseye, we sleep and retry
while
(
requested_large_community_response
.
status_code
!=
200
):
sleep
(
3
)
requested_large_community_response
=
requests
.
get
(
url
=
requested_large_community_url
)
requested_large_community_response
=
requested_large_community_response
.
json
()[
"count"
][
"routes"
]
routes_counter
=
routes_counter
+
int
(
requested_large_community_response
)
#print(eval(str(large_community)),routes_counter)
...
...
@@ -121,7 +125,7 @@ except (Exception, e):
current_time
=
datetime
.
utcnow
().
strftime
(
'%Y-%m-%dT%H:%M:%SZ'
)
print
(
current_time
)
# IPv4 + IPv6 Route Server stats, we handle each RS instance (IPv4, IPv6) as a different RS
Route_Servers
=
[
"
rsx-vlan505-ipv4.gr-ix.gr"
,
"
rs1-vlan505-ipv4.gr-ix.gr"
,
"rs0-vlan505-ipv4.gr-ix.gr"
,
"rs0-vlan400-ipv4.thess.gr-ix.gr"
,
"rs1-vlan400-ipv4.thess.gr-ix.gr"
]
+
[
"rs1-vlan505-ipv6.gr-ix.gr"
,
"rs0-vlan505-ipv6.gr-ix.gr"
,
"rs0-vlan400-ipv6.thess.gr-ix.gr"
,
"rs1-vlan400-ipv6.thess.gr-ix.gr"
]
Route_Servers
=
[
"rs1-vlan505-ipv4.gr-ix.gr"
,
"rs0-vlan505-ipv4.gr-ix.gr"
,
"rs0-vlan400-ipv4.thess.gr-ix.gr"
,
"rs1-vlan400-ipv4.thess.gr-ix.gr"
]
+
[
"rs1-vlan505-ipv6.gr-ix.gr"
,
"rs0-vlan505-ipv6.gr-ix.gr"
,
"rs0-vlan400-ipv6.thess.gr-ix.gr"
,
"rs1-vlan400-ipv6.thess.gr-ix.gr"
]
for
rs
in
Route_Servers
:
rs_class
=
Route_Server_stat
(
rs
)
input_to_influx
=
[{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment