1847023 Members
4015 Online
110258 Solutions
New Discussion

knowing physical memory

 
SOLVED
Go to solution
prasadb
Super Advisor

knowing physical memory

hello experts..

i just want to know whether a a normal user in HP UX having no sudo priviledges can see how much physical memory the system have ? if yes, whats the way to know that ?

thanx in advance..

18 REPLIES 18
Jeeshan
Honored Contributor

Re: knowing physical memory

i think there may be no such possibilities for doing such things until or unless he/she has some privileges on some system administration commands.
a warrior never quits
George_Dodds
Honored Contributor

Re: knowing physical memory

Here are a couple of commands you can try as a normal user to se if they work

dmesg |grep Physical

or if ignite is installed

print_manifest |grep â i memory
George_Dodds
Honored Contributor

Re: knowing physical memory

The last one is supposed to be

print_manifest |grep -i memory

It is doubtfull that a normal user will be able to run them, but you could try.
prasadb
Super Advisor

Re: knowing physical memory

both these commands :

dmesg |grep Physical
print_manifest |grep -i memory


cannot be run by the normal user

any other option ?

George_Dodds
Honored Contributor

Re: knowing physical memory

try

swapinfo -at

it shows physical memory as well as swap usage
James R. Ferguson
Acclaimed Contributor

Re: knowing physical memory

Hi:

Rather than asking "how?" I'd would ask "why?".

Why would a user need to know how much physical memory is on a server? Given that any processes he runs will be fenced (limited) by kernel parameters that govern (for example) the maximum stack (maxssiz) and data (maxdsiz) sizes of a process, it would be much more meaningful to program knowing these limits. As a normal user you can use 'ulimit' to display (and change the soft limit value). See the 'sh-posix' manpages under 'ulimit'.

In answer to the original question of how can a normal user know how much physical memory a system has, the answer is *ask* the system administrator.

Regards!

...JRF...
George_Dodds
Honored Contributor

Re: knowing physical memory

Indeed i hope your just playing on your test box.

Remember a little bit of knowledge can be dangerous ;-)
Dennis Handly
Acclaimed Contributor

Re: knowing physical memory

>so the final conclusion is that the normal user can not view the physical memory

Well, "swapinfo -tam" will give a good estimate of it. Also, I'm not sure whether pstat(2) will provide this info. It gives the VM stats.
Don Morris_1
Honored Contributor

Re: knowing physical memory

Physical memory is reported in the physical_memory field [in pages] from the pst_static structure returned by pstat_getstatic().
Torsten.
Acclaimed Contributor
Solution

Re: knowing physical memory

This works even for a normal user:

# echo "selclass qualifier memory;info;wait;infolog" | /usr/sbin/cstm


This will give you *all* details about the physical memory.

Why do you need this?

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
prasadb
Super Advisor

Re: knowing physical memory

Thank you Torsten..

yes, this has worked...

echo "selclass qualifier memory;info;wait;infolog" | /usr/sbin/cstm


this was required to know the memory of all the servers to prepare a report..

excellent option...

thank you very much
Pete Randall
Outstanding Contributor

Re: knowing physical memory

You can obtain CPU speed and RAM without CSTM or root access as described by Tom
Ferony (under Nancy Rippey's login) here:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=851889


Pete

Pete
SKR_1
Trusted Contributor

Re: knowing physical memory

From Glance, we can also see physical memory size.

Thanks
jolight
Frequent Advisor

Re: knowing physical memory

Yes. 'glance -m' will show u the physical memory for a user.
Torsten.
Acclaimed Contributor

Re: knowing physical memory

I think you want to do some scripting to collect this information from many servers, right?

IMHO all interactive tools won't help you here, so go with the "cstm" command I gave you

or

if you have Integrity Servers or HP9000 (with 11.31) you can also use

/usr/contrib/bin/machinfo

and grep for "Memory". this should also work for non-root users.

Example:

# /usr/contrib/bin/machinfo
CPU info:
64 Intel(R) Itanium 2 9000 series processors (1.6 GHz, 18 MB)
533 MT/s bus, CPU version C2
128 logical processors (2 per socket)

Memory: 981492 MB (958.5 GB)

...

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
prasadb
Super Advisor

Re: knowing physical memory

Hello Torsten..

your command echo "selclass qualifier memory;info;wait;infolog" | /usr/sbin/cstm

worked fine for me, but i was wondering to know
that this command takes the output from cstm anyway, which does not run from normal user, but this command can be run by normal user, how does this become possible.

could you throw some light on this ?

thanking you...
Dennis Handly
Acclaimed Contributor

Re: knowing physical memory

>which does not run from normal user, but this command can be run by normal user, how does this become possible.

I'm not sure what you are really asking?
Anyone can get the memory size, if they write a program calling pstat(2) as Don said.
Torsten's cstm command also gets this and more, probably because it is a setid program.
James R. Ferguson
Acclaimed Contributor

Re: knowing physical memory

Hi:

> which does not run from normal user, but this command can be run by normal user, how does this become possible.

> Dennis: Anyone can get the memory size, if they write a program calling pstat(2) as Don said.

Yes.

> Dennis: Torsten's cstm command also gets this and more, probably because it is a setid program.

No, 'cstm' isn't a setuid executable. I suspect that this executable is using the 'pstat()' system call, though without access to the HP source code I can't be absolutely positive. This would be a logical expectation, however.

As an aside, when the 'setuid' bit is set for a binary, the code runs as the user that owns the binary, inheriting the privileges of the owning, not running user account. A classic example is '/usr/bin/passwd' command which is owned by 'root' and thus when run by a normal users has 'root' privileges. The 'chmod' command is used to set the 'setuid' bit. For more information see the manpages for 'chmod(1)' and 'chmod(2)'.

As for 'cstm', as Torsten showed, its full path is 'Hi:

> which does not run from normal user, but this command can be run by normal user, how does this become possible.

> Dennis: Anyone can get the memory size, if they write a program calling pstat(2) as Don said.

Yes.

> Dennis: Torsten's cstm command also gets this and more, probably because it is a setid program.

No, 'cstm' isn't a setuid executable. I suspect that this executable is using the 'pstat()' system call, though without access to the HP source code I can't be absolutely positive. This would be a logical expectation, however.

As an aside, when the 'setuid' bit is set for a binary, the code runs as the user that owns the binary, inheriting the privileges of the owning, not running user account. A classic example is '/usr/bin/passwd' command which is owned by 'root' and thus when run by a normal users has 'root' privileges. The 'chmod' command is used to set the 'setuid' bit. For more information see the manpages for 'chmod(1)' and 'chmod(2)'.

As for 'cstm', if you look further, you will see that '/usr/sbin/cstm' is really just a shell script wrapper that is a convenience to invoke:

# /usr/sbin/stm/ui/bin/stm -c $*

All the script is doing is calling the (c)haracter interface ('-c') to 'stm' passing along any and all arguments ($*) you passed to the wrapper when you invoked it.

Similar wrappers exist for the X-window based use of 'stm', via:

# /usr/sbin/xstm

...and for the menu-based interface to 'stm':

# /usr/sbin/mstm

Regards!

...JRF...