ProLiant Servers (ML,DL,SL)
cancel
Showing results for 
Search instead for 
Did you mean: 

sbin PATH issue with hp-snmp-agents-8.3.0.27-24

 
jw2dotorg
Occasional Visitor

sbin PATH issue with hp-snmp-agents-8.3.0.27-24

After installing hp-snmp-agents-8.3.0.27-24 on a Red Hat 5 (x86_64) system, the hp-snmp-agents service would fail to start with errors like this:

/opt/hp/hp-snmp-agents/server/etc/cmasm2d: line 44: dmidecode: command not found
/opt/hp/hp-snmp-agents/server/etc/cmasm2d: line 45: dmidecode: command not found
/opt/hp/hp-snmp-agents/server/etc/cmasm2d: /opt/hp/hp-snmp-agents/server/etc/cmarackd: line 24: pidof: command not found
/opt/hp/hp-snmp-agents/server/etc/cpqriisd: line 17: cmaerr: command not found

After looking in /opt/hp/hp-snmp-agents/server/etc/cmasm2d, I noticed lines like this:

RODNAME=`dmidecode | grep "Product Name" | cut -d" " -f4 | head -n1`
GENERATION=`dmidecode | grep "Product Name" | cut -d" " -f5 | head -n1`

Binaries like dmidecode and pidof are located in "sbin" paths like /sbin or /usr/sbin, which are not in the default PATH on a Red Hat system.

It appears the scripts should be detecting the actual path of the binaries instead of assuming they are in the path.

Also, those dmidecode lines don't appear in that script in hp-snmp-agents-8.1.0-110.rhel4, and the service stops and starts OK on a RHEL4 server.
4 REPLIES
TTr
Honored Contributor

Re: sbin PATH issue with hp-snmp-agents-8.3.0.27-24

From a UNIX perspective, it appears that you need to set up the right PATH environment for the cmasm2d script. If the script uses its own PATH variable, modify it to add /sbin path in it. If not and it inherits the PATH environment from the invoking shell, ensure that the invoking shell has /sbin in its PATH as well.
jw2dotorg
Occasional Visitor

Re: sbin PATH issue with hp-snmp-agents-8.3.0.27-24

Yes, your suggestions will resolve the problem, as I've already tested adding a PATH statement to HP's /etc/init.d/hp-snmp-agents script and found it to be successful. HP's script does not set a PATH variable.

However, my point in bringing this up is that I believe this is a bug in HP's software, and the fix should come from HP.

TTr
Honored Contributor

Re: sbin PATH issue with hp-snmp-agents-8.3.0.27-24

It could be a bug or lack of PATH configuration in the server environment by HP or by the OS/SNMP installation.

How do the installation or software settings differ in the RHEL4 release? i.e. does RHEL4 use the /sbin in the PATH (OS or SNMP software) or do they put their binaries in /bin or /usr/bin?
jw2dotorg
Occasional Visitor

Re: sbin PATH issue with hp-snmp-agents-8.3.0.27-24

It appears, HP just got sloppy in newer versions of the hp-snmp-agents packages.

In some scripts, they just call "pidof" directly:

---/opt/hp/hp-snmp-agents/server/etc/cmarackd---
pid=`pidof -o $$ -o $PPID -o %PPID -x $1`
---/opt/hp/hp-snmp-agents/server/etc/cmarackd---

But, in others, they do things much better:

---/opt/hp/hp-snmp-agents/server/etc/cmad---
...
#different distros put pidof in different places
if [ -f /sbin/pidof ]; then
PIDOF=/sbin/pidof
elif [ -f /bin/pidof ]; then
PIDOF=/bin/pidof
fi
...
pidlist=`$PIDOF -o $$ $PNAME`
---/opt/hp/hp-snmp-agents/server/etc/cmad---


The need these sanity checks in all their scripts.