Search code examples
systemtap

How can I send data on network inside a systemtap script?


I'm using systemtap to monitor some network, locking, task-wake-ups statistics, and I'd like to find an alternative to "println" (stap instruction), that would allow me to send data to a remote (networked) target (the idea being avoiding all disk access, even for temporary files).

UDP would be fine.

Is there a way inside a systemtap script to send a network packet with (text) data ? I thought of piping to netcat (nc) but hoped to avoid it.

Couldn't find answers on Google (maybe I didn't chose the correct set of keywords...), or in the user manual ?

Thanks in advance.


Solution

  • Currently, there is no native systemtap facility to initiate network traffic. stap | nc is one possibility; stap --remote HOST is another; probe FOO { system("echo HELLO > /dev/tcp/HOST/PORT") } is another.