Exa-Networks / exabgp

The BGP swiss army knife of networking
Other
2.05k stars 440 forks source link

Exabgp: Added exabgp in systemd , while start of systemd for exabgp , the exabgp process starts , but the python script inside conf.ini is not processed. #1216

Closed vijayqwe closed 2 weeks ago

vijayqwe commented 2 weeks ago

Here is the config file :

[root@test-vnf-s22 blk]# cat conf.ini
process announce-routes {
run /usr/bin/python3.8 /tmp/blk/final_script.py;
encoder json;
}

neighbor 10.91.126.140 {
router-id 10.55.55.2;
local-address 10.55.55.2;
local-as 15404;
peer-as 8222;

api {
processes [announce-routes];
}

family {
ipv4 unicast;
}
}

Systemd config:

[Unit]
Description=ExaBGP
Documentation=man:exabgp(1)
Documentation=man:exabgp.conf(5)
Documentation=https://github.com/Exa-Networks/exabgp/wiki
After=network.target

[Service]
Environment=exabgp_daemon_daemonize=false
ExecStart=exabgp /tmp/blk/conf.ini
ExecReload=/bin/kill -USR1 $MAINPID
Restart=always
CapabilityBoundingSet=CAP_NET_ADMIN
AmbientCapabilities=CAP_NET_ADMIN

[Install]
WantedBy=multi-user.target
[root@test-vnf-s22 system]# sudo systemctl status exabgp
● exabgp.service - ExaBGP
Loaded: loaded (/etc/systemd/system/exabgp.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2024-06-24 13:08:41 EDT; 3s ago
Docs: man:exabgp(1)
man:exabgp.conf(5)
https://github.com/Exa-Networks/exabgp/wiki
Main PID: 17146 (exabgp)
Tasks: 1 (limit: 203492)
Memory: 17.8M
CGroup: /system.slice/exabgp.service
└─17146 /usr/bin/python3.8 /usr/local/bin/exabgp /tmp/blk/conf.ini

Jun 24 13:08:41 test-vnf-s22.novalocal systemd[1]: Started ExaBGP.
Jun 24 13:08:41 test-vnf-s22.novalocal exabgp[17146]: 13:08:41 | 17146 | welcome | Thank you for using ExaBGP
Jun 24 13:08:41 test-vnf-s22.novalocal exabgp[17146]: 13:08:41 | 17146 | version | 4.2.21
Jun 24 13:08:41 test-vnf-s22.novalocal exabgp[17146]: 13:08:41 | 17146 | interpreter | 3.8.17 (default, Aug 10 2023, 12:50:17) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)]
Jun 24 13:08:41 test-vnf-s22.novalocal exabgp[17146]: 13:08:41 | 17146 | os | Linux test-vnf-s22.novalocal 4.18.0-513.5.1.el8_9.x86_64 https://github.com/vijayqwe/vijay/issues/1 SMP Fri Sep 29 05:21:10 EDT 202>
Jun 24 13:08:41 test-vnf-s22.novalocal exabgp[17146]: 13:08:41 | 17146 | installation | /usr/local
thomas-mangin commented 2 weeks ago

This is a sysadmin question, not an exabgp issue. I appreciate that it prevents you from doing what you want, but this is not something I can "fix". It is probably an issue with the current working directory, path and/or env. I wish you good luck in debugging it.

thomas-mangin commented 2 weeks ago

If you are generous, please help us with the Wiki and provide a page for other users which may encounter the same challenge as you do.

vijayqwe commented 2 weeks ago

Thanks thomas for the response. let me check from my end . do you have any sample systemd config with trigger exabgp and python script inside exabgp to announce route.

vijayqwe commented 2 weeks ago

Thomas after modifying systemd config file exabgp.service like below it worked. Thanks again.

[Unit] Description=ExaBGP Documentation=man:exabgp(1) Documentation=man:exabgp.conf(5) Documentation=https://github.com/Exa-Networks/exabgp/wiki After=network.target

[Service] User=cisco Group=cisco Environment=exabgp_daemon_daemonize=false PermissionsStartOnly=true ExecStart=/usr/local/bin/exabgp /tmp/blk/exabgp.conf ExecReload=/bin/kill -USR1 $MAINPID Restart=always CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE

[Install] WantedBy=multi-user.target

vijayqwe commented 2 weeks ago

thanks