Operating System - Linux
1752805 Members
5451 Online
108789 Solutions
New Discussion юеВ

How can i monitor my apps?

 
kongxt
Occasional Contributor

How can i monitor my apps?

now , I want to develop an application to monitor other applications ,all apps are running on HP-UX.
What i want to get is the number of memory and cpu-time the apps used ,quite be similar with what "top " command outputs.
Now , I'm wondering wether there are any system API I can use in my developing.
Thanx.
5 REPLIES 5
Jannik
Honored Contributor

Re: How can i monitor my apps?

you could use sar or for a enterprice sollution you could use perfview.
jaton
Emil Velez
Honored Contributor

Re: How can i monitor my apps?

do you have the Openview Performance Agent. Using it you can create application groups and capture the amount of resource useage of a group of processes with 5 minute records. Glance also shows resource useage by groups of process. The file where this is defined is called /var/opt/perf/parm

There are some other examples in the file.
Pradeep_29
Frequent Advisor

Re: How can i monitor my apps?

If you don't have openview or glance, you can just create a simple shell script.
sar gives the CPU usage
vmstat gives the memory usage.
If u r just looking at each process then top output should be best to capture.

Awk the required output and put in while loop...
Arturo Galbiati
Esteemed Contributor

Re: How can i monitor my apps?

My suggestion is to use the glance tool in adviser mode. It'ps possbile by using a syntax file monitr the mem&cpu usage by appl.
Man glance for more info and take a look at the expample under:
/opt/perf/examples/

HTH,
Art
Arturo Galbiati
Esteemed Contributor

Re: How can i monitor my apps?

Hi,
this is an example about how to monitor 'java'.

You have to wrirte a syntax file:
#u_print_head="PRINT_HEAD"
u_print_head="Y"
u_headers_printed=u_headers_printed
if u_headers_printed==0 and u_print_head=="Y" then {
u_max_cpu_pct=100*gbl_active_cpu
print "# User CPU Util Cum Disk Thd"
print "#Process Name PID PPID Pri Name ( ",u_max_cpu_pct|4|0,"% max) CPU IO Rate RSS Cnt"
print "#------------ ------ ------ --- -------- ------------ -------- --------- ------- ---"
u_headers_printed = 1
} # endif
#
print "# ",
gbl_statdate,
" ",
gbl_stattime,
" C=",
gbl_cpu_total_util|3|0,
" D=",
gbl_disk_util_peak|3|0,
" M=",
gbl_mem_util|3|0,
" S=",
gbl_swap_space_util|3|0
#
process loop {
# if proc_proc_name == "PROC_NAME" then {
if proc_proc_name == "java" then {
print proc_proc_name|13," ",
proc_proc_id|6," ",
proc_parent_proc_id|6," ",
proc_pri|3," ",
proc_user_name|8," ",
proc_cpu_total_util|4|1,"/",
proc_cpu_total_util_cum|4|1," ",
proc_cpu_total_time_cum|8|1," ",
proc_disk_phys_io_rate|4|1,"/",
proc_disk_phys_io_rate_cum|4|1," ",
proc_mem_res|7|1," ",
proc_thread_count|3|0
} # endif
} # end process loop


and after monitor the appl:

glance -j10 -adviser_only -iterations 2 -syntax ./gln_proc_template_syntax_file

this is the output:
# User CPU Util Cum Disk Thd
#Process Name PID PPID Pri Name ( 800% max) CPU IO Rate RSS Cnt
#------------ ------ ------ --- -------- ------------ -------- --------- ------- ---
# 09/06/05 10:32:23 C= 18 D= 18 M= 60 S= 41
java 2501 1 168 root 0.0/ 0.4 17745.8 0.0/ 0.1 89.6mb 51
java 15252 15250 168 equinox 0.0/ 2.4 830.6 0.0/ 0.0 436.1mb 83
java 4500 1 154 priceeng 6.8/ 4.9 207.6 0.0/ 0.0 173.3mb 103
# 09/06/05 10:32:33 C= 12 D= 6 M= 60 S= 41
java 2501 1 168 root 1.6/ 0.4 17745.9 0.0/ 0.1 89.6mb 51
java 15252 15250 168 equinox 3.9/ 2.4 831.0 0.0/ 0.0 436.1mb 83
java 4500 1 168 priceeng 2.5/ 4.9 207.9 0.0/ 0.0 173.3mb 103

HTH,
Art