I prepared a simple scripts for doing this:

I run these commands every minute via cron:
/usr/bin/gmetric -n "_my_process_memory" -tint16 -u"%"  -v 
`/usr/local/bin/scripts/memory.pl  my_process`
/usr/bin/gmetric -n "_my_process_cpu" -tint16 -u"%"  -v 
`/usr/local/bin/scripts/cpu.pl  my_process`

Memory.pl:
        #!/usr/bin/perl

$PROCNAME = @ARGV[0];
$proc_mem = 0;

foreach $line (`ps -C$PROCNAME -o%mem`)
        {
        if ($line !~ '%MEM')
                {
                $proc_mem +=  $line;
                }
        }
print $proc_mem;

cpu.pl:
#!/usr/bin/perl
$PROCNAME = @ARGV[0];
$proc_cpu = 0;

foreach $line (`ps -C$PROCNAME -o%cpu`)
        {
        if ($line !~ '%CPU')
                {
                $proc_cpu +=  $line;
                }
        }
print $proc_cpu;

Rgds,
Vitaly
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:ganglia-
> [EMAIL PROTECTED] On Behalf Of João Oliveira
> Sent: Friday, October 13, 2006 3:24 PM
> To: [email protected]
> Subject: [Ganglia-general] Monitoring one process
> 
> Hi all,
> 
> i was reading the documentation's FAQ when i read about metrics that
> Ganglia supports. Well, i read all of them trying to understand each
> but i couldn't find the one that interests me the most, monitoring
> processes individually.
> 
> So, can i collect CPU usage time of one specific process using
> Ganglia?? I mean, is it possible?
> 
> Thanks in advance,
> 
> João Oliveira
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Ganglia-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to