how can trex run as a background process

1,971 views
Skip to first unread message

Hemin Patel

unread,
Jun 26, 2018, 10:14:01 AM6/26/18
to TRex Traffic Generator
Hello Team,

Can anyone help me out to give example command of how to initialize trex server as a background process?

For live monitor, i use as below command:
(1) ./t-rex-64 -i

For deamon process, how can i start trex?

Can anyone give me sample command for it? Thanking in advance.

Please do the needful as soon as possible.

Thanks and Regards,
Hemin

Karl Rister

unread,
Jun 26, 2018, 10:18:24 AM6/26/18
to hemin...@gmail.com, trex...@googlegroups.com
We use screen to run the trex server in the background with logging
and ability to reattach to the session for monitoring purposes:

https://github.com/atheurer/trafficgen/blob/master/launch-trex.sh

--
Karl Rister <kri...@redhat.com>
> --
> You received this message because you are subscribed to the Google Groups "TRex Traffic Generator" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to trex-tgn+u...@googlegroups.com.
> To post to this group, send email to trex...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/trex-tgn/87c674ea-8c6f-428e-840d-7a792289032e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Garnepalli Srikanth

unread,
Mar 25, 2019, 2:52:03 AM3/25/19
to TRex Traffic Generator
Hi Karl,

can you share the sample yaml file & any inputs if i just want to run "./t-rex64 -i " alone ?

thanks
srikanth Garnepalli

Mohan

unread,
Apr 25, 2019, 5:04:27 AM4/25/19
to TRex Traffic Generator
Hi Hemin,

Below command will run the trex daemon process.
./trex_daemon_server start -f [trex_path]


Run the UI, Click trex daemon in menu bar, provide the IP address of the trex is running and the port number is 8090, configure the yaml files and start trex in stateless mode.

Thanks,
Mohan

JS

unread,
May 9, 2019, 7:04:11 PM5/9/19
to TRex Traffic Generator
One other way is to run it as a systemctl service, I had issues with running it as screen where the Trex server would go unresponsive after running for prolonged period of time.


@ubuntu:/lib/systemd/system$ pwd
/lib/systemd/system
@ubuntu:/lib/systemd/system$ systemctl status trex.service
● trex.service - TREX Service
   Loaded: loaded (/etc/systemd/system/trex.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-05-09 18:56:34 EDT; 2min 14s ago
 Main PID: 926 (bash)
    Tasks: 15
   Memory: 93.4M
      CPU: 1min 2.415s
   CGroup: /system.slice/trex.service
           ├─ 926 /bin/bash t-rex-64 -i
           ├─1006 /usr/bin/python3 -m trex.scapy_server.scapy_zmq_server -s 4507
           └─2058 ./_t-rex-64 -i

May 09 18:58:47 ubuntu bash[926]:    opackets |               0 |               0
May 09 18:58:47 ubuntu bash[926]:      obytes |               0 |               0
May 09 18:58:47 ubuntu bash[926]:    ipackets |              53 |              52
May 09 18:58:47 ubuntu bash[926]:      ibytes |            3022 |            2948
May 09 18:58:47 ubuntu bash[926]:     ierrors |               0 |               0
May 09 18:58:47 ubuntu bash[926]:     oerrors |               0 |               0
May 09 18:58:47 ubuntu bash[926]:       Tx Bw |       0.00  bps |       0.00  bps
May 09 18:58:47 ubuntu bash[926]: -Global stats enabled
May 09 18:58:47 ubuntu bash[926]:  Cpu Utilization : 0.0  %
May 09 18:58:47 ubuntu bash[926]:  Platform_factor : 1.0
@ubuntu:/lib/systemd/system$ cat /etc/systemd/system/trex.service
[Unit]
Description=TREX Service

[Service]
WorkingDirectory=/opt/trex/v2.56
ExecStart=/bin/bash t-rex-64 -i

[Install]
WantedBy=multi-user.target
@ubuntu:/lib/systemd/system$ 
Message has been deleted

Steve Johnson

unread,
May 8, 2020, 5:44:31 AM5/8/20
to TRex Traffic Generator
In case it helps someone in the future, this is the service file that I've created under `/etc/systemd/system/trex.service`:

[Unit]
Description=TRex Traffic Generator Daemon
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
WorkingDirectory=/opt/trex/latest
ExecStart=/opt/trex/latest/trex_daemon_server -f /opt/trex/latest/daemon_files/ start
ExecStop=/opt/trex/latest/trex_daemon_server stop

[Install]
WantedBy=multi-user.target

Then issued the `systemctl daemon-reload` and `systemctl start trex`

Dave Houser

unread,
Mar 12, 2021, 4:07:59 PM3/12/21
to TRex Traffic Generator
Re: creating a unit with systemd. Strongly don't recommend using "t-rex-64" for your ExecStart by itself. All stdout produced by a unit by default will display in your /var/log/messages file (e.g. Your logs are going to fill up with all the output of the interactive mode refreshing.). If you want to keep using interactive mode with t-rex-64, and you don't want your logs to fill up, make sure to at least send stdout from your unit to /dev/null. You can enable this by editing your systemd unit and adding the following under your service section.

[service]
StandardOutput=null

Re: using trex_daemon_server, It is still not clear how this binary works. It seems to open up port 8090, but does not open up 4500 and 4501, which I need to connect from trex-console or the stateless gui. Is this expected? or am I just using this binary wrong?

hanoh haim

unread,
Mar 14, 2021, 8:20:37 AM3/14/21
to Dave Houser, TRex Traffic Generator
Hi, 
Adding "--iom 0 " to CLI will reduce the log 
The daemon exposes an API to start/stop trex in different modes of operation so it is better to load the daemon as a service and not the trex itself. This will give more flexibility to change mode of the operation / number of cores etc.

Thanks
Hanoh 

Reply all
Reply to author
Forward
0 new messages