swad Absent Member.
Absent Member.
681 views

Server query for unicast sessions

Multicast has a tool for viewing multicast sessions ("/opt/novell/zenworks/preboot/bin/novell-zmgmcast -list"), but there doesn't seem to be anything for unicast sessions. Is there a process I can monitor (or count) that would let me in on how many unicast images are being deployed? novell-pbservd or novell-tftpd?
Labels (2)
0 Likes
1 Reply
swad Absent Member.
Absent Member.

Re: Server query for unicast sessions

I wrote a bash script to have the server check for unique PIDs and count the number of active sessions being pushed from the server at the moment. It's based on this cool solution: Is anybody imaging right now? | Novell User Communities. The only thing I didn't like about that cool was that the command (strace -q -o unicast.txt -fp $(pgrep novell-pbservd) 2>&1 | grep send) only showed if there was traffic, but it didn't give me any info regarding how many sessions. Early tests with it showed different PIDs for different sessions, so I wrote the script to count unique PIDs and report. I haven't tested yet to see whether or not it also counts multicasts, but I'm guessing it does. I was going to make it fancy, but ultimately just had it read and write to files, with a couple of sed and awk commands. If any scripting guru wants to help me simplify it or figure out a cleaner way to do it, please go right ahead. I would like to eventually submit it as a cool solution for others to use.

#!/bin/bash
# Run strace on novell-pbservd and save to unicast.txt
# (based on Is anybody imaging right now? | Novell User Communities)
strace -q -o unicast.txt -fp $(pgrep novell-pbservd) 2>&1 &

# kill strace after 2 seconds with a 1 second buffer before the next command reads unicast.txt
sleep 2
killall strace
sleep 1

# Search unicast.txt for "sendto" and write to new file unicastsend.txt
cat unicast.txt | grep sendto > unicastsend.txt

#Read PIDs from unicastsend.txt, discarding rest of line. Output into clip.txt
sed -n 's/\([0-9]*\).*/\1/w clip.txt' <unicastsend.txt

#Combine all unique PIDs inside of clip.txt and output into sessions.txt
awk ' !x[$0]++' clip.txt > sessions.txt

#Read sessions.txt PIDs into array and output total count in yellow
a=( $( cat sessions.txt ) )
echo ""
echo -e "Unique sessions at this moment: \e[1;33m"$(( ${#a[@]} ))"\e[0m"
echo ""

#Cleanup files
rm unicast.txt
rm unicastsend.txt
rm clip.txt
rm sessions.txt
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.