alice-lg / birdwatcher Goto Github PK
View Code? Open in Web Editor NEWA JSON API for BIRD
License: BSD 3-Clause "New" or "Revised" License
A JSON API for BIRD
License: BSD 3-Clause "New" or "Revised" License
I would propose to use bird's socket interface instead of spawning birdc.
The protocol is almost the the same as the stdout of birdc.
There is already a golang package for it: https://github.com/czerwonk/bird_socket
We gain:
We loose:
birdc -r
)Hapens with Go 1.14 (can build it manually) and 1.10
# go get github.com/alice-lg/birdwatcher
# github.com/alice-lg/birdwatcher/bird
go/src/github.com/alice-lg/birdwatcher/bird/redis_cache.go:25:23: not enough arguments in call to client.cmdable.Ping
have ()
want (context.Context)
go/src/github.com/alice-lg/birdwatcher/bird/redis_cache.go:39:30: not enough arguments in call to self.client.cmdable.Get
have (string)
want (context.Context, string)
go/src/github.com/alice-lg/birdwatcher/bird/redis_cache.go:71:27: not enough arguments in call to self.client.cmdable.Set
have (string, []byte, time.Duration)
want (context.Context, string, interface {}, time.Duration)
Hi,
I was wondering whether there is any possibility to have birdwatcher check inet-vpn unicast routes with a specific route target in BIRD.
I could not find anything in the code or in the documentation, but I think it might be possible with some minor changes. Is there any support planned for this, or is there maybe someone who played with the same thought?
Cheers
Markus
Currently birdwatcher parses interface names via the \w
regex character class.
However Linux seems to be much more flexible in regards to interface names:
https://unix.stackexchange.com/questions/451368/allowed-chars-in-linux-network-interface-names
Line 86 in b7d8845
I want to use birdwatcher to get Local Capabilities and Neighbor Capabilities from BIRDv2.0.7 via API. However, as shown below, both Capabilities are not in output.
“BXXX_XXX_XXX_XXX”: {
"action": "restart",
"af_announced": "ipv4",
"bgp_next_hop": “XXX.XXX.XXX.XXX”,
"bgp_state": "Established",
"bird_protocol": "BGP",
"connection": "Established",
"description": “XXXXXX”,
"hold_timer": “30/30",
"input_filter": “XXXXXXX”,
"keepalive_timer": "1/10",
"local_as": XXXXX,
"neighbor_address": “XXX”.XXX.XXX.XXX,
"neighbor_as": XXXXXX,
"neighbor_id": “XXX.XXX.XXX.XXX”,
"output_filter": "",
"preference": 100,
:
:
go get github.com/alice-lg/birdwatcher
go/src/github.com/alice-lg/birdwatcher/bird/bird.go:31: undefined: sync.Map
how can i fix this? any software missing?
Does birdwatcher support both Bird v1 and v2?
I am a bit confused. The README does not mention it.. Same for the alice-lg frontend.
Seems like the IX users DECIX and ECIX are both running Bird v1.6.3
-- Logs begin at Sat 2019-12-28 09:50:05 CET. --
déc. 28 18:06:45 edge1 birdwatcher[12824]: panic: interface conversion: interface {} is nil, not string
déc. 28 18:06:45 edge1 birdwatcher[12824]: goroutine 33 [running]:
déc. 28 18:06:45 edge1 birdwatcher[12824]: github.com/alice-lg/birdwatcher/bird.parseRouteLines(0xc000166400, 0x12, 0x20, 0x3, 0xc00005e180)
déc. 28 18:06:45 edge1 birdwatcher[12824]: /root/go/src/github.com/alice-lg/birdwatcher/bird/parser.go:329 +0xf4c
déc. 28 18:06:45 edge1 birdwatcher[12824]: github.com/alice-lg/birdwatcher/bird.workerForRouteBlockParsing(0xc00005e120, 0xc00005e180, 0xc00007a000)
déc. 28 18:06:45 edge1 birdwatcher[12824]: /root/go/src/github.com/alice-lg/birdwatcher/bird/parser.go:307 +0x73
déc. 28 18:06:45 edge1 birdwatcher[12824]: created by github.com/alice-lg/birdwatcher/bird.startRouteWorkers.func1
déc. 28 18:06:45 edge1 birdwatcher[12824]: /root/go/src/github.com/alice-lg/birdwatcher/bird/parser.go:265 +0x60
déc. 28 18:06:45 edge1 systemd[1]: birdwatcher4.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
déc. 28 18:06:45 edge1 systemd[1]: birdwatcher4.service: Failed with result 'exit-code'.
I have a bird instance with one routing table containing ~800k routes. When using birdwatcher to scrape these routes it uses ~8 Gigabytes of RAM. That seems a little much to me..
Bird, which also holds all the data, is using less than 200 Megabytes of memory.
bird:
$ pmap 2080 | tail -n 1 | awk '/[0-9]K/{print $2}'
178672K
birdwatcher:
$ pmap 9470 | tail -n 1 | awk '/[0-9]K/{print $2}'
8245008K
Is there a way to reduce the memory footprint of birdwatcher?
birdwatcher (v4) is bailing out with the following messages:
[ ... ]
172.18.20.3 - - [12/Mar/2021:22:50:31 +0100] "GET //routes/table/master HTTP/1.1" 301 55
panic: interface conversion: interface {} is nil, not string
goroutine 31 [running]:
github.com/alice-lg/birdwatcher/bird.parseRouteLines(0x9080400, 0xf, 0x10, 0x4, 0x92d21c0)
/home/weiti/go/src/github.com/alice-lg/birdwatcher/bird/parser.go:335 +0xe09
github.com/alice-lg/birdwatcher/bird.workerForRouteBlockParsing(0x92d2180, 0x92d21c0, 0x930c330)
/home/weiti/go/src/github.com/alice-lg/birdwatcher/bird/parser.go:313 +0x87
created by github.com/alice-lg/birdwatcher/bird.startRouteWorkers.func1
/home/weiti/go/src/github.com/alice-lg/birdwatcher/bird/parser.go:271 +0x4b
the v6 version is running without issues.
Hi,
I found an issue that current birdwatcher can't parse "protocol" for BIRDv2 which run with both IPv4 and IPv6. When I curl to /protocols/bgp
, then I could get routes count for IPv4 protocol but couldn't get it for IPv6 like follows:
{
...
"protocols": {
"B2001_db8__101": {
"af_announced": "ipv6",
"bgp_state": "Established",
"bird_protocol": "BGP",
"connection": "Established",
"description": "TEST_PEER_1",
"hold_timer": "73.180/90",
"keepalive_timer": "1.859/30",
"local_as": 65100,
"neighbor_address": "2001:db8::101",
"neighbor_as": 65001,
"neighbor_id": "10.0.0.101",
"protocol": "B2001_db8__101",
"route_changes": {},
"routes": {
"accepted": 0,
"exported": 0,
"filtered": 0,
"imported": 0,
"preferred": 0
},
"session": "external route-server AS4",
"source_address": "2001:db8:7:1::211",
"state": "up",
"state_changed": "2020-02-23 18:37:40",
"table": "---"
}
}
}
https://github.com/alice-lg/birdwatcher/blob/master/bird/parser.go#L539
To my understanding, this line cause the issue.
The function isCorrectChannel()
always returns false while parsing lines following "Channel ipv6"
in result of show protocols all B2001_db8__101
, because bird.IPVersion
is set as "4"
.
Hi, we are running bird2.0.7 in a single daemon supporting both ipv4 and ipv6.
We have found that birdwatcher works well with our installation with just one exception - /protocols/bgp does not return any route summary data for IPv6 sessions.
We have tracked it down to bird/parser.go's isCorrectChannel function which appears to only support either v4 or v6 but not both in the same instance.
Is there any way to work around this issue?
Cheers
Housekeeping started
Expiring MemoryCache
Expired 0 entries (MemoryCache)
Freeing memory
192.168.1.70 - - [23/Jul/2019:07:11:55 +0000] "GET /protocols HTTP/1.1" 200 819
192.168.1.70 - - [23/Jul/2019:07:12:02 +0000] "GET /protocols HTTP/1.1" 200 818
192.168.1.70 - - [23/Jul/2019:07:12:02 +0000] "GET /status HTTP/1.1" 200 317
192.168.1.70 - - [23/Jul/2019:07:12:10 +0000] "GET /protocols HTTP/1.1" 200 818
192.168.1.70 - - [23/Jul/2019:07:12:02 +0000] "GET /routes/peer/192.168.1.251 HTTP/1.1" 200 19704766
192.168.1.70 - - [23/Jul/2019:07:12:37 +0000] "GET /protocols HTTP/1.1" 200 818
192.168.1.70 - - [23/Jul/2019:07:12:37 +0000] "GET /routes/filtered/AS65535 HTTP/1.1" 200 172
192.168.1.70 - - [23/Jul/2019:07:12:40 +0000] "GET /protocols HTTP/1.1" 200 818
192.168.1.70 - - [23/Jul/2019:07:12:40 +0000] "GET /routes/peer/192.168.1.251 HTTP/1.1" 500 28
Killed
possible because view of full table?
The command go get github.com/alice-lg/birdwatcher
in README is now deprecated as stated in Deprecation of 'go get' for installing executables.
Please consider changing it to go install github.com/alice-lg/birdwatcher@latest
Hi, I have two routes in BIRD's RIB, one for v4 prefix 10.1.1.0/24
and one for v6 prefix 2001:db8:3c4d::/48
.
I am using birdwatcher's route_net
endpoint, and specifically:
r.GET("/route/net/:net", endpoints.Endpoint(endpoints.RouteNet))
I have two questions:
/route/net/10.1.1.0
Is there a way to query with the netmask?
:
format. Do you have a practical example of a working v6 query?/route/net/2001:db8:3c4d::
Same question about the netmask too, as long as v6 works of course.
I have created a GitHub Action for birdwatcher that builds it for CentOS 7 and packages the RPM. It is at a proof of concept stage and could be improved. For example it uses a CentOS 7 Docker image for build that I baked, so it takes quite a long time to prepare that image every run. The fork is at https://github.com/bluikko/birdwatcher/tree/github-action-rpm
I believe that building birdwatcher RPMs (and Alice-LG Docker images) automatically would be very useful for the users of Alice-LG and birdwatcher.
There were two issues after I tested the resulting RPM:
/etc/birdwatcher/birdwatcher.conf
has execute bits. I am not sure if this is because of my build system - it is my first time using GitHub Actions and fpm. Has anyone else noticed this?install/systemd
directory in the repository. I reckon one issue with packaging these is whether the BIRD version is 1 or 2 - so should the IPv6 birdwatcher unit file be included.Hi
there seems to be no tag for birdwatcher v2.2.5 under
https://github.com/alice-lg/birdwatcher/tags
but it clearly shows it in the changelog.
https://github.com/alice-lg/birdwatcher/blob/master/CHANGELOG
My systems team want to autobuild from https://github.com/alice-lg/birdwatcher/tags but able to do so.
Can this be fixed ?
Thanks
Mo
Hello,
I'm seeing errors in the installation of birdwatcher.
Step 6/18 : RUN go get github.com/alice-lg/birdwatcher
---> Running in f2c2b211a6fb
cannot find package "go.opentelemetry.io/otel/label" in any of:
/usr/local/go/src/go.opentelemetry.io/otel/label (from $GOROOT)
/root/go/src/go.opentelemetry.io/otel/label (from $GOPATH)
I see that 9 days ago something changed in opentelemetry-go: open-telemetry/opentelemetry-go@ecf65d7
- Renamed the
otel/label
package tootel/attribute
. (#1541)
Sorry for filing an issue and not a PR to fix it, but at the moment I have zero knowledge of Go.
Hello,
Thank you for the job.
We would like to be able to disable TLS v1.0 and v1.1 and maybe use stronger Ciphers than the default ones.
It does not seem to be configurable.
I am not a developer that is why I cannot affirm anything.
I think the TLS configuration for Birdwatcher is using this package: https://pkg.go.dev/crypto/tls
If it is the case, it should be possible to implement this ability.
Thanks in advance for any feedback.
Build using Dockerfile of latest repo causes following result:
[+] Building 1.6s (4/4) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 588B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/ehlers/bird2:latest 1.4s
=> CANCELED [internal] load metadata for docker.io/library/golang:1.13 1.5s
------
> [internal] load metadata for docker.io/ehlers/bird2:latest:
------
Dockerfile:21
--------------------
19 |
20 | # Add birdwatcher to bird
21 | >>> FROM ehlers/bird2
22 |
23 | COPY --from=app /src/birdwatcher/birdwatcher-linux-amd64 /usr/bin/birdwatcher
--------------------
ERROR: failed to solve: ehlers/bird2: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
I have checked in docker hub - ehlers/bird2 really is absent.
github.com/tonnerre/golang-pretty v0.0.0-20130925195953-e7fccc03e91b
https://www.github.com/tonnerre/golang-pretty doesnt exist anymore, is there a working alternative that can be used?
Apparently this happens - need to check.
Hi,
where I can find the whole endpoints list?
I could not find it anywhere!
Many thanks for your incredible work!
Jan 28 16:52:05 rs1 birdwatcher[485554]: panic: interface conversion: interface {} is nil, not string
Jan 28 16:52:05 rs1 birdwatcher[485554]: goroutine 33 [running]:
Jan 28 16:52:05 rs1 birdwatcher[485554]: github.com/alice-lg/birdwatcher/bird.parseRouteLines(0xc000126400, 0x12, 0x20, 0x75, 0xc000060180)
Jan 28 16:52:05 rs1 birdwatcher[485554]: #11/root/go/pkg/mod/github.com/alice-lg/[email protected]/bird/parser.go:335 +0x1089
Jan 28 16:52:05 rs1 birdwatcher[485554]: github.com/alice-lg/birdwatcher/bird.workerForRouteBlockParsing(0xc000060120, 0xc000060180, 0xc0002a60c0)
Jan 28 16:52:05 rs1 birdwatcher[485554]: #11/root/go/pkg/mod/github.com/alice-lg/[email protected]/bird/parser.go:313 +0x73
Jan 28 16:52:05 rs1 birdwatcher[485554]: created by github.com/alice-lg/birdwatcher/bird.startRouteWorkers.func1
Jan 28 16:52:05 rs1 birdwatcher[485554]: #11/root/go/pkg/mod/github.com/alice-lg/[email protected]/bird/parser.go:271 +0x65
Jan 28 16:52:05 rs1 systemd[1]: birdwatcher6.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jan 28 16:52:05 rs1 systemd[1]: birdwatcher6.service: Failed with result 'exit-code'.
is there any howto for linux debian?
current version; go version go1.11.6 linux/amd64
if run make:
GOARCH=amd64 GOOS=linux go build -o birdwatcher-linux-amd64
# _/usr/src/birdwatcher
./birdwatcher.go:36:38: cannot use endpoints.Version(VERSION) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:37:38: cannot use endpoints.Endpoint(endpoints.Status) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:40:41: cannot use endpoints.Endpoint(endpoints.Protocols) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:43:45: cannot use endpoints.Endpoint(endpoints.Bgp) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:46:47: cannot use endpoints.Endpoint(endpoints.ProtocolsShort) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:49:39: cannot use endpoints.Endpoint(endpoints.Symbols) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:52:46: cannot use endpoints.Endpoint(endpoints.SymbolTables) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:55:49: cannot use endpoints.Endpoint(endpoints.SymbolProtocols) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:58:57: cannot use endpoints.Endpoint(endpoints.ProtoRoutes) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:61:49: cannot use endpoints.Endpoint(endpoints.PeerRoutes) (type "github.com/alice-lg/birdwatcher/vendor/github.com/julienschmidt/httprouter".Handle) as type "github.com/julienschmidt/httprouter".Handle in argument to r.GET
./birdwatcher.go:61:49: too many errors
make: *** [Makefile:37: linux] Error 2
allow_from = ["10.0.0.0/8"] doesnt work, it looks like cidr notation is not supported :(
Hi guys,
When running the URL to see the routes for a specific peer I don't receive anything from birdwatcher:
[email protected]:/root# curl http://103.247.138.73:29184//routes/protocol/103.247.139.24
Moved Permanently.
When checking the raw output in my browser I see nothing in the array:
{"api":{"Version":"2.0.0","result_from_cache":false,"cache_status":{"cached_at":{"date":"2020-12-25T15:43:33.356887066Z","timezone_type":"UTC","timezone":"UTC"}}},"cached_at":"2020-12-25T15:43:33.356887066Z","routes":[],"ttl":"2020-12-25T15:53:33.356887066Z"}
Do you know why this happens? We run Bird 1.6.8 and the latest version of birdwatcher (but same issue was happening in the previous version).
Thank's
Stavros
Hello,
Recently one of our route servers crashed and we had to do a migration to another server. We have set up everything correctly and in the process upgraded Bird to 2.14 from 1.6.8 . We have the IXP Manager internal looking glass working fine but somehow Alice-LG does not seem to connect to the new installation. Birdwatcher cannot find bird on the new server and so shows "Bird Uncreachable" errors all the time. We have tried multiple birdwatcher versions and also trying to use previously working versions without success.. Anyway to debug what the issue is?
Logs as below:
root@ip-172-31-14-139:~# curl http://172.17.139.81:29184/status
{"error":"bird unreachable"}
root@rs1:~# service birdwatcher status
● birdwatcher.service - birdwatcher
Loaded: loaded (/etc/systemd/system/birdwatcher.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2024-02-12 17:06:27 IST; 5h 13min ago
Main PID: 8210 (birdwatcher)
Tasks: 8 (limit: 17841)
Memory: 2.9M
CPU: 4.172s
CGroup: /system.slice/birdwatcher.service
└─8210 /usr/sbin/birdwatcher -config /usr/local/etc/birdwatcher.conf
Feb 12 22:11:28 rs1 birdwatcher[8210]: Housekeeping started
Feb 12 22:11:28 rs1 birdwatcher[8210]: Expiring MemoryCache
Feb 12 22:11:28 rs1 birdwatcher[8210]: Expired 0 entries (MemoryCache)
Feb 12 22:11:28 rs1 birdwatcher[8210]: Freeing memory
Feb 12 22:16:28 rs1 birdwatcher[8210]: Housekeeping started
Feb 12 22:16:28 rs1 birdwatcher[8210]: Expiring MemoryCache
Feb 12 22:16:28 rs1 birdwatcher[8210]: Expired 0 entries (MemoryCache)
Feb 12 22:16:28 rs1 birdwatcher[8210]: Freeing memory
Feb 12 22:20:21 rs1 birdwatcher[8210]: 172.31.14.139 - - [12/Feb/2024:22:20:21 +0530] "GET /status HTTP/1.1" 500 28
Feb 12 22:20:23 rs1 birdwatcher[8210]: 172.31.14.139 - - [12/Feb/2024:22:20:23 +0530] "GET /status HTTP/1.1" 500 28
Any help will be appreciated. Birdwatcher is latest.
I have found this old issue pointing to an issue when having dashes inside the protocol name within the bird config: ecix/alice-lg#12
This means that e.g. coreX_city does not work as protocol name.
From my understanding this is due to
Line 76 in b7d8845
Another issue I have found on our setup is the second value of the distance, e.g.:
aaaa:a401:8007::/48 via aaaa:bbbb:e001::1 on eth0 [corexcity 2019-12-27 14:03:10 from aaaa:bbbb:1337:5::7] * (100**/?**) [AS11111i]
This is not parsed because of the ?. This could be fixed by changing (?:/\d+) to (?:/[?\d]+)
Would it be possible to fix those or document the conditions that need to be fulfilled by the environment?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.