Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Aug 2006 20:08:16 +0200
From:      "Philippe Lang" <philippe.lang@attiksystem.ch>
To:        "freebsd-questions Questions" <freebsd-questions@freebsd.org>
Subject:   RE: Cacti & FreeBSD Jail CPU & RAM monitoring
Message-ID:  <6C0CF58A187DA5479245E0830AF84F421D1090@poweredge.attiksystem.ch>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Here a better formatted version.

#!/usr/bin/perl
@jails = `jls`;
$title = shift @jails;
chomp $title;
print $title . "\t\t%CPU\t%MEM\n";
foreach (@jails)
{
  my ($jid) = /\s+(\S+)\s/;
  @jexec = `jexec $jid ps -afxu`;

  @mem = map {/\S+\s+\S+\s+\S+\s+(\S+)\s/} @jexec;
  shift @mem;
  $tot_mem = 0;
  foreach (@mem) { $tot_mem = $tot_mem + $_; }

  @cpu = map {/\S+\s+\S+\s+(\S+)\s/} @jexec;
  shift @cpu;
  $tot_cpu = 0;
  foreach (@cpu) { $tot_cpu = $tot_cpu + $_; }

  chomp $_;
  print $_ . "\t";
  printf('%4.1f', $tot_cpu);
  print "\t";
  printf ('%4.1f', $tot_mem);
  print "\n";
}

---------------
Philippe Lang
Attik System


[-- Attachment #2 --]
0	*H
010	+0	*H
00GXa	&#+0
	*H
0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0
060622173146Z
070622173146Z0g1
0ULang10U*Philippe10U
Philippe Lang1+0)	*H
	philippe.lang@attiksystem.ch00
	*H
0Do;
FY64՝E	^vȗHyQ#weJb8qJgOMoQR4'Ƴ:fxNkzsۤ7 I=
ҼGc5
r
9070'U 0philippe.lang@attiksystem.ch0U00
	*H
?Z6Y('oö^$	Oo`.zf屰D^YA
cgsp)-,
56= u\}r/O]%.JJw8KxdXw j!v'@s0-00
	*H
010	UZA10UWestern Cape10U	Cape Town10U
Thawte Consulting1(0&UCertification Services Division1$0"UThawte Personal Freemail CA1+0)	*H
	personal-freemail@thawte.com0
960101000000Z
201231235959Z010	UZA10UWestern Cape10U	Cape Town10U
Thawte Consulting1(0&UCertification Services Division1$0"UThawte Personal Freemail CA1+0)	*H
	personal-freemail@thawte.com00
	*H
0i԰d[qGQr^}-
{߅%u(t:B,c'{K~ݹΖdnD|Mq@8x^^v]nz|KU)&j8$jDZڣyZ00U00
	*H
~Ngb*M`o`Xa&R5\0JbB#dG)ߝ^l`q\ynG
(|_#&	sC%/uQkw0?0
0
	*H
010	UZA10UWestern Cape10U	Cape Town10U
Thawte Consulting1(0&UCertification Services Division1$0"UThawte Personal Freemail CA1+0)	*H
	personal-freemail@thawte.com0
030717000000Z
130716235959Z0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA00
	*H
0Ħ<UsUNʙZhup[v:aQP
0cZ,p+Z?qV˯<6$*+w=+>@dקe*TH<a@dr`00U00CU<0:08642http://crl.thawte.com/ThawtePersonalFreemailCA.crl0U0)U"0 010UPrivateLabel2-1380
	*H
HP.
fgCL!6-6/P p<ab:~t%Pb'qW%ݩ9 Oe_N4[5MwV!x!5$F]_eO100v0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CAGXa	&#+0	+0	*H
	1	*H
0	*H
	1
060815180815Z0#	*H
	1@ǴaUj0g	*H
	1Z0X0
*H
0*H
0
*H
@0+0
*H
(0+0
*H
0	+71x0v0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CAGXa	&#+0*H
	1xv0b10	UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CAGXa	&#+0
	*H
8r
 LƬQXqE)=K!gCXB .FcL1tTPTLpe͓8r=5cݎ\n\ivm>1j'KU93V\>vN蘖

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6C0CF58A187DA5479245E0830AF84F421D1090>