System info


 
Thread Tools Search this Thread
Top Forums Programming System info
# 1  
Old 12-05-2008
System info

Does anyone know graceful way to get information about system?
Information I am interested in is:
  1. Total size of physical memory.
  2. Total and free size of swap.
  3. Number of processors, their types and frequency.
  4. Mount point of file system for known directory.
Is there a good way to get such info on different unix systems (SunOS, Linux for example)? Maybe some POSIX calls.
All answers are welcome.
# 2  
Old 12-05-2008
Total size of physical memory------lscfg
Number of processors, their types and frequency -------lscfg
Total and free size of swap------
use the following script

*****************************************************
#!/usr/bin/ksh
#memory calculator
um=`svmon -G | head -2|tail -1| awk {'print $3'}`
um=`expr $um / 256`
tm=`lsattr -El sys0 -a realmem | awk {'print $2'}`
tm=`expr $tm / 1000`
fm=`expr $tm - $um`
echo "\n\n-----------------------";
echo "System : (`hostname`)";
echo "-----------------------\n\n";

echo "\n\n-----------------------";
echo " Users Login information \n";

for ENTRY in `finger | cut -d " " -f1 | grep -v Login | uniq`
do
echo "`finger -l $ENTRY | head -1 | cut -d \" \" -f14` ---> `finger -l $ENTRY |
awk '{ print $2 }' | tail -2 | head -1`";
#finger -l $ENTRY | awk '{ print $2 }' | tail -2 | head -1;
done
echo "-----------------------\n";

echo "\n----------------------";
echo "Memory Information\n\n";
echo "total memory = $tm MB"
echo "free memory = $fm MB"
echo "used memory = $um MB"
echo "\n\n-----------------------\n";
*******************************************

Mount point of file system for known directory --- df
# 3  
Old 12-06-2008
that doesn't work for multiple systems, SunOS for example. And this requires using system tools. Is there possibility to implement such features as C code?
# 4  
Old 12-07-2008
No. That is the whole point - sysadmin is OS specific. You have to write a Solaris version, Linux version, HP UX version, etc. There are no POSIX api calls that do this kind of thing.

See the Unix Rosetta Stone Rosetta Stone for Unix to get an idea how messy it is.
# 5  
Old 12-08-2008
Thanks a lot.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Successful user login, yet system claims invalid info

I have four AIX 6.1.7.4 systems freshly built and ready for our DBAs to do their work. Of the three one runs into an odd issue while logging in as himself, using Putty with ssh protocols. He logs in successfully, but also gets the following error message: : 3004-300 You entered an invalid login... (2 Replies)
Discussion started by: Mike Brendan
2 Replies

2. Solaris

How to find FC info on Sun x86 system?

Hi, we have a Sun x4150 server connecting to Brocade switches. I need to get all WWN on the Sun server. Here is the result: # fcinfo hba-port No Adapters Found. # prtconf -vp | grep -i wwn # luxadm probe ERROR: No Fibre Channel Adapters found. # luxadm -e port ERROR: No Fibre Channel... (2 Replies)
Discussion started by: aixlover
2 Replies

3. UNIX for Dummies Questions & Answers

Basic System Info Template

If your boss ask you to create a template for all UNIX systems. Max 10 questions of the system. What would you put down? The system can be any UNIX flavor. Some examples: 1. system name 2. OS 3. ETC What would be for you the most important and relevants. (2 Replies)
Discussion started by: 300zxmuro
2 Replies

4. Shell Programming and Scripting

recommended perl modules for system info.

I am doing some bespoke nagios plugins. can anyone recommend any good perl modules for system checks. disks, memory, processes, load avgs, networks, etc etc. everything basically. they will need to perform on bsd, aix, solaris, linux. any recommendations? (2 Replies)
Discussion started by: bigearsbilly
2 Replies

5. UNIX for Advanced & Expert Users

The best way to skin a cat OR how do I get file system info on the most basic level?

Hi, We have an FTP server (vsftpd) running on Linux, that I've kinda built a "Data Management" system around. I could use some ideas as to the best way to handle/create "triggers" for file notifications. Internal users drag 'n drop files from their Windows boxes to the server via Samba... (2 Replies)
Discussion started by: mph
2 Replies

6. Solaris

collecting system harware info

I'm looking for commands I can run on Solaris (8 and 9) to collect information regarding the installed hardware, ie network cards, sizes of physical disks in system, sizes of physical disks in connected storage array, etc. (1 Reply)
Discussion started by: soliberus
1 Replies

7. Programming

Does anyone have example code for getting File System info on AIX

I'm looking for example C source of how to get file system information on AIX systems. Does anyone have anything? (3 Replies)
Discussion started by: StuBob
3 Replies

8. UNIX for Dummies Questions & Answers

Finding system info

Can someone tell me the command to display the info about the CPU? I need the CPI id.. of my SUN box. Solaris 8. It's some totally un-intuitive command, and i can't recall it. tnx. (3 Replies)
Discussion started by: ireeneek
3 Replies

9. UNIX for Dummies Questions & Answers

How do I find out general system info?

How can I find out what type of processor, and speed, along with memory info such as RAM and storage. Also how do I scrollup on the shell? (2 Replies)
Discussion started by: AllyJones
2 Replies
Login or Register to Ask a Question