[freeside-commits] freeside/FS/FS Yori.pm,1.1.2.2,1.1.2.3

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Dec 23 15:15:07 PST 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv26490

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	Yori.pm 
Log Message:
teach yori to do some load monitoring

Index: Yori.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Yori.pm,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- Yori.pm	21 Aug 2008 23:22:07 -0000	1.1.2.2
+++ Yori.pm	23 Dec 2009 23:15:05 -0000	1.1.2.3
@@ -63,3 +63,24 @@
 #  my $ssh_vulnkey = `ssh-vulnkey -a | grep COMPROMISED`;
 #  $ssh_vulnkey;
 #}
+
+sub report_load {
+  open LOAD, "</proc/loadavg" || return;
+  my($one, $five, $fifteen) = split ' ', <LOAD>;
+  close LOAD;
+  ($one, $five, $fifteen);
+}
+
+sub report_freememory {
+  open MEM, "</proc/meminfo" || return;
+  my $free = 0;
+  my @interesting = qw( MemFree Cached SwapFree );
+  while (<MEM>) {
+    /^(\w*):\s*(\d*) kB$/ || next;
+   next unless grep { $_ eq $1 } @interesting;
+   $free += $2;
+  }
+  close MEM;
+  $free;
+}
+



More information about the freeside-commits mailing list