UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 10th, 2004, 03:39 PM
StevenC's Avatar
StevenC StevenC is offline
PHP & Java Error Master
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2003
Location: My Computer
Posts: 1,219 StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 1 h 57 m 4 sec
Reputation Power: 0
Getting system info for multiple flavors of Unix

Does anyone know of how I can obtain system info?

The script I'm writing is going to be used on Linux, AIX and SunOS.

It seems each flavor has it's own way of doing things, and I can probably code the script to execute different methods based on which os I'm on, but I can't seem to find a way to get what I want.

I've looked at sysinfo, but my attempts to make it work have failed (I made a shell script on SunOS with the following, but it failed.)
Code:
#include <sys/systeminfo.h>
long sysinfo (int command, char *buf, long count);


I found a post here how to do it on linux, but I haven't been able to test it yet.

Oh, and the info I need to get:
  • OS name
  • OS Version
  • CPU Quantity
  • Memory
  • Node Model
  • Node Type
  • Serial Number
  • IP Address
  • Gateway Address

Reply With Quote
  #2  
Old September 10th, 2004, 03:58 PM
stdunbar's Avatar
stdunbar stdunbar is offline
I remember music on MTV
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: May 2004
Location: Superior, CO, USA
Posts: 2,103 stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level)stdunbar User rank is General 1st Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 3 Days 13 h 37 m 37 sec
Reputation Power: 1047
sysinfo() would likely be a pretty good way to start but you're programming in C now. So your program would look something like:

Code:
#include <sys/systeminfo.h>

int main( int argc, char** argv )
{
    char[1024] genericBuffer;

    memset( genericBuffer, 0, 1024 );
    sysinfo(SI_SYSNAME, genericBuffer, 1024);
    printf( "O/S name is %s\n", genericBuffer );

    memset( genericBuffer, 0, 1024 );
    sysinfo(SI_HOSTNAME, genericBuffer, 1024);
    printf( "Hostname is %s\n", genericBuffer );

...
    return( 0 );
}


And, of course, since this isn't Java you will need to compile this with a C compiler on each platform you want it on.

However, sysinfo can't get you everything you want. In fact, I'm not even sure what all you want. For example, what is "Node Model" and "Node Type".

Let us know.

Reply With Quote
  #3  
Old September 10th, 2004, 04:06 PM
StevenC's Avatar
StevenC StevenC is offline
PHP & Java Error Master
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2003
Location: My Computer
Posts: 1,219 StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level)StevenC User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 1 h 57 m 4 sec
Reputation Power: 0
Oops, model and type are vendor specific, not something to do with the OS.
It's the model is the something like what you'd see on a dell:
Dell D600 for instance.

Reply With Quote
  #4  
Old September 13th, 2004, 10:42 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,327 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 15 h 24 m 56 sec
Reputation Power: 49
I'm not sure either - about what you want. You said Linux.

The kernel creates 'virtual' files in the /proc directory. CPU information, memory and a lot of other stuff is in those files. You can cat most of them to see what you need.
SunOS has a /proc directory as well - but with different files. AIX (I think) also has a /proc tree.

The point is: some of the stuff you want is configuration information, and the /proc directory usually has that information.

Otherwise - you're going to have to write some really complex C code to find out what you want.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Getting system info for multiple flavors of Unix


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 8 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek