Originally published April 27, 2016 @ 11:22 pm

Here’s an example of a script you can use to monitor NetBackup server daemons in a Linux environment. The main difficulty with keeping track of these services is that there are so many of them. What makes NetBackup reliable and rich in features is the modular nature of its design. For the same reason, a NetBackup server may need to run upwards of two dozen service daemons – often multiple instances of each.

Here’s a list of NetBackup daemons you may expect to run on the master server:

bpdbm bpjobd nbcssc nbstserv nbpem nbsvcmon bprd nbim bmrbd vnetd nbrmms pbx_exchange bpcd nbsl nbemm NB_dbsrv nbars nbrb nbevtmgr bmrd bpcompatd nbaudit nbvault nbjm

And these are the daemons that may be active on the media server:
vnetd nbsl bpcd nbcssc bpcompatd vmd nbrmms pbx_exchange spoold spad nbsvcmon tldd avrd ltid nbsvcmon

Not all of these will be active in your particular configuration. If you know your NetBackup environment is operating correctly, you can use the commands below to determine which daemons should be running on your system and use that list for your monitoring purposes.

On the master server:

master_daemons="bpdbm bpjobd nbcssc nbstserv nbpem nbsvcmon bprd nbim bmrbd vnetd nbrmms pbx_exchange bpcd nbsl nbemm NB_dbsrv nbars nbrb nbevtmgr bmrd bpcompatd nbaudit nbvault nbjm"
/usr/openv/netbackup/bin/bpps -x > /tmp/nbuproc
for i in ${master_daemons} ; do echo "${i}: `grep -c \"${i}\b\" /tmp/nbuproc`" ; done

On the media servers:
media_daemons="vnetd nbsl bpcd nbcssc bpcompatd vmd nbrmms pbx_exchange spoold spad nbsvcmon tldd avrd ltid nbsvcmon"
/usr/openv/netbackup/bin/bpps -x > /tmp/nbuproc
for i in ${media_daemons} ; do echo "${i}: `grep -c \"${i}\b\" /tmp/nbuproc`" ; done

Simply remove any daemon that says “0” from your list of monitored services. And here’s a very simple monitoring script. Just keep in mind that the script needs to be able to figure out if its running on the master server or on a media server. The way I have it configured, the master server has the word “master” in the hostname. And the media servers don’t.
#!/bin/bash

configure() {
	status=0
	f=/tmp/nbuproc
	if [ -f "${f}" ] ; then /bin/rm -f "${f}" ; fi
	/usr/openv/netbackup/bin/bpps -x > ${f}
	if [ ! -f "${f}" ] ; then exit 1 ; fi

	master_daemons="bpdbm bpjobd nbcssc nbstserv nbpem nbsvcmon bprd nbim vnetd nbrmms pbx_exchange bpcd nbsl nbemm NB_dbsrv nbars nbrb nbevtmgr bpcompatd nbaudit nbvault nbjm"
	media_daemons="vnetd nbsl bpcd nbcssc bpcompatd vmd nbrmms pbx_exchange nbsvcmon tldd avrd ltid nbsvcmon"
}

master_mon() {
	for i in ${master_daemons}
	do
		if [ `grep -c "${i}\b" "${f}"` -lt 1 ]
		then
			echo "BAD:  ${i}"
			status=1
		else
			echo "GOOD: ${i}"
		fi
	done
}

media_mon() {
	for i in ${media_daemons}
	do
		if [ `grep -c "${i}\b" "${f}"` -lt 1 ]
		then
			echo "BAD:  ${i}"
			status=1
		else
			echo "GOOD: ${i}"
		fi
	done
}

# RUNTIME
configure
if [ `echo $HOSTNAME | egrep -c master` -gt 0 ]
then
	master_mon
else
	media_mon
fi