added pl-ps/vtop scripts for vsys
authorKyoungSoo Park <kyoungso@cs.princeton.edu>
Mon, 12 May 2008 17:56:13 +0000 (17:56 +0000)
committerKyoungSoo Park <kyoungso@cs.princeton.edu>
Mon, 12 May 2008 17:56:13 +0000 (17:56 +0000)
factory/pl-ps [new file with mode: 0755]
factory/pl-ps.acl [new file with mode: 0644]
factory/vtop [new file with mode: 0755]
factory/vtop.acl [new file with mode: 0644]

diff --git a/factory/pl-ps b/factory/pl-ps
new file mode 100755 (executable)
index 0000000..4ade785
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+use strict;
+
+###############################################
+# pl-ps for slicestat by KyoungSoo Park
+###############################################
+
+my %slice_id;
+my %slice;
+
+open THIS_PIPE, "/bin/awk -F: \'{print \$1, \$3}\' /etc/passwd |";
+while(<THIS_PIPE>) {
+    if (/(.+)\s+(\d+)/) {
+       $slice_id{$1} = $2;
+       $slice{$2} = $1;
+    }  
+}
+close THIS_PIPE;
+
+open THIS_PIPE, "/usr/sbin/vps -eo pid,user | sed 1d | awk \'{print \$1, \$NF}\' | sort -k 2 |";
+while(<THIS_PIPE>) {
+    if (/(\d+)\s+(.+)$/) {
+       my $pid = $1;
+       my ($id, $sl);
+
+       if (defined($slice_id{$2})) {
+           $id = $slice_id{$2};
+           $sl = $2;
+       } else {
+           $id = $2;
+           $sl = $slice{$2};
+       }
+       print sprintf("%s %s %s\n", $id, $sl, $pid);
+    }
+}
+close THIS_PIPE;
diff --git a/factory/pl-ps.acl b/factory/pl-ps.acl
new file mode 100644 (file)
index 0000000..92b66d3
--- /dev/null
@@ -0,0 +1 @@
+princeton_slicestat
diff --git a/factory/vtop b/factory/vtop
new file mode 100755 (executable)
index 0000000..00e44c0
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+use strict;
+
+###############################################
+# vtop for slicestat by KyoungSoo Park
+###############################################
+
+open THIS_PIPE, "/usr/sbin/vtop bn1 |";
+while(<THIS_PIPE>) {
+    print;
+}
+close THIS_PIPE;
diff --git a/factory/vtop.acl b/factory/vtop.acl
new file mode 100644 (file)
index 0000000..92b66d3
--- /dev/null
@@ -0,0 +1 @@
+princeton_slicestat