cancel
Showing results for 
Search instead for 
Did you mean: 

Getting client version via nbhostmgmt command line

DPeaco
Moderator
Moderator
   VIP   

Greetings,

I've written a script to pull the host list from the activity monitor, put that host list output into a file and then I run nbhostmgmt against that host list output file. My issue is when nbhostmgmt is looking for a host that doesn't have a client installed or no longer exists, the command appears to hang and I have to kill the process. Is there a way to wrap nbhostmgmt in a timer wrapper that when it doesn't respond back in 15 seconds, it will kill that nbhostmgmt process and move on to the next host in the list?

Ideas? Tips? Pointers?

Thanks,
Dennis
4 REPLIES 4

quebek
Moderator
Moderator
   VIP    Certified
Hey.
Check out man page for timeout command on Linux.
Good luck with scripting.

Hi @DPeaco 

I'm curious about a couple of things - the nbhostmgmt command as far as I understand doesn't talk to any client, it queries the master for the information on the client listed (so a server without the client binaries installed or no longer existing shouldn't cause any delays).

For instance in a lab I have I can run the nbhostmgmt command (-li -host <host>) for a host that no longer has a DNS entry, but remains in the primary server's host (and certificate) list because it did exist in the past. The command returns with a screenful of information straightaway. This is with NetBackup version 10.2.0.1

As @quebek says, the timeout command in linux is the way to manage the "hangs". 

Do you mind sharing the command line options you are using with nbhostmgmt? Also what are you trying to achieve - what info are you extracting from nbhostmgmt output? I have a script that gets a unique list of clients (bpplclients - rather than scraping the activity monitor), then tries to ping each and run bptestbpcd against each (with a timeout) to check connectivity.

Cheers
David

 

Cheers
David

 

SebastianRoss
Level 3

Check out man page for timeout command on Linux.

DPeaco
Moderator
Moderator
   VIP   

@davidmoline 

Here is the command info that I've been using. It appears to be querying the client as it pauses on hosts that also pause/take longer in Host Properties in the GUI.

Begin-------
cat /tmp/host_list.txt | while read host_name; do
result=`/usr/openv/netbackup/bin/admincmd/nbhostmgmt -list -host $host_name 2>&1`
if [[ $? -gt 0 ]]; then
NbuVersionOFHost=`echo $result | awk -F": " '{ print $2 }'`
echo "Host Name: $host_name -- $host_name ----- $NbuVersionOFHost" >> /tmp/client_version/hostmgmt_client_version.out

else
NameOfHost=`/usr/openv/netbackup/bin/admincmd/nbhostmgmt -list -host $host_name | head -14 | grep -e "Host " | awk -F":" '{ print $2 }'`
NbuVersionOFHost=`/usr/openv/netbackup/bin/admincmd/nbhostmgmt -list -host $host_name | head -14 |grep -e "^Version " | awk -F":" '{ print $2 }'`
echo "Host Name: $host_name -- $NameOfHost ----- $NbuVersionOFHost" >> /tmp/client_version/hostmgmt_client_version.out
NameOfHost=""
NbuVersionOFHost=""
fi
sleep 3
done
End------
Thanks,
Dennis