cancel
Showing results for 
Search instead for 
Did you mean: 

newbie stm question

SOLVED
Go to solution
Ralph Grothe
Honored Contributor

newbie stm question

Hi everyone,

being relatively new to the world of HP-UX I'm still in the phase of discovering new (to me) tools and commands each day, and am hopping through the manpages, time permitting.

Up till now I've been desperately missing the beloved virtual /proc filesystem from Linux.
Mind you, all what I've learned about Unix so far I owe to Linux.
(wouldn't you agree that Linux/FreeBSD have done much to liberate Unix from mystical Guruism for the masses?)

Thus so far I would have placed such ugly lines as the following in my scripts to retrieve the RAM size, for instance:

mem=`top -s 1 -d 1|awk '/^Memory:/ {print $2}'|sed 's/[kmKM]//'`

or

mem=`dmesg|awk '$1=="Physical:" {print $2}'`

But I found both not particularly reliable.
(e.g. dmesg could be flushed, top's output seems to vary)

I know there have been many threads in this forum on the topic of how to find out about ones memory.
Even such awe inspiring hacks such as using a debugger on the kernel binaries.

But the meminfo only serves as an example and there are times when I occassionally need to collect other hardware info from the system.

Recently I discovered a diagmond daemon running on my servers and I came accross the stm manpage.

After having played a bit in the menus of mstm I would now like to use the command line version (viz. cstm or stm -c) to be invoked from my scripts.

How would I have to supply args to the command to achieve the same as highlighting the device (can the HW paths there always be expected to be same for same types of devices?), and then selecting tools->info->run from the menu?
Has anyone run stm from a script and can show me in an example (for easiness let's cling to the memory example) which syntax to use for that purpose.

Unfortunately the manpage (opposed to most of the other HP manpages) doesn't show an example.
Also the "help syntax" from the cstm> prompt wasn't much revealing.

Maybe some HP-UX veterans can shed some light?

TIA
Ralph



Madness, thy name is system administration
6 REPLIES
Patrick Wessel
Honored Contributor
Solution

Re: newbie stm question

Ralph,
grep on what ever you need

echo "selclass qualifier memory; info; wait; il" | cstm
There is no good troubleshooting with bad data
James R. Ferguson
Acclaimed Contributor

Re: newbie stm question

Hi:

Try this (assuming ioscan yields memory at H/W path = 49)

# cstm << EOF
sel path 49
info; wait
infolog
> EOF

...JRF...
Ralph Grothe
Honored Contributor

Re: newbie stm question

Patrick,

thanks, that's what I was looking for.

Actually I should have known (assumed) that stm like most Unix commands reads from stdin and thus can be piped into.

Is it advisable to place common commands in
/usr/sbin/stm/ui/config/.stmrc
or will even a ${HOME}/.stmrc file be parsed?
Madness, thy name is system administration
James R. Ferguson
Acclaimed Contributor

Re: newbie stm question

Hi:

Try this (assuming ioscan yields memory at H/W path = 49)

# cstm << EOF
> sel path 49
> info; wait
> infolog
> EOF

...JRF...
Ralph Grothe
Honored Contributor

Re: newbie stm question

James,

the here file is syntactically only a different approach I would have gathered from the 1st reply.
Sorry, for only giving you 8 pts. but Patrick was first (first come, first serve ;-) and you are already a crownbearer anyway.
Madness, thy name is system administration
Patrick Wessel
Honored Contributor

Re: newbie stm question

Ralph,
The file /usr/sbin/stm/ui/config/.stmrc is useful if you want to run the User Interface of the STM on your current system, but diagnose a remote system. I don't now any practical use for it if you run STM on the box you try to diagnose.
There is no good troubleshooting with bad data