ServDoc_0010hardware--linux - describe the hardware of your linux system
$Id: ServDoc_0010hardware--linux,v 1.8 2004/01/03 20:41:32 uherbst Exp $
ServDoc_0010hardware--linux [-h|help] [-v|version] [--debug HW,intensity]
ServDoc_0010hardware--linux describe the hardware of your system.
That should include:
The debug feature for that module is named ``HW''.
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 vars qw($options); # our own perl modules use ServDoc; #---------------------------------------------------------------------- $options->{Version} = '$Id: ServDoc_0010hardware--linux,v 1.8 2004/01/03 20:41:32 uherbst Exp $'; # We need the cmdline to call the modules with the same debug options. $options->{cmdline} = join " ", @ARGV; sub debug { ServDoc_debug( "HW", $options, shift, shift ); } $options = &process_cmdline($options); %{$options->{lang}->{en}}= ( running => 'ServDoc_0010hardware--linux is running.', cpu => "Hardware%%+CPU Number and Type", cpu_short => "look in '/proc/cpuinfo'", cpu_long => "", ram => 'Hardware%%+RAM', ram_short => "Output from 'free'", ram_long => "The physical amount of ram in your computer.", ram_out => "%i MBytes", pci => "Hardware%%+PCI devices", pci_short => "Output from 'lspci [-v]'", pci_long => "Which devices do you have on your pci-bus(ses)?" . 'These are (most of) your cards / adapters in your server, and often '. 'some devices onboard.', irq => "Hardware%%+Used Interrupts", irq_short => "look at '/proc/interrupts'", irq_long => "For some new devices it is important to use an ". "currently unused interrupt. Maybe it's important, which devices ". "share an interrupt.", ioport => "Hardware%%+IO%%+Ports", ioport_short => "look at '/proc/ioports'", ioport_long => "", iomem => "Hardware%%+IO%%+Memory", iomem_short => "look at '/proc/iomem'", iomem_long => "", dma => "Hardware%%+IO%%+DMA Devices", dma_short => "look at '/proc/dma'", dma_long => "", serial => "Hardware%%+Serial Hardware", serial_short => "look at '/proc/tty/driver/serial'", serial_long => "", mod => "Hardware%%+Loaded kernel modules", mod_short => "Output from 'lsmod'", mod_long => "", ); %{$options->{lang}->{de}}= ( running => 'ServDoc_0010hardware--linux startet jetzt.', cpu => "Hardware%%+CPU-Anzahl und -Typ", cpu_short => "steht in '/proc/cpuinfo'", cpu_long => "", ram => 'Hardware%%+RAM', ram_short => "Ausgabe von 'free'", ram_long => "Wieviel Hauptspeicher hat der Rechner physikalisch ?", ram_out => "%i MBytes", pci => "Hardware%%+Geräte am PCI-Bus", pci_short => "Ausgabe von 'lspci [-v]'", pci_long => "Welche Geräte gibt es am (an den) PCI-Bus(sen) ? " . 'Grösstenteils sind das Steckkarten/Adapter, oft aber auch Onboard-Geräte.', irq => "Hardware%%+Benutzte Interrupts", irq_short => "steht in '/proc/interrupts'", irq_long => "Fuer einige neue Geräte ist es wichtig, einen ". "bisher ungenutzen Interrupt zu nutzen. Manchmal ist es auch ". "wichtig zu wissen, welche Geräte einen Interrupt teilen.", ioport => "Hardware%%+IO%%+Ports", ioport_short => "steht in '/proc/ioports'", ioport_long => "", iomem => "Hardware%%+IO%%+Memory", iomem_short => "steht '/proc/iomem'", iomem_long => "", dma => "Hardware%%+IO%%+DMA Geräte", dma_short => "steht in '/proc/dma'", dma_long => "", serial => "Hardware%%+Serielle Hardware", serial_short => "steht in '/proc/tty/driver/serial'", serial_long => "", mod => "Hardware%%+Geladene Kernelmodule", mod_short => "Ausgabe von 'lsmod'", mod_long => "", ); debug( 9, i18n_mesg('running')); #---------------------------------------------------------------------- # Main # CPU's report_i18n("file",'cpu',"/proc/cpuinfo"); # RAM `free` =~ m/Mem:\s+(\d+)/ix; my $ram=int($1/1000); report_i18n('string','ram',i18n_mesg('ram_out',$ram)); # Server typ and model: not for x86 # IO-Controller and disks: look at DISK-output # Fixme: proc/scsi/scsi # network cards ?: Don't know. # FIXME: lspci | grep ethernet ? # PCI-Devices report_i18n('cmd','pci',"lspci -v"); # interrupts report_i18n('file','irq','/proc/interrupts'); # ioports, IO-Memory-Areas report_i18n('file','ioport','/proc/ioports'); report_i18n('file','iomem','/proc/iomem'); report_i18n('file','dma','/proc/dma'); # serial if ( -r "/proc/tty/driver/serial" ) { report_i18n('string','serial', join "\n", grep !/unknown/, split /\n/, readfile("/proc/tty/driver/serial")); } # Which kernelmodules ? report_i18n('cmd','mod','lsmod'); exit 0;