SF.net SVN: logwatch:[88] scripts/services/zz-sys

[email protected]
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 88
          http://logwatch.svn.sourceforge.net/logwatch/?rev=88&view=rev
Author:   stefjakobs
Date:     2012-04-10 13:17:04 +0000 (Tue, 10 Apr 2012)
Log Message:
-----------
print total mem and free mem

Modified Paths:
--------------
    scripts/services/zz-sys

Modified: scripts/services/zz-sys
===================================================================
--- scripts/services/zz-sys	2012-04-03 15:38:38 UTC (rev 87)
+++ scripts/services/zz-sys	2012-04-10 13:17:04 UTC (rev 88)
@@ -47,16 +47,6 @@
    print "   CPU:     " . Sys::CPU::cpu_count() . " " . Sys::CPU::cpu_type() . " at " . Sys::CPU::cpu_clock() . "MHz\n";
 }
 
-eval "require Sys::MemInfo";
-if ($@) {
-   print STDERR "No Sys::MemInfo module installed.  To install, execute the command:\n";
-   print STDERR "   perl -MCPAN -e 'install Sys::MemInfo' \n\n";
-} else {
-   import Sys::MemInfo qw(totalmem);
-   print "   Memory:  " . ((&totalmem - (&totalmem % (1024*1024))) / (1024*1024)) . " MB\n";
-}
-
-
 use POSIX qw(uname);
 my ($OSname, $hostname, $release, $version, $machine) = POSIX::uname();
 print "   Machine: $machine\n";
@@ -65,6 +55,16 @@
 $OStitle = "Solaris" if ($OSname eq "SunOS" && $release >= 2);
 print "   Release: $OStitle $release\n";
 
+eval "require Sys::MemInfo";
+if ($@) {
+   print STDERR "No Sys::MemInfo module installed.  To install, execute the command:\n";
+   print STDERR "   perl -MCPAN -e 'install Sys::MemInfo' \n\n";
+} else {
+   import Sys::MemInfo qw(totalmem freemem);
+   printf "   Total Memory:  %6d MB\n", ((&totalmem - (&totalmem % (1024*1024))) / (1024*1024));
+   printf "   Free Memory:   %6d MB\n", ((&freemem - (&freemem % (1024*1024))) / (1024*1024)); 
+}
+
 # vi: shiftwidth=3 tabstop=3 syntax=perl et
 # Local Variables:
 # mode: perl

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.