SunQuest
           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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 10th, 2004, 02: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,217 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 15 m 14 sec
Reputation Power: 15
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
__________________


Webinfractions.com
Think I'm wrong? You're probably right!

Reply With Quote
  #2  
Old September 10th, 2004, 02:58 PM
stdunbar stdunbar is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: May 2004
Location: Superior, CO, USA
Posts: 1,677 stdunbar User rank is Captain (20000 - 30000 Reputation Level)stdunbar User rank is Captain (20000 - 30000 Reputation Level)stdunbar User rank is Captain (20000 - 30000 Reputation Level)stdunbar User rank is Captain (20000 - 30000 Reputation Level)stdunbar User rank is Captain (20000 - 30000 Reputation Level)stdunbar User rank is Captain (20000 - 30000 Reputation Level)stdunbar User rank is Captain (20000 - 30000 Reputation Level)stdunbar User rank is Captain (20000 - 30000 Reputation Level)stdunbar User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 3 h 50 m 47 sec
Reputation Power: 301
Send a message via ICQ to stdunbar Send a message via Yahoo to stdunbar
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, 03: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,217 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 15 m 14 sec
Reputation Power: 15
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, 09:42 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,307 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 4 h 28 m 57 sec
Reputation Power: 48
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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway