Checking OS Type on Servers


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Checking OS Type on Servers
# 1  
Old 03-10-2012
Checking OS Type on Servers

is there a way to do this through snmp?

i'm writing a shell script that will be run against several servers, but when i run the script, the most i get back from snmp is information that is simple.

the snmp in the script tells me if the box is linux or solaris. but it doesn't tell me the version number of the OS.

anyone know of a way to get this?

Code:
snmpwalk -v 2c -c bacl@RP blah.net sysDescr 
SNMPv2-MIB::sysDescr.0 = STRING: Linux blah.net 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:34:33 EDT 2009 i686

# 2  
Old 03-10-2012
I'm missing something - the output you show does have kernel information - essentially the output of uname -a. This tells you a lot. You can teach your code what it means and decode it. How many server nodes in the network? A simple file or db tablewith nodenames, which you have to have anyway, with an extra set of fields can hold this infor.

For Linux & other UNIX, you seem to want the contents of a file like /etc/release, or whatever. The simplest way without writing a bunch of MIB C code is to use a direct ssh connection through a nothing-like account that can only see /etc/release (or whatever you deem necessary). Assuming that a version number is mission critical: Net-SNMP and 'what's up gold' among other snmp software offerings all provide for this - the scripted ssh connection kind of thing. As an example: WUG interfaces with IMacro so you can write expect-like scripts and get anything you want from a system, read-only, provided it doesn't violate security rules.

Also, I do not know of an OID speficied to do that. SysDescr is up to the OS implementer what gets returned AFAIK.
# 3  
Old 03-11-2012
Even in Linux there is no simple approach to getting that information. Some Linux distributions "lie" about their release name. Some use lsb-release. The C code we use to determine OS and release information is a couple of hundred lines of code.
# 4  
Old 03-12-2012
You can try using nmap tool.

In my practice it has show success mostly, but it's not 100%
# 5  
Old 03-12-2012
thank you so much for everyone who has replied. i have one question:

If i run a snmp against a host and i get the following, what can you ascertain about that host:

Code:
Linux 2.6.18-274.7.1.el5 #1 SMP Mon Oct 17 11:57:14 EDT 2011 x86_64

# 6  
Old 03-12-2012
That it is probably Red Hat Enterprise Linux 5 (el5 part in second field).
# 7  
Old 03-12-2012
Quote:
Originally Posted by bartus11
That it is probably Red Hat Enterprise Linux 5 (el5 part in second field).
probably? oh jeez. i'm really hoping i can use snmp for this. but the general consensus that i'm getting here is that it's not reliable?

i assumed it would be a red hat enterprise linux 5.

but i'm curious as to what "2.6.18-274.7.1" means.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Checking running process status using "grep" on multiple servers in load sharing system.

Suppose i have 3 different servers say x,y and z. Im running some process say ABC and 40 instances for the same is being created. In load sharing suppose on server x, 20 instances are running server y, 10 instances are running server z, 10 instances are running. While checking the... (1 Reply)
Discussion started by: ankitknit
1 Replies

2. SCO

Stop boot system at "Checking protected password and checking subsystem databases"

Hi, (i'm sorry for my english) I'm a problem on boot sco unix 5.0.5 open server. this stop at "Checking protected password and checking subsystem databases" (See this image ) I'm try this: 1) http://www.digipedia.pl/usenet/thread/50/37093/#post37094 2) SCO: SCO Unix - Server hangs... (9 Replies)
Discussion started by: buji
9 Replies

3. Shell Programming and Scripting

Help with script checking for a file in various servers

I am trying to write a script that checks whether or not, a file exists on multiple servers. My code / logic so far is: #!/usr/bin/ksh print "Enter File name to be checked" read MYFILE ssh server1 " cd /var/opt/logs ; if then ... (4 Replies)
Discussion started by: momin
4 Replies

4. Solaris

Type of RAID

Hi i need to know how i made for getting witch RAID my system used exist a commad for this ? thank you (7 Replies)
Discussion started by: dimitris
7 Replies

5. Shell Programming and Scripting

Perl data type checking

I am using perl 5.8.0. I need to check some values to see it they are floats. Our system does not have Data::Types so I can't use is_float. Is there something else that I can use? The only thing in Data is Dump.pm. I am not allowed to download anything to our system so I have to use what I have.... (3 Replies)
Discussion started by: ajgwin
3 Replies

6. Programming

array type has incomplete element type

Dear colleagues, One of my friend have a problem with c code. While compiling a c program it displays a message like "array type has incomplete element type". Any body can provide a solution for it. Jaganadh.G (1 Reply)
Discussion started by: jaganadh
1 Replies

7. Shell Programming and Scripting

String type to date type

Can one string type variable changed into the date type variable. (1 Reply)
Discussion started by: rinku
1 Replies

8. Shell Programming and Scripting

Awk type checking

Hello, How to check if two variables( fields in awk) have the same datatype ( INTEGER , REAL, TEXT ) ? (2 Replies)
Discussion started by: scotty_123
2 Replies

9. Shell Programming and Scripting

Different type of shells?

Hello there, i just want to know what are the different type of shells and the main difference betwee them. The problem is that if you try to search over the net you will find a lot of information and hence you will have no enough time to read all of them.....Anyone can help with this?? (1 Reply)
Discussion started by: charbel
1 Replies
Login or Register to Ask a Question