Blame scripts/services/zz-sys

Packit 57988d
Packit 57988d
##########################################################################
Packit 57988d
# $Id$
Packit 57988d
##########################################################################
Packit 57988d
# $Log: zz-sys,v $
Packit 57988d
# Revision 1.3  2008/06/30 23:07:51  kirk
Packit 57988d
# fixed copyright holders for files where I know who they should be
Packit 57988d
#
Packit 57988d
# Revision 1.2  2008/03/24 23:31:27  kirk
Packit 57988d
# added copyright/license notice to each script
Packit 57988d
#
Packit 57988d
# Revision 1.1  2006/02/19 23:12:50  bjorn
Packit 57988d
# Get configuration info from system, based on script by Laurent Dufour.
Packit 57988d
#
Packit 57988d
##########################################################################
Packit 57988d
Packit 57988d
# This script prints out information about the CPU(s) and physical memory.
Packit 57988d
# It obtains the information from the Sys::CPU and Sys::MemInfo perl modules,
Packit 57988d
# so these must be installed.
Packit 57988d
Packit 57988d
# Note that the number of CPUs is not the number of physical CPU chips;
Packit 57988d
# CPUs with Hyperthreading or multiple cores affect the number of CPUs
Packit 57988d
# displayed.
Packit 57988d
Packit 57988d
#######################################################
Packit 57988d
## Copyright (c) 2008 Laurent Dufour
Packit 57988d
## Covered under the included MIT/X-Consortium License:
Packit 57988d
##    http://www.opensource.org/licenses/mit-license.php
Packit 57988d
## All modifications and contributions by other persons to
Packit 57988d
## this script are assumed to have been donated to the
Packit 57988d
## Logwatch project and thus assume the above copyright
Packit 57988d
## and licensing terms.  If you want to make contributions
Packit 57988d
## under your own copyright or a different license this
Packit 57988d
## must be explicitly stated in the contribution an the
Packit 57988d
## Logwatch project reserves the right to not accept such
Packit 57988d
## contributions.  If you have made significant
Packit 57988d
## contributions to this script and want to claim
Packit 57988d
## copyright please contact logwatch-devel@lists.sourceforge.net.
Packit 57988d
#########################################################
Packit 57988d
Packit 57988d
eval "require Sys::CPU";
Packit 57988d
if ($@) {
Packit 57988d
   print STDERR "No Sys::CPU module installed.  To install, execute the command:\n";
Packit 57988d
   print STDERR "   perl -MCPAN -e 'install Sys::CPU' \n\n";
Packit 57988d
} else {
Packit 57988d
   import Sys::CPU;
Packit 57988d
   print "   CPU:     " . Sys::CPU::cpu_count() . " " . Sys::CPU::cpu_type() . " at " . Sys::CPU::cpu_clock() . "MHz\n";
Packit 57988d
}
Packit 57988d
Packit 57988d
use POSIX qw(uname);
Packit 57988d
my ($OSname, $hostname, $release, $version, $machine) = POSIX::uname();
Packit 57988d
print "   Machine: $machine\n";
Packit 57988d
my $OStitle;
Packit 57988d
$OStitle = $OSname;
Packit 57988d
$OStitle = "Solaris" if ($OSname eq "SunOS" && $release >= 2);
Packit 57988d
print "   Release: $OStitle $release\n";
Packit 57988d
Packit 57988d
eval "require Sys::MemInfo";
Packit 57988d
if ($@) {
Packit 57988d
   print STDERR "No Sys::MemInfo module installed.  To install, execute the command:\n";
Packit 57988d
   print STDERR "   perl -MCPAN -e 'install Sys::MemInfo' \n\n";
Packit 57988d
} else {
Packit 57988d
   import Sys::MemInfo qw(totalmem freemem totalswap freeswap);
Packit 57988d
   my $swapused = &totalswap - &freeswap;
Packit 57988d
   printf "   Total Memory:  %6d MB\n", ((&totalmem - (&totalmem % (1024*1024))) / (1024*1024));
Packit 57988d
   printf "   Free Memory:   %6d MB\n", ((&freemem - (&freemem % (1024*1024))) / (1024*1024));
Packit 57988d
   printf "   Swap Used:     %6d MB\n", (($swapused - ($swapused % (1024*1024))) / (1024*1024));
Packit 57988d
}
Packit 57988d
Packit 57988d
# vi: shiftwidth=3 tabstop=3 syntax=perl et
Packit 57988d
# Local Variables:
Packit 57988d
# mode: perl
Packit 57988d
# perl-indent-level: 3
Packit 57988d
# indent-tabs-mode: nil
Packit 57988d
# End: