[freeside-commits] freeside/FS/FS Yori.pm,1.2,1.2.4.1
Jeff Finucane,420,,
jeff at wavetail.420.am
Wed Dec 23 15:14:29 PST 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv26429
Modified Files:
Tag: FREESIDE_1_9_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.2
retrieving revision 1.2.4.1
diff -u -d -r1.2 -r1.2.4.1
--- Yori.pm 28 Aug 2008 19:09:19 -0000 1.2
+++ Yori.pm 23 Dec 2009 23:14:27 -0000 1.2.4.1
@@ -71,3 +71,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