Operating System - HP-UX
1845913 Members
4393 Online
110250 Solutions
New Discussion

Re: getting process I/O by command

 
SOLVED
Go to solution
itai weisman
Super Advisor

getting process I/O by command

hi,
does anyone know wheter there is a way to receive a process I/O interupts (by I/O per seconds, or by any other way) - like glance open files menu on a process view...
but with command (so it will be suitable for scripting)
10 REPLIES 10
Delrish
Trusted Contributor

Re: getting process I/O by command

You can use "iostat".Take a look at its man page.You can get many kinds of reports with it.
itai weisman
Super Advisor

Re: getting process I/O by command

I can't used iostat to see I/O per process (only per disk).
itai weisman
Super Advisor

Re: getting process I/O by command

I can't used iostat to see I/O per process (only per disk).
by the way - if you know any perl module or C function library related to this issue i'll be glad to check it too.
RAC_1
Honored Contributor

Re: getting process I/O by command

You can do that with iostat.
You need to have mwa/glance or PV for that.
These additional $ products.
There is no substitute to HARDWORK
itai weisman
Super Advisor

Re: getting process I/O by command

i have all three products.
how can I use iostat with that?
Arunvijai_4
Honored Contributor

Re: getting process I/O by command

Hello,

Check the following threads, it should be helpful to you.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=700950
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=955044

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
RAC_1
Honored Contributor

Re: getting process I/O by command

If you have mwa, you can do that as follows.
Prepare report file as follows. (customize /var/opt/perf/reptall

REPORT "MWA Export !DATE !TIME Logfile: !LOGFILE !COLLECTOR !SYSTEM_ID"
FORMAT ASCII
HEADINGS ON
SEPARATOR="|"
SUMMARY=60
MISSING=0

DATA TYPE PROCESS

BLANK
RECORD_TYPE
DATE
TIME
YEAR
DAY

PROC_PROC_ID
PROC_PROC_NAME
PROC_USER_NAME

PROC_DISK_PHYS_IO_RATE
PROC_DISK_PHYS_IO

there are many metrics available and you can choose what you want.
Then you can do extract command as follows.

extract -xp -v -gapkdztncuyGADZTNUY -r "rep_file_prepared_above" -f out_put_file -b 12/22/2005 00:00am -e 12/23/2005 01:00am

-b and -e are begining and end dates.
There is no substitute to HARDWORK
itai weisman
Super Advisor

Re: getting process I/O by command

I need it to be online, so I would be able to track a data migration status i'm doing...
It should be up to date - I/O per process per minute....
to be able to compare the I/O rate at the moment and at the moment before...
it's not a report, more like monitoring a process by I/O rate.
RAC_1
Honored Contributor

Re: getting process I/O by command

#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


change the process name and process metrics as you want.
There is no substitute to HARDWORK
RAC_1
Honored Contributor
Solution

Re: getting process I/O by command

#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


change the process name and process metrics as you want.

Execute it as follows.

glance -adviser_only -iteratons 4 -j2 -syntax "file_name"
There is no substitute to HARDWORK