Operating System - HP-UX
1827295 Members
2233 Online
109717 Solutions
New Discussion

How can a non-root user get memory information

 
SOLVED
Go to solution
Gary Yu
Super Advisor

How can a non-root user get memory information

Hello,

our production sites are hosted by other company, and I only have application users on those boxes(hpux 11.0), so how can I get information such as memory size with this user(the output of top really confused me)

thanks!
Gary
10 REPLIES 10
Sanjay_6
Honored Contributor

Re: How can a non-root user get memory information

Hi Gary,

What memory information are you looking for. If you are looking for physical memory info, run "dmesg" command and check for the like saying Physical memory.

Hope this helps.

Regds
Uday_S_Ankolekar
Honored Contributor
Solution

Re: How can a non-root user get memory information


Hi,

You can use grep -i physical /var/adm/syslog/syslog.log

you can check system peformance with sar command


goodluck,
-USA..
Good Luck..
A. Clay Stephenson
Acclaimed Contributor

Re: How can a non-root user get memory information

Hi Gary:

The memory displayed in top only shows the memory used by running processes and is almost worthless for determining installed memory. Dmesg works but only until the buffer is over-written. You can also use adb to read /dev/kmem but those permission should only allow root to read /dev/kmem or there is a big security hole. However, there is one good option and that is to install STM. Support Tool Manager - that can be executed be an ordinary user and will give you the data.

If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: How can a non-root user get memory information

Hi:

It's not clear to me if you want to know the server's installed physical memory or are interested in *your* processes.

On a per-process basis you could use the POSIX (UNIX95) options of the 'ps' command to assist in this tracking, ranking the output in descending kilobyte core size. Note that a space character follows the 'UNIX95' variable declaration and that the 'ps' command begins without any interceding delimiter. Thus, the variable UNIX95 is set only for the one command line.

# UNIX95= ps -e -o "user,vsz,pid,ppid,args" | sort -rnk2 | more

Regards!

...JRF...
Gary Yu
Super Advisor

Re: How can a non-root user get memory information

Thanks guys for the prompt response

Actually, I'm looking for information about physical memory installed. I can't run sam or dmesg with this user. And I don't know how our host company did, they seem to archive the syslog, so I cannot check the syslog when the server was rebooted.

Gary
John Payne_2
Honored Contributor

Re: How can a non-root user get memory information

Is glance installed? If so and you can run it, inside of glance you hit 'm' for the memory screen. The total physical memory will be at the bottom. If you need it, the qualified name for the executable is /opt/perf/bin/glance.
Spoon!!!!
Uday_S_Ankolekar
Honored Contributor

Re: How can a non-root user get memory information

Hi
Try this utility. give execute permission (chmod +x memdetail) before running

Good luck,
-USA..
Good Luck..
linuxfan
Honored Contributor

Re: How can a non-root user get memory information

Hi Gary,

Save the following in mem.c and compile it
cc -o /tmp/mem mem.c

/tmp/mem would give you the memory in MB

/Begin/

#include
#include
#include

main ()
{
struct pst_static buf;

pstat_getstatic(&buf,sizeof(struct pst_static),1,0);
printf("%ld MB\n", buf.physical_memory/256);
}

/End/

You can run this as a regular user.

-HTH
Ramesh
They think they know but don't. At least I know I don't know - Socrates
Deshpande Prashant
Honored Contributor

Re: How can a non-root user get memory information

HI
If you have glance installed on machine, use #glance -> m
This will give you physical memory in system.

Thanks.
Prashant Deshpande.
Take it as it comes.
Santosh Nair_1
Honored Contributor

Re: How can a non-root user get memory information

Get glance, it will give you all the information you would want to know, including total memory, total swap, per process memory, etc. You can install a trial version of Glance from the HP application CD.

-Santosh
Life is what's happening while you're busy making other plans