ServDoc_unix - describe the unix operating system
$Id: ServDoc_0101unixcommon,v 1.7 2003/08/17 10:13:27 uherbst Exp $
ServDoc_unix [-h|help] [-v|version] [--debug UNIX,intensity]
ServDoc_unix tries to describe ALL important things about your unix system.
This module should work on
What is important on a unix system ?
uname -a
/etc/passwd and /etc/group
The debug feature for that module is named ``UNIX''.
Ulrich Herbst <Ulrich.Herbst@gmx.de>
#!/usr/bin/perl -w
#---------------------------------------------------------------------- # standard perl modules use strict; # print error about unknown variables ... use English; # long internal variable names; use FindBin; # In which directory is ServDoc itself ? # There has to be the module and the lib dir! use lib $FindBin::Bin. "/lib"; # Here are the ServDoc-perl-modules use Sys::Hostname; # my own hostname # our own perl modules use ServDoc; use vars qw($options); #---------------------------------------------------------------------- $options->{Version} = '$Id: ServDoc_0101unixcommon,v 1.7 2003/08/17 10:13:27 uherbst Exp $'; # We need the cmdline to call the modules with the same debug options. $options->{cmdline} = join " ", @ARGV; sub debug { ServDoc_debug( "UNIX", $options, shift, shift ); } $options = &process_cmdline($options); %{$options->{lang}->{en}}= ( running => 'ServDoc_0101unixcommon is running.', version => "Unix%%+Versions%%+Kernel version", version_short => "Output from 'uname -a'", version_long => '', redhat => "Unix%%+Versions%%+Linux Distribution", redhat_short => "look at '/etc/redhat-release'", redhat_long => "", SuSE => "Unix%%+Versions%%+Linux Distribution", SuSE_short => "look at '/etc/SuSE-release'", SuSE_long => "", debian => "Unix%%+Versions%%+Linux Distribution", debian_short => "look at '/etc/debian_version'", debian_long => "", mandrake => "Unix%%+Versions%%+Linux Distribution", mandrake_short => "look at '/etc/mandrake-release'", mandrake_long => "", linux => "Unix%%+Versions%%+Linux Distribution", linux_short => "This seems to be a unknown (to ServDoc) Linux Distribution", linux_long => "", oslevel => "Unix%%+Versions%%+Maintenance Level", oslevel_short => "look at 'oslevel -r'", oslevel_long => "You can look at 'http://rs6000.ibm.com' ". "for new maintenance level for your aix'", instfix => "Unix%%+Versions%%+Installed Patches", instfix_short => "look at 'instfix -i'", instfix_long => "Look here if you eg need some prerequisites for ". "new software", showrev => "Unix%%+Versions%%+Patchlevel", showrev_short => "look at 'showrev -p'", showrev_long => "Look here if you eg need some prerequisites for ". "new software", shpatch => "Unix%%+Versions%%+Installed Patches", shpatch_short => "look at 'show_patches -a'", shpatch_long => "Look here if you eg need some prerequisites for ". "new software", uptime => "Unix%%+uptime", uptime_short => "look at 'uptime'", uptime_long => "When was your computer booted for the last time ? ". "Many sysadmins think this as a metric for their ". "own professionals skills. You can argue about that.", domain => "Unix%%+Domainname", domain_short => "look at 'dnsdomainname'", domain_long => "To which DNS domain does this host belong to ?", ); %{$options->{lang}->{de}}= ( running => 'ServDoc_0101unixcommon läuft jetzt..', version => "Unix%%+Versionen%%+Kernelversion", version_short => "Ausgabe von 'uname -a'", version_long => '', redhat => "Unix%%+Versionen%%+Linux Distribution", redhat_short => "steht in '/etc/redhat-release'", redhat_long => "", SuSE => "Unix%%+Versionen%%+Linux Distribution", SuSE_short => "steht in '/etc/SuSE-release'", SuSE_long => "", debian => "Unix%%+Versionen%%+Linux Distribution", debian_short => "steht in '/etc/debian_version'", debian_long => "", mandrake => "Unix%%+Versionen%%+Linux Distribution", mandrake_short => "steht in '/etc/mandrake-release'", mandrake_long => "", linux => "Unix%%+Versionen%%+Linux Distribution", linux_short => "Das ist anscheinend eine für ServDoc ". "unbekannte Linux-Distribution.", linux_long => "", oslevel => "Unix%%+Versionen%%+Maintenance Level", oslevel_short => "Ausgabe von 'oslevel -r'", oslevel_long => "Unter 'http://rs6000.ibm.com' ". "findet man immer den aktuellen Maintenance Level für diese AIX-Version", instfix => "Unix%%+Versionen%%+Installierte Patches", instfix_short => "Ausgabe von 'instfix -i'", instfix_long => "Schauen Sie hier nach, wenn Sie beispielsweise ". "vor der Installation von neuer Software Prerequistes wie Patchstände ". "prüfen wollen", showrev => "Unix%%+Versionen%%+Patchlevel", showrev_short => "Ausgabe von 'showrev -p'", showrev_long => "Schauen Sie hier nach, wenn Sie beispielsweise ". "vor der Installation von neuer Software Prerequistes wie Patchstände ". "prüfen wollen", shpatch => "Unix%%+Versionen%%+Installierte Patches", shpatch_short => "Ausgabe von 'show_patches -a'", shpatch_long => "Schauen Sie hier nach, wenn Sie beispielsweise ". "vor der Installation von neuer Software Prerequistes wie Patchstände ". "prüfen wollen", shpatch_long => "", uptime => "Unix%%+uptime", uptime_short => "Ausgabe von 'uptime'", uptime_long => "Wann wurde dieser Computer das letzte Mal gebootet ? ". "Viele SysAdmins nehmen das als Mass für ihr fachliches ". "Können. Darüber kann man natürlich streiten.", domain => "Unix%%+Domainname", domain_short => "Ausgabe von 'dnsdomainname'", domain_long => "Zu welcher DNS-Domäne gehört dieser Rechner ?", ); debug( 9, i18n_mesg('running')); #---------------------------------------------------------------------- # Main # If we are not on HP/UX,Solaris, AIX, Linux, return silently. if ( ! is_unix() ) { exit 0; } ################### # Kernel Version, # OS Version # Maintenance/Patch Level # .... ################### # Kernel-Level report_i18n('cmd','version','uname -a'); # Which linux-distribution ? if ( $OSNAME =~ /linux/ ) { LINUX_DIST: { if ( -e "/etc/redhat-release" ) { report_i18n('file','redhat','/etc/redhat-release'); last LINUX_DIST; } if ( -e "/etc/SuSE-release" ) { report_i18n('file','SuSE','/etc/SuSE-release'); last LINUX_DIST; } if ( -e "/etc/debian_version" ) { report_i18n('file','debian','/etc/debian_version'); last LINUX_DIST; } if ( -e "/etc/mandrake-release" ) { report_i18n('file','mandrake','/etc/mandrake-release'); last LINUX_DIST; } # Not RedHat, neiter SuSE or debian.... report_i18n('string','linux',''); } } if ($OSNAME =~ /aix/) { report_i18n('cmd',"oslevel","oslevel -r"); report_i18n('cmd','instfix','instfix -i'); } if ($OSNAME =~ /solaris/) { report_i18n('cmd',"showrev","showrev -p"); } if ($OSNAME =~ /hpux/) { report_i18n('cmd',"shpatch","show_patches -a"); } # FIXME patchlevel for HP/UX and Solaris report_i18n('cmd','uptime','uptime'); if ($OSNAME =~ /linux/) { report_i18n('cmd','domain','dnsdomainname'); }